Ejemplo n.º 1
0
    void InputController_OnCurrentAxis(Axis axis, float value, InputController controller)
    {
        if (!IsDead)
        {
            switch (axis)
            {
            case Axis.MoveHorizontal:
                direction.x = value;
                break;

            case Axis.MoveVertical:
                direction.z = value;
                break;

            case Axis.RotateHorizontal:
                rotation.x = value;
                break;

            case Axis.RotateVertical:
                rotation.z = value;
                break;

            case Axis.Shoot:
                if (CanAttack && value > 0)
                {
                    currentWeapon?.Use(true);
                }
                else
                {
                    currentWeapon?.Use(false);
                }
                break;
            }
        }
    }