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); }
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; } }
public void removeEnemy(Enemy enemy) { enemies.Remove(enemy); }
public void addEnemy(Enemy enemy) { enemies.Add(enemy); }
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(); }
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; }
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; } } }
public EnemyModel(Enemy enemy) : base() { this.enemy = enemy; }