/// <summary>
 /// Event handler for the equipped BattleEntity's <see cref="BattleEntity.HealthStateChangedEvent"/>.
 /// </summary>
 /// <param name="newHealthState">The new HealthState of the BattleEntity.</param>
 private void OnEntityHealthStateChange(Enumerations.HealthStates newHealthState)
 {
     if (CanActivate == true)
     {
         TryAddEffects();
     }
     else
     {
         TryRemoveEffects();
     }
 }
        private void OnBalloonHealthStateChanged(Enumerations.HealthStates newHealthState)
        {
            //If the Balloon dies, unsubscribe from the event and ground the Sky Guy
            if (newHealthState == Enumerations.HealthStates.Dead)
            {
                Balloon.HealthStateChangedEvent -= OnBalloonHealthStateChanged;
                ChangedBattleManagerEvent       -= OnBattleChanged;

                //If the Sky Guy is already dead, don't handle grounding it
                if (IsDead == false)
                {
                    WingedBehavior.HandleGrounded();
                }

                //Set to null since we don't need the Balloon anymore
                Balloon = null;
            }
        }
Exemple #3
0
        /// <summary>
        /// Gets a Partner's Danger status value based on its current HealthState.
        /// </summary>
        /// <param name="partner">Mario's Partner.</param>
        /// <returns>A float of the Partner's Danger status value.</returns>
        private static float GetPartnerDangerStatusValue(BattlePartner partner)
        {
            if (partner == null)
            {
                return(NormalMod);
            }

            Enumerations.HealthStates partnerHealthState = partner.HealthState;

            switch (partnerHealthState)
            {
            case Enumerations.HealthStates.Normal:
                return(NormalMod);

            case Enumerations.HealthStates.Danger:
                return(PartnerDangerMod);

            case Enumerations.HealthStates.Peril:
            case Enumerations.HealthStates.Dead:
            default:
                return(PartnerPerilMod);
            }
        }
Exemple #4
0
        /// <summary>
        /// Gets Mario's Danger status value based on his current HealthState.
        /// </summary>
        /// <param name="partner">Mario.</param>
        /// <returns>A float of Mario's Danger status value.</returns>
        private static float GetMarioDangerStatusValue(BattleMario mario)
        {
            if (mario == null)
            {
                Debug.LogError($"{nameof(mario)} is null, which should never happen");
                return(NormalMod);
            }

            Enumerations.HealthStates marioHealthState = mario.HealthState;

            switch (marioHealthState)
            {
            case Enumerations.HealthStates.Normal:
                return(NormalMod);

            case Enumerations.HealthStates.Danger:
                return(MarioDangerMod);

            case Enumerations.HealthStates.Peril:
            case Enumerations.HealthStates.Dead:
            default:
                return(MarioPerilMod);
            }
        }