Exemplo n.º 1
0
 // Debug
 void OnGUI()
 {
     // 显示速度
     GUI.Label(new Rect(10, 10, 200, 20), _rigidbody.velocity.ToString());
     // 显示速率
     GUI.Label(new Rect(10, 30, 200, 20), _rigidbody.velocity.magnitude.ToString());
     // 显示状态
     GUI.Label(new Rect(10, 50, 200, 20), State.GetType().ToString());
 }
Exemplo n.º 2
0
 // 下一个State的初始化会在当前状态的Exit前进行,需要修改
 public void SwitchTo(State targetState)
 {
     Exit();
     UnityEngine.Debug.Log("switch to " + targetState.GetType());
     player.State = targetState;
 }