Ejemplo n.º 1
0
        void DoAction(CharacterMotor characterMotor)
        {
            if (forceNotGroundedState)
            {
                characterMotor.ForceNotGroundedState();
            }

            if (setNormalState)
            {
                targetCharacterController.MovementController.SetState(MovementState.Normal);
            }

            float sign = positiveValue ? 1 : -1;

            switch (actionType)
            {
            case ActionType.SetVelocityX:
                characterMotor.SetVelocityX(sign * value);
                break;

            case ActionType.SetVelocityY:
                characterMotor.SetVelocityY(sign * value);
                break;

            case ActionType.SetAccelerationX:
                characterMotor.AddVelocityX(sign * value * Time.deltaTime);
                break;

            case ActionType.SetAccelerationY:
                characterMotor.AddVelocityY(sign * value * Time.deltaTime);
                break;
            }
        }