Ejemplo 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");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Damages the player's character by specified amount
        /// </summary>
        /// <param name="amount"></param>
        public void Hurt(float amount)
        {
            var character = netUser.playerClient.controllable.idMain;

            if (character == null || !character.alive)
            {
                return;
            }

            TakeDamage.Hurt(character, character, amount);
        }
Ejemplo n.º 3
0
 public virtual void UseItem(IBloodDrawItem draw)
 {
     if (Time.time >= (draw.lastUseTime + 2f))
     {
         Inventory inventory = draw.inventory;
         if (inventory.GetLocal <HumanBodyTakeDamage>().health > this.bloodToTake)
         {
             IDMain idMain = inventory.idMain;
             TakeDamage.Hurt(idMain, idMain, this.bloodToTake, null);
             inventory.AddItem(ref LateLoaded.blood, Inventory.Slot.Preference.Define(Inventory.Slot.Kind.Default, true, Inventory.Slot.KindFlags.Belt), 1);
             draw.lastUseTime = Time.time;
         }
     }
 }
Ejemplo n.º 4
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));
            }
        }
    }