Beispiel #1
0
        private void HandleTakeDamage(GameEvent_TakeDamage ev)
        {
            var slottedContainer = this.Parent.GetComponentOfType <Component_SlottedContainer>();

            if (slottedContainer == null)
            {
                return;
            }

            int remainingSlottedStructure = GetRemainingSlottedStructure(slottedContainer);

            if (remainingSlottedStructure == 0)
            {
                return;
            }
            else if (ev.DamageRemaining >= remainingSlottedStructure)
            {
                ev.Notify_DamageTaken(remainingSlottedStructure);
                for (int i = 0; i < remainingSlottedStructure; i++)
                {
                    this.AssignDamagePoint(slottedContainer);
                }
            }
            else
            {
                int damageToTake = ev.DamageRemaining;
                for (int i = 0; i < damageToTake; i++)
                {
                    this.AssignDamagePoint(slottedContainer);
                }
                ev.Notify_DamageTaken(damageToTake);
            }
        }
 private void HandleTakeDamage(GameEvent_TakeDamage ev)
 {
     if (ev.DamageRemaining >= this.StructureRemaining)
     {
         ev.Notify_DamageTaken(this.StructureRemaining);
         this.structureDestroyed += this.StructureRemaining;
     }
     else
     {
         int damageToTake = ev.DamageRemaining;
         this.structureDestroyed += damageToTake;
         ev.Notify_DamageTaken(damageToTake);
     }
 }