privatevoidStart() { m_moveForwad = new MoveCommand(Vector3.forward); m_moveBack = new MoveCommand(Vector3.back); m_moveLeft = new MoveCommand(Vector3.left); m_moveRight = new MoveCommand(Vector3.right); }
privatevoidUpdate() { if (Input.GetKeyDown(KeyCode.W)) { CommandManager.Excute(m_moveForwad, gameObject); } if (Input.GetKeyDown(KeyCode.S)) { CommandManager.Excute(m_moveBack, gameObject); } if (Input.GetKeyDown(KeyCode.A)) { CommandManager.Excute(m_moveLeft, gameObject); } if (Input.GetKeyDown(KeyCode.D)) { CommandManager.Excute(m_moveRight, gameObject); } if (Input.GetKeyDown(KeyCode.R)) { CommandManager.Revock(gameObject); } } }