Esempio n. 1
0
 public void DoBleed()
 {
     if (base.alive && (this._bleedingLevel > 0f))
     {
         LifeStatus status;
         float      damageQuantity = this._bleedingLevel;
         Metabolism component      = base.GetComponent <Metabolism>();
         if (component != null)
         {
             damageQuantity = this._bleedingLevel * (!component.IsWarm() ? 1f : 0.4f);
         }
         if ((this.bleedAttacker != null) && (this.bleedingID != null))
         {
             status = TakeDamage.Hurt(this.bleedAttacker, this.bleedingID, damageQuantity, null);
         }
         else
         {
             status = TakeDamage.HurtSelf(base.idMain, damageQuantity, null);
         }
         if (status == LifeStatus.IsAlive)
         {
             float num2 = 0.2f;
             this.SetBleedingLevel(Mathf.Clamp(this._bleedingLevel - num2, 0f, this._bleedingLevel));
         }
         else
         {
             base.CancelInvoke("DoBleed");
         }
     }
     else
     {
         base.CancelInvoke("DoBleed");
     }
 }
Esempio n. 2
0
    public void DoBleed()
    {
        LifeStatus lifeStatu;

        if (!base.alive || this._bleedingLevel <= 0f)
        {
            base.CancelInvoke("DoBleed");
        }
        else
        {
            float      single    = this._bleedingLevel;
            Metabolism component = base.GetComponent <Metabolism>();
            if (component)
            {
                single = this._bleedingLevel * (!component.IsWarm() ? 1f : 0.4f);
            }
            lifeStatu = (!this.bleedAttacker || !this.bleedingID ? TakeDamage.HurtSelf(this.idMain, single, null) : TakeDamage.Hurt(this.bleedAttacker, this.bleedingID, single, null));
            if (lifeStatu != LifeStatus.IsAlive)
            {
                base.CancelInvoke("DoBleed");
            }
            else
            {
                float single1 = 0.2f;
                this.SetBleedingLevel(Mathf.Clamp(this._bleedingLevel - single1, 0f, this._bleedingLevel));
            }
        }
    }
Esempio n. 3
0
 public void Damage(float dmg)
 {
     if (this.IsOnline)
     {
         TakeDamage.HurtSelf(this.PlayerClient.controllable.character, dmg);
     }
 }
Esempio n. 4
0
    public virtual void UseItem(IConsumableItem item)
    {
        Inventory  inventory = item.inventory;
        Metabolism local     = inventory.GetLocal <Metabolism>();

        if (local == null)
        {
            return;
        }
        if (!local.CanConsumeYet())
        {
            return;
        }
        local.MarkConsumptionTime();
        float single = Mathf.Min(local.GetRemainingCaloricSpace(), this.calories);

        if (this.calories > 0f)
        {
            local.AddCalories(single);
        }
        if (this.litresOfWater > 0f)
        {
            local.AddWater(this.litresOfWater);
        }
        if (this.antiRads > 0f)
        {
            local.AddAntiRad(this.antiRads);
        }
        if (this.healthToHeal != 0f)
        {
            HumanBodyTakeDamage humanBodyTakeDamage = inventory.GetLocal <HumanBodyTakeDamage>();
            if (humanBodyTakeDamage != null)
            {
                if (this.healthToHeal <= 0f)
                {
                    TakeDamage.HurtSelf(inventory.idMain, Mathf.Abs(this.healthToHeal), null);
                }
                else
                {
                    humanBodyTakeDamage.HealOverTime(this.healthToHeal);
                }
            }
        }
        if (this.poisonAmount > 0f)
        {
            local.AddPoison(this.poisonAmount);
        }
        int num = 1;

        if (item.Consume(ref num))
        {
            inventory.RemoveItem(item.slot);
        }
    }
Esempio n. 5
0
 public static void Hurt(NetUser netuser, float amount)
 {
     TakeDamage.HurtSelf(netuser.playerClient.controllable.character, amount);
 }