示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         leftCommand.execute();
         prevMoves.Push('A');
     }
     else if (Input.GetKeyDown(KeyCode.S))
     {
         backCommand.execute();
         prevMoves.Push('S');
     }
     else if (Input.GetKeyDown(KeyCode.D))
     {
         rightCommand.execute();
         prevMoves.Push('D');
     }
     else if (Input.GetKeyDown(KeyCode.W))
     {
         forwardCommand.execute();
         prevMoves.Push('W');
     }
     else if (Input.GetKeyDown(KeyCode.R))
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
     }
 }