soundvision/UnityProject/Assets/Scenes/Examples/MIDI/script/OrangeCube.cs

24 lines
614 B
C#
Raw Normal View History

2019-11-01 10:41:06 +00:00
using UnityEngine;
namespace cylvester
{
public class OrangeCube : MonoBehaviour
{
[SerializeField] private Animator anim;
2019-11-01 12:33:23 +00:00
private float speed_ = 1.0f;
private static readonly int OrangeBoxAnimation1 = Animator.StringToHash("OrangeBoxAnimation1");
2019-11-01 12:33:23 +00:00
private bool trigger_;
2019-11-01 10:41:06 +00:00
public void OnTriggerReceived()
{
2019-11-01 12:33:23 +00:00
anim.speed = speed_;
anim.Play(OrangeBoxAnimation1, -1, 0f);
2019-11-01 12:33:23 +00:00
}
public void OnStateChanged(IStateReader currentState)
{
speed_ = currentState.CurrentState.Speed;
2019-11-01 10:41:06 +00:00
}
}
}