public override void Update()
 {
     if (Capacity <= 0)
     {
         Engine.DestroyMapObject(this);
     }
 }
Exemple #2
0
        public override void Update()
        {
            LifeTime--;
            bool  found;
            Point pos = Engine.GetMapObjectPosition(this, out found);

            if (found)
            {
                Point p = Engine.GetClosestAggressiveAnimalInRange(pos, 10);
                if (p != null)
                {
                    Target = p;
                }
                else
                {
                    Target = new Point(pos.x + 1, pos.y + 1);
                }
                Move(pos);
                Move(pos);
                Hit(pos);
                if (LifeTime <= 0)
                {
                    Engine.DestroyMapObject(this, pos);
                }
            }
        }
Exemple #3
0
 public override void Update()
 {
     if (!Dead)
     {
         Move();
     }
     else
     {
         Decay();
         if (Capacity <= 0)
         {
             Engine.DestroyMapObject(this);
         }
     }
 }
Exemple #4
0
        private void Hit(Point pos)
        {
            bool hit = false;

            foreach (MapObject mo in Engine.Map.GetCellAt(pos).MapObjects)
            {
                if (mo.GetType().IsSubclassOf(typeof(AggressiveAnimal)))
                {
                    AggressiveAnimal a = (AggressiveAnimal)mo;
                    a.TakeDamage(Damage);
                    hit = true;
                }
            }
            if (hit)
            {
                Engine.DestroyMapObject(this, pos);
            }
        }