void HandleInput()
    {
        //TODO: Break into chunks of actions that can be performed at the same time, ie movmenet actions, attack actions, etc
        if (Input.GetKeyDown(KeyCode.W))
        {
            KeyW.Execute(Character, KeyW);
        }
        if (Input.GetKeyDown(KeyCode.A))
        {
            KeyA.Execute(Character, KeyA);
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            KeyS.Execute(Character, KeyS);
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            KeyD.Execute(Character, KeyD);
        }
        //TODO: Ensure the following cant be pressed at the same time as an action
        else if (Input.GetKeyDown(KeyCode.R))
        {
            KeyR.Execute(Character, KeyR);
        }
        else if (Input.GetKeyDown(KeyCode.Z))
        {
            KeyZ.Execute(Character, KeyZ);
        }
        else
        {
            //No keys pushed
            //new IdleCommand().Execute();
        }

        /*else if (Input.GetKeyDown(KeyCode.B))
         * {
         *      KeyB.Execute(KeyB);
         * }*/
    }
示例#2
0
 void HandleInput()
 {
     if (Input.GetKeyDown(KeyCode.W))
     {
         KeyW.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.S))
     {
         KeyS.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.A))
     {
         KeyA.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.D))
     {
         KeyD.Execute(snakehead);
     }
     else if (Input.GetKeyDown(KeyCode.Space))
     {
         snakehead.GetComponent <Snake>().CreateSnakePart();
         //Time.timeScale = 3;
     }
 }