//30sec ttl /// <summary> /// Super constructor for enemies. You must call it in subclasses /// </summary> /// <param name="_location">Screen location</param> /// <param name="_pattern">Move pattern to use</param> /// <param name="_scrollValue">Scroll value trigger</param> /// <param name="flags">Flags to set on death</param> /// <param name="flip">Type of flip</param> /// <param name="scale">Sprite scaling (use Vector2.One if not necessary)</param> /// <param name="speed">Speed of the enemy</param> /// <param name="spriteSrc">Spritesheet rectangle selection</param> /// <param name="_bonusDroppedOnDeath">Bonus the enemy will drop on death</param> /// <param name="weapon">Enemy weapon</param> protected BadGuy(Vector2 _location, Vector2 _scrollValue, Bonus _bonusDroppedOnDeath, MovePattern _pattern, String[] flags, SpriteEffects flip, Rectangle spriteSrc, Vector2 speed, Vector2 scale, Weapon weapon) : base(_location, spriteSrc, speed, scale, 0.0f, 30000f) { this.dropOnDeath = _bonusDroppedOnDeath; this.movePattern = _pattern; this.scrollValue = _scrollValue; this.Flags = flags; if (_pattern != null) { bounce = false; } else { bounce = true; } this.onScreen = false; this.rotation = 0.0f; this.Flip = flip; this.Weapon = weapon; if (this.Weapon != null) { this.Weapon.Flip = flip; } this.Hitbox = new SquareHitbox(this); this.Removable = true; this.InfiniteMovePattern = false; this.Difficulty = 0; this.ttl = 120000; this.FiringLocation = Vectors.ConvertPointToVector2(DstRect.Center); }
/// <summary> /// Return instance of the given enemy type /// </summary> /// <param name="type"></param> /// <returns></returns> public static BadGuy String2BadGuy(String type, Vector2 location, Bonus bonus, MovePattern pattern, SpriteEffects flip, String[] flags) { if (type.Equals(typeof(Poulpi).Name.ToString())) { return new Poulpi(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PoulpiMexico).Name.ToString())) { return new PoulpiMexico(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PoulpiZombie).Name.ToString())) { return new PoulpiZombie(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PoulpiMarin).Name.ToString())) { return new PoulpiMarin(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PoulpiSnow).Name.ToString())) { return new PoulpiSnow(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PoulpiFrozen).Name.ToString())) { return new PoulpiFrozen(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PoulpiKnight).Name.ToString())) { return new PoulpiKnight(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PoulpElite).Name.ToString())) { return new PoulpElite(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Pepito).Name.ToString())) { return new Pepito(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Bird).Name.ToString())) { return new Bird(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Caca).Name.ToString())) { return new Caca(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Moustik).Name.ToString())) { return new Moustik(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Pirate).Name.ToString())) { return new Pirate(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(AirFighter).Name.ToString())) { return new AirFighter(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Rock).Name.ToString())) { return new Rock(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(RockDoor).Name.ToString())) { return new RockDoor(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(BouleEpine).Name.ToString())) { return new BouleEpine(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(CactusMan).Name.ToString())) { return new CactusMan(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Canon).Name.ToString())) { return new Canon(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(RockDoor).Name.ToString())) { return new RockDoor(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(BouleEpine).Name.ToString())) { return new BouleEpine(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(CactusMan).Name.ToString())) { return new CactusMan(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Pumpkin).Name.ToString())) { return new Pumpkin(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(McBernickZombie).Name.ToString())) { return new McBernickZombie(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(McBernick).Name.ToString())) { return new McBernick(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Avalanche).Name.ToString())) { return new Avalanche(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Trainee).Name.ToString())) { return new Trainee(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Witch).Name.ToString())) { return new Witch(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Flipper).Name.ToString())) { return new Flipper(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(FlipperZombie).Name.ToString())) { return new FlipperZombie(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(EtoileMer).Name.ToString())) { return new EtoileMer(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(CowLauncher).Name.ToString())) { return new CowLauncher(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(LittleUndergroundCreature).Name.ToString())) { return new LittleUndergroundCreature(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Cow).Name.ToString())) { return new Cow(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(RandomCow).Name.ToString())) { return new RandomCow(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(FireSkull).Name.ToString())) { return new FireSkull(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Pingouin).Name.ToString())) { return new Pingouin(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(PingouinLauncher).Name.ToString())) { return new PingouinLauncher(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(Yeti).Name.ToString())) { return new Yeti(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(SapinLauncher).Name.ToString())) { return new SapinLauncher(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(RockLauncher).Name.ToString())) { return new RockLauncher(location, Vector2.Zero, bonus, pattern, flip, flags); } else if (type.Equals(typeof(BN).Name.ToString())) { return new BN(Vector2.Zero, flags); } else if (type.Equals(typeof(ElFeroCactae).Name.ToString())) { return new ElFeroCactae(Vector2.Zero, flags); } else if (type.Equals(typeof(Ariel).Name.ToString())) { return new Ariel(Vector2.Zero, flags); } else if (type.Equals(typeof(KingPoulpi).Name.ToString())) { return new KingPoulpi(Vector2.Zero, flags); } else if (type.Equals(typeof(MaskedEsquimo).Name.ToString())) { return new MaskedEsquimo(Vector2.Zero, flags); } else if (type.Equals(typeof(Esquimo).Name.ToString())) { return new Esquimo(Vector2.Zero, flags); } else if (type.Equals(typeof(Derrick).Name.ToString())) { return new Derrick(Vector2.Zero, flags); } else if (type.Equals(typeof(CrazyDoc).Name.ToString())) { return new CrazyDoc(Vector2.Zero, flags); } else { throw new Exception("Invalid TGPA map : Enemy " + type + " not found"); } }
/// <summary> /// Return instance of the given enemy type /// </summary> /// <param name="type"></param> /// <returns></returns> public static BadGuy Type2BadGuy(Type type, Vector2 location, Bonus bonus, MovePattern pattern, SpriteEffects flip, String[] flags) { return String2BadGuy(type.ToString(), location, bonus, pattern, flip, flags); }
/// <summary> /// Add a bonus to the list /// </summary> /// <param name="b"></param> public void AddBonus(Bonus b) { Bonuses.Add(b); }
public void ChangeWeaponIcon(PlayerIndex player, Type weaponType) { Bonus b = new Bonus(weaponType.Name.ToString()); switch (player) { case PlayerIndex.One: WeaponP1 = b.SrcRect; break; case PlayerIndex.Two: WeaponP2 = b.SrcRect; break; } }
/// <summary> /// Destroy bonus /// </summary> /// <param name="i">Bonus index in context.Bonuses array</param> /// <param name="get">Player get the bonus or it vanishes</param> protected void KillBonus(Bonus b, bool get, PlayerIndex playerIndex) { if (!(playerIndex == PlayerIndex.Four)) { Player player = context.GetPlayer(playerIndex); if (get) { int score = 200; //1000 pts per bonus if (b.Type == BonusTypes.Weapon) { if (b.WeaponToDrop.GetType() == player.Weapon.GetType()) { player.Weapon.UpgradeWeapon(); if (player.Weapon.UpgradeLevel == player.Weapon.MaxLevel) { //Get more points with full level score = 2000; } } else if (b.WeaponToDrop.GetType() == typeof(Megabomb)) { player.Bomb.UpgradeWeapon(); } else { int oldUpLevel = player.Weapon.UpgradeLevel; player.Weapon = b.WeaponToDrop; for (int i = 0; i < oldUpLevel; i++) { player.Weapon.UpgradeWeapon(); } //Level up bonus if player take a SMG bonus if (b.WeaponToDrop.GetType() == typeof(MachineGun)) { player.Weapon.UpgradeWeapon(); } context.Hud.ChangeWeaponIcon(player.Index, player.Weapon.GetType()); } } else { if (b.Type == BonusTypes.Life) { player.Lives++; } } score = (int)((float)score * context.ScoreMulti); //Display score if (context.Options.ShowScore) { FlyingScores fScore = new FlyingScores(b.Location, "+" + score.ToString()); this.flyScores.Add(fScore); } player.Score += score; } } context.Bonuses.Remove(b); }
protected void KillBonus(Bonus b, bool get) { KillBonus(b, get, PlayerIndex.Four); }