Exemple #1
0
    private void ProcessInput()
    {
        KeyCode KCode = KeyCode.JoystickButton0;

        if (Input.GetKeyDown(KCode))
        {
            PlayerActions.Jump();
        }

        if (Input.GetKeyDown(KCode + FXboxControllerButton.Button_X))
        {
            GameObject WeaponGO = PlayerScript.GetWeapon();

            if (WeaponGO == null)
            {
                float AttackDamage = PlayerScript.GetAttackDamage();
                PlayerActions.Attack(AttackDamage);
                PlayerScript.ApplyAttackFatigue();
            }
        }

        if (Input.GetKey(KCode + FXboxControllerButton.Button_X))
        {
            GameObject WeaponGO = PlayerScript.GetWeapon();
            if (WeaponGO != null)
            {
                GGun WeaponScript = WeaponGO.GetComponent <GGun>();
                WeaponScript.Fire();
            }
        }

        if (Input.GetKey(KCode + FXboxControllerButton.Button_B))
        {
            PlayerActions.IncreaseGrenadeTrajectory();
        }

        if (Input.GetKeyUp(KCode + FXboxControllerButton.Button_B))
        {
            PlayerActions.ReleaseGrenade();
        }

        float AxisX = Input.GetAxis("XboxP1_DPadHorizontal");

        if (AxisX < -DeadZone)
        {
            if (!bTappedLeft)
            {
                bTappedLeft = true;
            }
            //TODO::The rest of the double tap impl.

            PlayerActions.MoveLeft();
        }
        else if (AxisX > DeadZone)
        {
            PlayerActions.MoveRight();
        }
    }
    private void ProcessKeyboardInput()
    {
        /*Move Left*/
        if (Input.GetKey(KeyCode.A))
        {
            PlayerActions.MoveLeft();
        }
        /*Move right*/
        else if (Input.GetKey(KeyCode.D))
        {
            PlayerActions.MoveRight();
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            PlayerActions.Jump();
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            float AttackDamage = PlayerScript.GetAttackDamage();
            PlayerActions.Attack(AttackDamage);
            PlayerScript.ApplyAttackFatigue();
        }

        if (Input.GetKey(KeyCode.F))
        {
            GameObject WeaponGO = PlayerScript.GetWeapon();

            if (WeaponGO == null)
            {
                PlayerActions.IncreaseGrenadeTrajectory();
            }
        }

        if (Input.GetKeyUp(KeyCode.F))
        {
            GameObject WeaponGO = PlayerScript.GetWeapon();

            if (WeaponGO == null)
            {
                PlayerActions.ReleaseGrenade();
            }
        }

        if (Input.GetKey(KeyCode.F))
        {
            GameObject WeaponGO = PlayerScript.GetWeapon();

            if (WeaponGO != null)
            {
                GGun WeaponScript = WeaponGO.GetComponent <GGun>();
                WeaponScript.Fire();
            }
        }
    }