Inheritance: VictimSkyscraper
Exemplo n.º 1
0
        protected override Victim Clone()
        {
            VictimBoss copyObject = new VictimBoss(this.megatile, this.GroundAnimation, this.StumpAnimation, this.ExplodeAnimation, this.TornadoAnimation, 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;
        }
Exemplo n.º 2
0
        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;
        }