コード例 #1
0
ファイル: PlayerInput.cs プロジェクト: Powertr1p/VaniaGame
    private void Update()
    {
        InputDirectionStorage.StoreLastNonZeroDirection(CrossPlatformInputManager.GetAxisRaw("Horizontal"));

        OnMovementButtonPressed?.Invoke(InputDirectionStorage.CurrentDirection);

        if (CrossPlatformInputManager.GetButtonDown("Jump"))
        {
            OnJumpButtonPressed?.Invoke();
        }

        if (CrossPlatformInputManager.GetButtonDown("Shift"))
        {
            OnDashButtonPressed?.Invoke(InputDirectionStorage.LastNonZeroDirection);
        }
    }
コード例 #2
0
        private void Update()
        {
            if (!GameEventsHandler.Instance.IsPlayerAlive)
            {
                return;
            }

            var horizontalInput = CrossPlatformInputManager.GetAxisRaw("Horizontal");

            OnMovementButtonPressed?.Invoke(horizontalInput);

            if (CrossPlatformInputManager.GetButtonDown("B_Button"))
            {
                OnJumpButtonPressed?.Invoke();
            }

            if (CrossPlatformInputManager.GetButtonDown("A_Button"))
            {
                OnAttackButtonPressed?.Invoke();
            }
        }