예제 #1
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);
                }
            }
        }
예제 #2
0
        public override void Update()
        {
            bool  found;
            Point pos = Engine.GetMapObjectPosition(this, out found);

            if (found)
            {
                if (AlertMode)
                {
                    Point p = Engine.GetClosestAggressiveAnimalInRange(pos, 5);
                    if (p != null)
                    {
                        MoveTarget      = p;
                        WasChasingEnemy = true;
                    }
                    else
                    {
                        if (WasChasingEnemy)
                        {
                            MoveTarget      = null;
                            WasChasingEnemy = false;
                        }
                    }
                }
                Attack(pos);
                Move(pos);
            }
        }
예제 #3
0
        public override void Update()
        {
            bool  found;
            Point pos = Engine.GetMapObjectPosition(this, out found);

            if (found)
            {
                if (ShootCooldown <= ActualShootCooldown)
                {
                    ActualShootCooldown = 0;
                    Target = Engine.GetClosestAggressiveAnimalInRange(pos, SightRange - 1);

                    if (Target != null)
                    {
                        Engine.Map.GetCellAt(pos.x, pos.y).MapObjects.Add(new Bullet(pos, Target, Damage, 10));
                    }
                }
                else
                {
                    ActualShootCooldown++;
                }
                if (slowNum > 0)
                {
                    Move(pos);
                    slowNum = 0;
                }
                else
                {
                    slowNum++;
                }
            }
        }