Inheritance: VictimSkyscraper
コード例 #1
0
ファイル: VictimBoss.cs プロジェクト: AnyKey/tojam4
        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;
        }
コード例 #2
0
ファイル: VictimFactory.cs プロジェクト: AnyKey/tojam4
        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;
        }