Exemplo n.º 1
0
    void CauseBurn()
    {
        int lastBaby = babies.Count - 1;

        if (lastBaby < 0)
        {
            GetComponentInChildren <SpriteRenderer>().color = Color.black;
            SendMessage("Kill", KilledBy.Fire);
        }
        else
        {
            float fire       = fireStrength * Time.deltaTime;
            int   lastToBurn = Mathf.Max(0, lastBaby - 10);
            for (int i = lastBaby; i >= lastToBurn; i--)
            {
                BabyController sacrifice = babies[i];
                sacrifice.Health -= fire;

                if (sacrifice.Health < 0.05f)
                {
                    babies.Remove(sacrifice);
                    sacrifice.Kill();
                }
                fire *= fireStrengthDecay;
            }
        }
    }
Exemplo n.º 2
0
 void PruneBunt()
 {
     if (Random.value < Time.deltaTime * pruneSpeed)
     {
         int lastBaby = babies.Count - 1;
         if (lastBaby >= 0)
         {
             BabyController baby = babies[lastBaby];
             if (baby.Health < .95f)
             {
                 if (baby != null)
                 {
                     baby.Kill();
                 }
                 babies.Remove(baby);
             }
         }
     }
 }