Beispiel #1
0
    void Awake()
    {
        controls = new SnakeControls();
        controls.PlayerControls.MoveUp.performed += x => { if (player.direction.z != -1)
                                                           {
                                                               player.direction = Vector3.forward;
                                                           }
        };
        controls.PlayerControls.MoveDown.performed += x => { if (player.direction.z != 1)
                                                             {
                                                                 player.direction = Vector3.back;
                                                             }
        };
        controls.PlayerControls.MoveRight.performed += x => { if (player.direction.x != -1)
                                                              {
                                                                  player.direction = Vector3.right;
                                                              }
        };
        controls.PlayerControls.MoveLeft.performed += x => { if (player.direction.x != 1)
                                                             {
                                                                 player.direction = Vector3.left;
                                                             }
        };
        controls.PlayerControls.Jump.performed += x => { rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse); };



        controls.DebugControls.AddBody.performed += x => { AddBody(startingBody); };
    }
Beispiel #2
0
 void Awake()
 {
     controls = new SnakeControls();
     controls.PlayerControls.PauseGame.performed += x => { TogglePause(); };
 }