コード例 #1
0
ファイル: VictimBase.cs プロジェクト: AnyKey/tojam4
        protected override Victim Clone()
        {
            VictimBase copyObject = new VictimBase(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;

            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;
        }