protected override Victim Clone() { VictimHouse copyObject = new VictimHouse(this.megatile, this.GroundAnimation.Copy(), this.StumpAnimation.Copy(), this.ExplodeAnimation.Copy(), this.TornadoAnimation.Copy(), soundHit, pos); copyObject.GroundHealth = this.GroundHealth; copyObject.TornadoHealth = this.TornadoHealth; copyObject.Mass = this.Mass; copyObject.state = this.state; copyObject.tornado = this.tornado; copyObject.RemoveFromMegatTileOnDeath = this.removeFromMegaTileOnDeath; return copyObject; }
public static Victim CreateVictimOfClass(VictimConfig vicConfig, Vector2 position, MegaTile megaTile, Level level) { Victim returnVictim = null; switch (vicConfig.VictimClass) { case VictimClass.BASE: returnVictim = new VictimBase(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position); break; case VictimClass.CAR: returnVictim = new VictimCar(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position); break; case VictimClass.HOUSE: returnVictim = new VictimHouse(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position); break; case VictimClass.SKYSCRAPER: returnVictim = new VictimSkyscraper(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position); break; case VictimClass.BOSS: returnVictim = new VictimBoss(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position); break; case VictimClass.MAN: returnVictim = new VictimMan(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, position); break; case VictimClass.PLANE: if (level == null) { throw new Exception("Level cannot be null for construction of a plane"); } returnVictim = new VictimPlane(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, level); break; case VictimClass.UFO: if (level == null) { throw new Exception("Level cannot be null for construction of a UFO"); } returnVictim = new VictimUFO(megaTile, vicConfig.GroundAnim.Copy(), vicConfig.StumpAnim.Copy(), vicConfig.ExplodeAnim.Copy(), vicConfig.TornadoAnim.Copy(), vicConfig.VictimSound, level); break; default: throw new ApplicationException("Attempted to create a victim of a class that doesn't exist!"); break; } //Set other properties for victims returnVictim.Mass= vicConfig.Mass; returnVictim.GroundHealth = vicConfig.GroundHealth; returnVictim.TornadoHealth = vicConfig.TorontoHealth; returnVictim.speed = vicConfig.VictimSpeed; Victim.CurrentVicitimID = Victim.CurrentVicitimID + 1; returnVictim.VictimID = Victim.CurrentVicitimID; return returnVictim; }