/// <summary>
        /// Tries to activate the button activated zone
        /// </summary>
        protected virtual void ButtonActivation()
        {
            // if the player is in a button activated zone, we handle it
            if ((InButtonActivatedZone) &&
                (ButtonActivatedZone != null) &&
                (_condition.CurrentState == CharacterStates.CharacterConditions.Normal || _condition.CurrentState == CharacterStates.CharacterConditions.Frozen) &&
                (_movement.CurrentState != CharacterStates.MovementStates.Dashing))
            {
                // if the button can only be activated while grounded and if we're not grounded, we do nothing and exit
                if (ButtonActivatedZone.CanOnlyActivateIfGrounded && !_controller.Grounded)
                {
                    return;
                }

                // if it's an auto activated zone, we do nothing
                if (ButtonActivatedZone.AutoActivation)
                {
                    return;
                }

                // we trigger a character event
                MMCharacterEvent.Trigger(_character, MMCharacterEventTypes.ButtonActivation);

                ButtonActivatedZone.TriggerButtonAction();
                PlayAbilityStartFeedbacks();
                _activating = true;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// When a character event happens, and if it's a Jump event, we add progress to our JumpAround achievement
 /// </summary>
 /// <param name="characterEvent"></param>
 public virtual void OnMMEvent(MMCharacterEvent characterEvent)
 {
     if (characterEvent.TargetCharacter.CharacterType == Character.CharacterTypes.Player)
     {
         switch (characterEvent.EventType)
         {
         case MMCharacterEventTypes.Jump:
             MMAchievementManager.AddProgress("JumpAround", 1);
             break;
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Starts a jump
        /// </summary>
        public virtual void JumpStart()
        {
            if (!EvaluateJumpConditions())
            {
                return;
            }
            _movement.ChangeState(CharacterStates.MovementStates.Jumping);
            MMCharacterEvent.Trigger(_character, MMCharacterEventTypes.Jump);
            JumpStartFeedback?.PlayFeedbacks(this.transform.position);
            PlayAbilityStartFeedbacks();

            _jumpStopped    = false;
            _jumpStartedAt  = Time.time;
            _buttonReleased = false;
        }
        /// <summary>
        /// Starts a jump
        /// </summary>
        protected virtual void HoverStart()
        {
            if (!EvaluateJumpConditions())
            {
                return;
            }
            _movement.ChangeState(CharacterStates.MovementStates.Hovering);
            MMCharacterEvent.Trigger(_character, MMCharacterEventTypes.Hover);
            gameObject.layer = 23;
            HoverStartFeedback?.PlayFeedbacks(this.transform.position);
            PlayAbilityStartFeedbacks();

            _hoverStopped   = false;
            _hoverStartedAt = Time.time;
            _buttonReleased = false;
        }
Esempio n. 5
0
        /// <summary>
        /// On jump start, we change our state to jumping
        /// </summary>
        public virtual void JumpStart()
        {
            if (!EvaluateJumpConditions())
            {
                return;
            }

            // we decrease the number of jumps left
            NumberOfJumpsLeft = NumberOfJumpsLeft - 1;

            _movement.ChangeState(CharacterStates.MovementStates.Jumping);
            MMCharacterEvent.Trigger(_character, MMCharacterEventTypes.Jump);
            JumpStartFeedback?.PlayFeedbacks(this.transform.position);
            _jumpOrigin               = this.transform.position;
            _jumpStopped              = false;
            _jumpStartedAt            = Time.time;
            _controller.Grounded      = false;
            _controller.GravityActive = false;
            _buttonReleased           = false;

            PlayAbilityStartSfx();
            PlayAbilityUsedSfx();
            PlayAbilityStartFeedbacks();
        }