Exemplo n.º 1
0
        private void triggerEventAction(LocomotionActionEvent targetEvent)
        {
            snapIfNeeded(targetEvent.Position);
            LocomotionController currentController = locomotionTracker.GetCurrentController();

            switch (targetEvent.Type)
            {
            case LocomotionAction.Torpedo:
                lastJumpPosition = targetEvent.Position;
                if (currentController != null)
                {
                    currentController.DoAction(LocomotionController.LocomotionAction.Torpedo);
                }
                break;

            case LocomotionAction.Jump:
                lastJumpPosition = targetEvent.Position;
                if (currentController != null)
                {
                    currentController.DoAction(LocomotionController.LocomotionAction.Jump);
                }
                break;

            case LocomotionAction.Interact:
                snapToGround(targetEvent.Position);
                if (currentController != null)
                {
                    currentController.DoAction(LocomotionController.LocomotionAction.Interact);
                }
                break;

            case LocomotionAction.ChargeThrow:
                remoteSnowballLauncher.ChargeSnowball();
                break;

            case LocomotionAction.LaunchThrow:
                remoteSnowballLauncher.LaunchSnowball(targetEvent.Velocity.Value);
                break;

            case LocomotionAction.CancelThrow:
                remoteSnowballLauncher.CancelChargeSnowball();
                break;

            case LocomotionAction.Action1:
            case LocomotionAction.Action2:
            case LocomotionAction.Action3:
                locomotionStateSetter.ActionButton(targetEvent.Type);
                break;
            }
            if (this.OnTriggerActionEvent != null)
            {
                this.OnTriggerActionEvent(targetEvent);
            }
        }