Exemple #1
0
    private void UseClub()
    {
        // PrimaryAction
        if (KeybindingController.GetInputDown(GameControls.PrimaryUse) && playerMove.Movement.magnitude == 0)
        {
            gcController.PrimaryUseStart();
        }
        else if (KeybindingController.GetInput(GameControls.PrimaryUse))
        {
            gcController.PrimaryUseHeld();
        }
        else if (KeybindingController.GetInputUp(GameControls.PrimaryUse))
        {
            gcController.PrimaryUseEnd();
            if (gcController.CurrentMode == GolfClubController.Mode.Golfing)
            {
                playerAnimation.SetClubSwing(gcController.GetActiveClubIndex());
                EventController.FireEvent(new SendClubSwingAnimation(gcController.GetActiveClubIndex()));
            }
        }

        // Secondary Action
        if (KeybindingController.GetInputDown(GameControls.SecondaryUse))
        {
            gcController.SecondaryUseStart();
        }
        else if (KeybindingController.GetInput(GameControls.SecondaryUse))
        {
            gcController.SecondaryUseHeld();
        }
        else if (KeybindingController.GetInputUp(GameControls.SecondaryUse))
        {
            gcController.SecondaryUseEnd();
        }
    }
Exemple #2
0
 private void Update()
 {
     if (onScreen)
     {
         if (KeybindingController.GetInput(GameControls.Jump))
         {
             endScreenUI.SetActive(false);
             //Go to title or something
         }
     }
 }
 private void Update()
 {
     if (onScreen)
     {
         if (KeybindingController.GetInput(GameControls.Jump))
         {
             onScreen = false;
             ToggleVictoryScreen(false);
             ToggleShowDefeatScreen(false);
             EventController.FireEvent(new ShowEndScreenMessage());
         }
     }
 }
Exemple #4
0
    private void HandlePlayerMovement()
    {
        horizontalMove = 0;
        verticalMove   = 0;
        bool jump = false;

        // If we aren't accepting input / the player gets stunned, we still need to be able to fall from gravity
        // Therefore, we ensure the Move vars stay at 0
        if (acceptInput && !IsDead && !isGameOver)
        {
            if (KeybindingController.GetInput(GameControls.Sprint) && gcController.CurrentMode == GolfClubController.Mode.Running) // Can't sprint while golfing
            {
                playerMove.ShiftSpeed();
            }

            if (!isConfused)
            {
                if (KeybindingController.GetInput(GameControls.MoveForward))
                {
                    verticalMove = 1;
                }
                else if (KeybindingController.GetInput(GameControls.MoveBackward))
                {
                    verticalMove = -1;
                }
                else
                {
                    playerAnimation.SetRun(PlayerAnimation.RunState.stop);
                }

                if (KeybindingController.GetInput(GameControls.StrafeRight))
                {
                    horizontalMove = 1;
                }
                else if (KeybindingController.GetInput(GameControls.StrafeLeft))
                {
                    horizontalMove = -1;
                }
            }
            else
            {
                if (KeybindingController.GetInput(GameControls.MoveForward))
                {
                    horizontalMove = 1;
                }
                else if (KeybindingController.GetInput(GameControls.MoveBackward))
                {
                    horizontalMove = -1;
                }

                if (KeybindingController.GetInput(GameControls.StrafeRight))
                {
                    verticalMove = -1;
                }
                else if (KeybindingController.GetInput(GameControls.StrafeLeft))
                {
                    verticalMove = 1;
                }
            }

            SetRunAnimation(horizontalMove, verticalMove);

            jump = KeybindingController.GetInputDown(GameControls.Jump);

            playerMove.RotatePlayer();
        }

        playerMove.MovePlayer(horizontalMove, verticalMove, jump);
    }