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

26 lines
630 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 Moving = Animator.StringToHash("Moving");
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.SetBool(Moving, false);
anim.SetBool(Moving, true);
}
public void OnStateChanged(IStateReader currentState)
{
speed_ = currentState.CurrentState.Speed;
2019-11-01 10:41:06 +00:00
}
}
}