Exemplo n.º 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();
        }
    }
Exemplo n.º 2
0
 public void CheckSupportBallSpawn()
 {
     if (KeybindingController.GetInputDown(GameControls.AbilityBallTwo))
     {
         tM.StepDone();
     }
 }
Exemplo n.º 3
0
 private void Update()
 {
     if (KeybindingController.GetInputDown(GameControls.Escape))
     {
         EscapePressed();
     }
 }
Exemplo n.º 4
0
 public void CheckStorageBallSpawn()
 {
     if (KeybindingController.GetInputDown(GameControls.AbilityBallThree))
     {
         tM.StepDone();
     }
 }
Exemplo n.º 5
0
 public void CheckOffenseBallSpawn()
 {
     if (KeybindingController.GetInputDown(GameControls.AbilityBallOne))
     {
         tM.StepDone();
     }
 }
 private void ShowPrompt()
 {
     foreach (Prompt item in prompts)
     {
         item.textPrompt.text = KeybindingController.GetKeybindName(item.control);
     }
 }
Exemplo n.º 7
0
 private void HandleMiscInput()
 {
     if (KeybindingController.GetInputDown(GameControls.PayRespects))
     {
         if (NetworkManager.instance)
         {
             NetworkManager.instance.SendPayRespects();
         }
     }
 }
Exemplo n.º 8
0
 private void Update()
 {
     if (onScreen)
     {
         if (KeybindingController.GetInput(GameControls.Jump))
         {
             endScreenUI.SetActive(false);
             //Go to title or something
         }
     }
 }
Exemplo n.º 9
0
    public void StopRebindProcess()
    {
        Rebinding = false;

        foreach (KeybindButton keybindButton in keybindButtons)
        {
            keybindButton.SetKeybindText(KeybindingController.GetKeybindName(keybindButton.Control));
        }

        StartCoroutine(RemoveUIBlocker());
    }
Exemplo n.º 10
0
 private void Update()
 {
     if (onScreen)
     {
         if (KeybindingController.GetInput(GameControls.Jump))
         {
             onScreen = false;
             ToggleVictoryScreen(false);
             ToggleShowDefeatScreen(false);
             EventController.FireEvent(new ShowEndScreenMessage());
         }
     }
 }
Exemplo n.º 11
0
 private void UseAbilityBall()
 {
     if (KeybindingController.GetInputDown(GameControls.AbilityBallOne))
     {
         EventController.FireEvent(new AbilityBallPrepareMessage(this, myAbilities[0], 0));
     }
     else if (KeybindingController.GetInputDown(GameControls.AbilityBallTwo))
     {
         EventController.FireEvent(new AbilityBallPrepareMessage(this, myAbilities[1], 1));
     }
     else if (KeybindingController.GetInputDown(GameControls.AbilityBallThree))
     {
         EventController.FireEvent(new AbilityBallPrepareMessage(this, myAbilities[2], 2));
     }
 }
Exemplo n.º 12
0
    private void SetUpControlsMenu()
    {
        keybindButtons = new List <KeybindButton>();

        int   controlsCount = System.Enum.GetValues(typeof(GameControls)).Length;
        float yScale        = keybindButtonPrefab.GetComponent <RectTransform>().sizeDelta.y;

        contentWindow.sizeDelta = new Vector2(contentWindow.sizeDelta.x, (controlsCount - 1) * yScale); // count - 1 so ESCAPE can't be rebound

        for (int i = 0; i < controlsCount - 1; i++)
        {
            GameControls  c             = (GameControls)i;
            KeybindButton keybindButton = Instantiate(keybindButtonPrefab, contentWindow);
            keybindButton.SetUp(-yScale * i, c, KeybindingController.GetKeybindName(c));

            keybindButtons.Add(keybindButton);
        }

        uiBlocker.SetActive(false);
        keybindExplanation.SetActive(false);
    }
Exemplo n.º 13
0
    public void CycleDefaultControls(int dir)
    {
        controlsIndex += dir;

        if (controlsIndex < 0)
        {
            controlsIndex = defaultControlsCount - 1;
        }
        else if (controlsIndex >= defaultControlsCount)
        {
            controlsIndex = 0;
        }

        controlscheme.text = controlSchemes[controlsIndex];

        KeybindingController.SetControls(controlsIndex);

        foreach (KeybindButton kb in keybindButtons)
        {
            kb.SetKeybindText(KeybindingController.GetKeybindName(kb.Control));
        }
    }
Exemplo n.º 14
0
 private void HandleClubSwitching()
 {
     if (KeybindingController.GetInputDown(GameControls.NextClub))
     {
         gcController.ScrollClub(1);
     }
     else if (KeybindingController.GetInputDown(GameControls.PreviousClub))
     {
         gcController.ScrollClub(-1);
     }
     else if (KeybindingController.GetInputDown(GameControls.SwitchToClubOne))
     {
         gcController.ChooseClub(0);
     }
     else if (KeybindingController.GetInputDown(GameControls.SwitchToClubTwo))
     {
         gcController.ChooseClub(1);
     }
     else if (KeybindingController.GetInputDown(GameControls.SwitchToClubThree))
     {
         gcController.ChooseClub(2);
     }
 }
Exemplo n.º 15
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);
    }
Exemplo n.º 16
0
    public void OnGUI()
    {
        if (Rebinding)
        {
            Event e = Event.current;

            if (e.isKey && e.keyCode != KeyCode.Escape)
            {
                KeyCode kc = e.keyCode;

                KeybindingController.SetControlKeybind(controlToBind, kc);

                StopRebindProcess();
            }
            else if (e.shift)
            {
                if (Input.GetKey(KeyCode.LeftShift))
                {
                    KeybindingController.SetControlKeybind(controlToBind, KeyCode.LeftShift);
                }
                else
                {
                    KeybindingController.SetControlKeybind(controlToBind, KeyCode.RightShift);
                }

                StopRebindProcess();
            }
            else if (e.isMouse)
            {
                switch (e.button)
                {
                case 0:
                    KeybindingController.SetControlKeybind(controlToBind, MouseCode.LeftMouseButton);
                    break;

                case 1:
                    KeybindingController.SetControlKeybind(controlToBind, MouseCode.RightMouseButton);
                    break;

                case 2:
                    KeybindingController.SetControlKeybind(controlToBind, MouseCode.MiddleMouseButton);
                    break;

                default:
                    Debug.Log(e.button);
                    break;
                }

                StopRebindProcess();
            }
            else if (e.isScrollWheel)
            {
                if (e.delta.y < 0) // scroll up
                {
                    KeybindingController.SetControlKeybind(controlToBind, MouseCode.MouseWheelUp);
                }
                else // scroll down
                {
                    KeybindingController.SetControlKeybind(controlToBind, MouseCode.MouseWheelDown);
                }

                StopRebindProcess();
            }
        }
    }
Exemplo n.º 17
0
    private void SetUp()
    {
        KeybindingController.Init();

        // In Future, get Sensitivities from a save file
    }