Beispiel #1
0
        public ElectroShot(Turret turret, Vector3 pos, Enemy enemy, Game1 game)
            : base()
        {
            this.turret = turret;
            this.game = game;
            this.pos = pos;
            target = enemy;
            targetDist = 0;
            time = 0;
            triggered = false;

            direction = Vector3.Up;

            model = new ElectroShotModel(this, game);

            game.modelManager.addEffect(model);
        }
Beispiel #2
0
        public PyroDamage(Enemy enemy, Game1 game, int enemyType)
        {
            this.enemy = enemy;
            this.game = game;
            maxTime = 3f;
            damage = 5;

            switch(enemyType)
            {
                default:
                    dist = 1;
                    break;
                case 3:
                    dist = 5;
                    break;
            }
        }
 public ElectroDamage(Enemy enemy, Game1 game, int type)
 {
     this.enemy = enemy;
     this.game = game;
     switch(type)
     {
         default:
             maxTime = 0.91f;
             break;
         case 1:
             maxTime = 1.54f;
             break;
         case 2:
             maxTime = 0.91f;
             break;
         case 3:
             maxTime = 0.91f;
             break;
     }
 }
Beispiel #4
0
 public void removeEnemy(Enemy enemy)
 {
     enemies.Remove(enemy);
 }
Beispiel #5
0
 public void addEnemy(Enemy enemy)
 {
     enemies.Add(enemy);
 }
Beispiel #6
0
        public override void Update()
        {
            if (active)
            {
                col.Update(ship.pos + ship.direction);
                if (ship.boosting)
                {
                    game.hud.hudWeapon.Wake();
                    finishingRange.Update(ship.pos + ship.direction * 15, ship.direction);
                    //checkFinishing();

                    if(target != null)
                    {
                        updateDir();
                    }
                }
                else
                {
                    if (ship.finishingMove)
                    {
                        target = null;
                        game.hud.flashTime = 0;
                        ship.finishingMove = false;
                    }
                }
                if (ship.moving && ship.colliding)
                    checkCollision();
                else
                {
                    game.audioManager.shipDrill.Stop();
                    if (dome.active)
                        dome.disable();
                }
            }
            else
            {
                game.audioManager.shipDrill.Stop();
                if (dome.active)
                    dome.disable();
            }
            col.Update(ship.pos + ship.direction);
            base.Update();
        }
Beispiel #7
0
        void setTarget(List<Enemy> targets)
        {
            int closestIndex = 0;
            float shortestDist = 1000;

            foreach(Enemy e in targets)
            {
                float dist = col.distFrom(e.pos);
                if(dist < shortestDist)
                {
                    shortestDist = dist;
                    closestIndex = targets.IndexOf(e);
                }
            }

            target = targets.ElementAt(closestIndex);
            //target.frozen = true;

            ship.direction = -1*ship.circleCol.directionFrom(target.pos);
            ship.rot.Y = (float)Math.Atan2(ship.direction.X, ship.direction.Z)+MathHelper.Pi;
        }
Beispiel #8
0
        void checkFinishing()
        {
            bool collided = false;
            List<Enemy> targets = new List<Enemy>();

            foreach(Enemy e in game.enemyManager.enemies)
            {
                if (e.enemyType > 0)//not a swarmer
                {
                    foreach (CircleCollider c in e.cols)
                    {
                        if (c.checkOOBB(finishingRange))
                        {
                            collided = true;
                            if (!targets.Contains(e))
                                targets.Add(e);
                        }
                    }
                }
            }
            if(collided)
            {
                if (!game.ship.finishingMove)
                {
                    game.hud.flashTime = 0;
                    ship.finishingMove = true;
                    if(target == null)
                        setTarget(targets);
                }
            }
            else
            {
                target = null;
                if (game.ship.finishingMove)
                {
                    game.hud.flashTime = 0;
                    ship.finishingMove = false;
                }
            }
        }
Beispiel #9
0
 public EnemyModel(Enemy enemy)
     : base()
 {
     this.enemy = enemy;
 }