Exemplo n.º 1
0
        protected void Attacking(Overseer os, Architech arch, GameTime gt, Random rng)
        {
            hitElasped += gt.ElapsedGameTime.Milliseconds;

            if (CheckTarget(arch))
            {
                if (hitElasped >= Stats.HitDelay)
                {
                    os.Combat(this, arch.GetBuilding(defenderID), rng);
                    hitElasped = 0;
                    Projectile p = new Projectile(this.Center, new Point(16, 16), data.Projectile, 5, arch.GetBuilding(defenderID).Center);
                    projectile.Add(p.ID, p);
                }
            }
        }
Exemplo n.º 2
0
        //attack target once in range, go back to pursue if not in range
        void Attacking(Overseer os, Architech arch, GameTime gt, Random rng, Grid grid)
        {
            hitElasped += gt.ElapsedGameTime.Milliseconds;

            if (hitElasped >= Stats.HitDelay)
            {
                hitElasped = 0;
                os.Combat(this, (Grounded)os.Ais[target], rng);

                if (base.data.Type == Ai_Type.Z_Archer || base.data.Type == Ai_Type.Z_Priest)
                {
                    var p = new Projectile(Position, new Point(16, 16), data.Projectile, 5, ((Grounded)os.Ais[target]).Center);
                    projectile.Add(p.ID, p);
                }
            }
        }
Exemplo n.º 3
0
        void Fighting(Overseer os, GameTime gt, Random rng)
        {
            if (os.Zombies.ContainsKey(attackerID))
            {
                if (os.Zombies[attackerID].Ai_States != Ai_States.Dead)
                {
                    if (!os.ZIsInRange(Corners, attackerID, (float)Stats.Range))
                    {
                        Ai_States = Ai_States.Idle;
                    }

                    else
                    {
                        Ai_States = Ai_States.Retaliating;

                        hitElasped += gt.ElapsedGameTime.Milliseconds;

                        if (hitElasped >= Stats.HitDelay)
                        {
                            hitElasped = 0;
                            os.Combat <Grounded>(this, (Grounded)os.Zombies[attackerID], rng);

                            if (base.data.Type == Ai_Type.Archer || base.data.Type == Ai_Type.Priest)
                            {
                                var p = new Projectile(Position, new Point(16, 16), data.Projectile, 5, os.Zombies[attackerID].Center);
                                projectile.Add(p.ID, p);
                            }
                        }
                    }
                }
                else
                {
                    Ai_States = Ai_States.Target; noRetaliate = true;
                }
            }
            else
            {
                Ai_States = Ai_States.Target; noRetaliate = true;
            }
        }