Advertisement
leomovskii

Anim.cs

Jan 7th, 2022
1,049
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Anim : MonoBehaviour {
  6.  
  7.     Animation anim;
  8.  
  9.     void Start() {
  10.         anim = GetComponent<Animation>();
  11.     }
  12.  
  13.     void Update() {
  14.         if (Input.GetKeyDown(KeyCode.P))
  15.             anim.Play("Coin");
  16.        
  17.         if (Input.GetKeyDown(KeyCode.S))
  18.             anim.Stop("Coin");
  19.     }
  20.    
  21.     public void Triggered() {
  22.         Debug.Log("Анимация закончилась");
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement