void IOnDamageBehavior.OnDamageThresholdPassed(object damageable, DamageThresholdPassedEventArgs e)
        {
            DamageableComponent damage = (DamageableComponent)damageable;

            if (e.DamageThreshold.ThresholdType != ThresholdType.HUDUpdate)
            {
                ChangeDamageState(DamageTemplate.CalculateDamageState(damage));
            }

            //specifies if we have a client to update the hud for
            if (CanReceiveStatusEffect(Owner))
            {
                DamageTemplate.ChangeHudState(damage);
            }
        }
Beispiel #2
0
        void IOnDamageBehavior.OnDamageThresholdPassed(object damageable, DamageThresholdPassedEventArgs e)
        {
            DamageableComponent damage = (DamageableComponent)damageable;

            if (e.DamageThreshold.ThresholdType != ThresholdType.HUDUpdate)
            {
                ChangeDamageState(DamageTemplate.CalculateDamageState(damage));
            }

            if (Owner.TryGetComponent(out BasicActorComponent actor)) //specifies if we have a client to update the hud for
            {
                var hudstatechange = DamageTemplate.ChangeHudState(damage);
                SendNetworkMessage(hudstatechange);
            }
        }
        public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null,
                                           IComponent component = null)
        {
            switch (message)
            {
            case PlayerAttachedMsg _:
                if (CanReceiveStatusEffect(Owner))
                {
                    DamageableComponent damage = Owner.GetComponent <DamageableComponent>();
                    DamageTemplate.ChangeHudState(damage);
                }
                break;

            case PlayerDetachedMsg _:
                break;
            }
        }
 /// <summary>
 /// Changes the hud state when a threshold is reached
 /// </summary>
 /// <param name="state"></param>
 /// <param name="damage"></param>
 /// <returns></returns>
 public abstract HudStateChange ChangeHudState(DamageableComponent damage);