public WeaponController(Game game, Entity.Entity parent, Shootable machineGun, Shootable missiles) : base(game, parent) { retical = new Retical(game); lockOn = new LockOn(game); //lockOnBackground = new LockOnBackGound(game); this.machineGun = machineGun; this.missiles = missiles; resetAmmo(); }
public Enemy(Game game, Vector3 position, Entity entityToChase) : base(game) { addComponent(new Spatial(game, this, position)); getComponent<Spatial>().focus = Vector3.Forward + position; addComponent(new Drawable3D(game, this, Game.Content.Load<Model>(@"models\Plane3"))); addComponent(new Collidable(game, this, CollisionType.enemy, onHit, 50, 250,getComponent<Drawable3D>().modelBoundingBox)); addComponent(new Spatial2D(game, this, Vector2.Zero, new Vector2(1.0f, 1.0f))); addComponent(new Drawable2D(game, this, Game.Content.Load<Texture2D>(@"Textures\TrackingTriangle"),Color.Lime)); weapon = new Missiles(game, this); path = new PathingWander(Game, this, entityToChase, speed); addComponent(weapon); logic = joust; int type = ((Game1)Game).rnd.Next(0, 2); //int type = 0; switch (type) { case 0: logic = joust; break; case 1: logic = stayInFrontAndEvade; break; case 2: logic = wanderInFront; break; case 3: logic = kamiKaze; break; case 4: logic = chaseDown; break; default: break; } addComponent(path); targetToChase = entityToChase; enemyManager.add(this); }
public Player(Game game, Vector3 position, float worldDiameter) : base(game) { addComponent(new Drawable3D(game, this, Game.Content.Load<Model>(@"models\fighterPlane1"))); addComponent(new Spatial(game, this, position)); getComponent<Spatial>().focus = position + Vector3.Forward; addComponent(new Controllable(game, this)); addComponent(new Collidable(game, this, CollisionType.player, onHit, MAX_HEALTH, 100000)); Missile = new Missiles(game, this); addComponent(Missile); Gun = new MachineGun(game, this); addComponent(Gun); Flare = new Flare(game,this); addComponent(Flare); addComponent(new Powerable(game, this)); addComponent(new WeaponController(game, this, Gun, Missile)); addParticleEffects(game); this.worldRadius = worldDiameter; }
private void switchWeapons() { float distance = (targetToChase.getComponent<Spatial>().position - getComponent<Spatial>().position).LengthSquared(); if (distance < 400000) { if (distance < 160000 && weapon.GetType() != typeof(MachineGun)) { removeComponent(weapon); weapon = new MachineGun(Game, this, 0.25f); addComponent(weapon); } else if (distance > 160000 && weapon.GetType() != typeof(Missiles)) { removeComponent(weapon); weapon = new Missiles(Game, this); addComponent(weapon); } } }