Esempio n. 1
0
 public EnemyHitEventArgs(PhysicsObjContainer enemy, int damage, bool wasPlayer, float knockbackForce)
 {
     Enemy          = enemy;
     Damage         = damage;
     WasPlayer      = wasPlayer;
     KnockbackForce = knockbackForce;
 }
Esempio n. 2
0
 public override void Dispose()
 {
     if (!IsDisposed)
     {
         m_blacksmith.Dispose();
         m_blacksmith = null;
         m_blacksmithIcon.Dispose();
         m_blacksmithIcon = null;
         m_blacksmithNewIcon.Dispose();
         m_blacksmithNewIcon = null;
         m_blacksmithBoard.Dispose();
         m_blacksmithBoard = null;
         m_enchantress.Dispose();
         m_enchantress = null;
         m_enchantressIcon.Dispose();
         m_enchantressIcon = null;
         m_enchantressNewIcon.Dispose();
         m_enchantressNewIcon = null;
         m_tent.Dispose();
         m_tent = null;
         m_architect.Dispose();
         m_architect = null;
         m_architectIcon.Dispose();
         m_architectIcon = null;
         m_screw.Dispose();
         m_screw = null;
         if (m_blacksmithAnvilSound != null)
         {
             m_blacksmithAnvilSound.Dispose();
         }
         m_blacksmithAnvilSound = null;
         m_tree1 = null;
         m_tree2 = null;
         m_tree3 = null;
         m_fern1 = null;
         m_fern2 = null;
         m_fern3 = null;
         foreach (var current in m_rainFG)
         {
             current.Dispose();
         }
         m_rainFG.Clear();
         m_rainFG    = null;
         m_mountain1 = null;
         m_mountain2 = null;
         m_tollCollector.Dispose();
         m_tollCollector = null;
         m_tollCollectorIcon.Dispose();
         m_tollCollectorIcon = null;
         m_blacksmithBlock   = null;
         m_enchantressBlock  = null;
         m_architectBlock    = null;
         if (m_rainSFX != null)
         {
             m_rainSFX.Dispose();
         }
         m_rainSFX = null;
         base.Dispose();
     }
 }
Esempio n. 3
0
 public bool OnCollision(PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount)
 {
     if (Definition != null)
     {
         return(Definition.OnCollision(this, target, targetIsPlayer, knockbackAmount));
     }
     return(true);
 }
Esempio n. 4
0
        public static PipeEventState<PhysicsObjContainer, RandomItemDrop> PipeRandomDrop(PhysicsObjContainer source)
        {
            var args = new PipeEventState<PhysicsObjContainer, RandomItemDrop>(source, GetRandomDrop());

            if (args.Target != null && ItemDropped != null)
                ItemDropped(args);

            return args;
        }
Esempio n. 5
0
        public override bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount)
        {
            if (knockbackAmount != Vector2.Zero)
            {
                float inertia = 3f;

                target.CurrentSpeed = 0f;
                target.AccelerationX = knockbackAmount.X * (target.X >= proj.Source.X ? inertia : -inertia);
                target.AccelerationY = -knockbackAmount.Y * inertia;
            }

            return false;
        }
Esempio n. 6
0
        public override bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount)
        {
            if (knockbackAmount != Vector2.Zero)
            {
                float inertia = 3f;

                target.CurrentSpeed  = 0f;
                target.AccelerationX = knockbackAmount.X * (target.X >= proj.Source.X ? inertia : -inertia);
                target.AccelerationY = -knockbackAmount.Y * inertia;
            }

            return(false);
        }
Esempio n. 7
0
 public Player(PhysicsObjContainer gameObject)
     : base(gameObject)
 {
 }
Esempio n. 8
0
 protected virtual void ResetState(PhysicsObjContainer player, Vector2 scale)
 {
     player.DisableAllWeight = false;
     player.Scale = scale;
 }
Esempio n. 9
0
 public Chicken(PhysicsObjContainer gameObject)
     : base(Id, gameObject)
 {
 }
Esempio n. 10
0
 protected EnemyBase(byte id, PhysicsObjContainer gameObject)
     : base(gameObject)
 {
     EnemyId = id;
 }
Esempio n. 11
0
 protected EnemyBase(byte id, PhysicsObjContainer gameObject)
     : base(gameObject)
 {
     EnemyId = id;
 }
Esempio n. 12
0
 public virtual bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount)
 {
     return(true);
 }
Esempio n. 13
0
 public static void ParseRooms(string filePath, ContentManager contentManager = null, bool isDLCMap = false)
 {
     CultureInfo cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();
     cultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
     XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
     xmlReaderSettings.IgnoreComments = true;
     xmlReaderSettings.IgnoreWhitespace = true;
     XmlReader xmlReader;
     if (contentManager == null)
     {
         xmlReader = XmlReader.Create(filePath, xmlReaderSettings);
     }
     else
     {
         xmlReader = XmlReader.Create(contentManager.RootDirectory + "\\Levels\\" + filePath + ".xml", xmlReaderSettings);
     }
     RoomObj roomObj = null;
     RoomObj roomObj2 = null;
     RoomObj roomObj3 = null;
     RoomObj roomObj4 = null;
     RoomObj roomObj5 = null;
     while (xmlReader.Read())
     {
         if (xmlReader.NodeType == XmlNodeType.Element)
         {
             if (xmlReader.Name == "RoomObject")
             {
                 roomObj = new RoomObj();
                 LevelParser.ParseGenericXML(xmlReader, roomObj);
                 if (isDLCMap)
                 {
                     roomObj.IsDLCMap = true;
                 }
                 roomObj2 = (roomObj.Clone() as RoomObj);
                 roomObj3 = (roomObj.Clone() as RoomObj);
                 roomObj4 = (roomObj.Clone() as RoomObj);
                 roomObj5 = (roomObj.Clone() as RoomObj);
             }
             if (xmlReader.Name == "GameObject")
             {
                 xmlReader.MoveToAttribute("Type");
                 string value = xmlReader.Value;
                 GameObj gameObj = null;
                 string key;
                 switch (key = value)
                 {
                 case "CollHullObj":
                     gameObj = new TerrainObj(0, 0);
                     break;
                 case "DoorObj":
                     gameObj = new DoorObj(roomObj, 0, 0, GameTypes.DoorType.OPEN);
                     break;
                 case "ChestObj":
                     if (xmlReader.MoveToAttribute("Fairy"))
                     {
                         if (bool.Parse(xmlReader.Value))
                         {
                             gameObj = new FairyChestObj(null);
                             (gameObj as ChestObj).ChestType = 4;
                         }
                         else
                         {
                             gameObj = new ChestObj(null);
                         }
                     }
                     else
                     {
                         gameObj = new ChestObj(null);
                     }
                     break;
                 case "HazardObj":
                     gameObj = new HazardObj(0, 0);
                     break;
                 case "BorderObj":
                     gameObj = new BorderObj();
                     break;
                 case "EnemyObj":
                     xmlReader.MoveToAttribute("Procedural");
                     if (!bool.Parse(xmlReader.Value))
                     {
                         xmlReader.MoveToAttribute("EnemyType");
                         byte enemyType = byte.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                         xmlReader.MoveToAttribute("Difficulty");
                         GameTypes.EnemyDifficulty difficulty = (GameTypes.EnemyDifficulty)Enum.Parse(typeof(GameTypes.EnemyDifficulty), xmlReader.Value, true);
                         gameObj = EnemyBuilder.BuildEnemy((int)enemyType, null, null, null, difficulty, false);
                         if (xmlReader.MoveToAttribute("Flip") && bool.Parse(xmlReader.Value))
                         {
                             gameObj.Flip = SpriteEffects.FlipHorizontally;
                         }
                         if (xmlReader.MoveToAttribute("InitialDelay"))
                         {
                             (gameObj as EnemyObj).InitialLogicDelay = float.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                         }
                     }
                     else
                     {
                         xmlReader.MoveToAttribute("EnemyType");
                         string value2 = xmlReader.Value;
                         gameObj = new EnemyTagObj();
                         (gameObj as EnemyTagObj).EnemyType = value2;
                     }
                     break;
                 case "EnemyOrbObj":
                 {
                     xmlReader.MoveToAttribute("OrbType");
                     int orbType = int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                     bool flag = false;
                     if (xmlReader.MoveToAttribute("IsWaypoint"))
                     {
                         flag = bool.Parse(xmlReader.Value);
                     }
                     if (flag)
                     {
                         gameObj = new WaypointObj();
                         (gameObj as WaypointObj).OrbType = orbType;
                     }
                     else
                     {
                         gameObj = new EnemyOrbObj();
                         (gameObj as EnemyOrbObj).OrbType = orbType;
                         if (xmlReader.MoveToAttribute("ForceFlying"))
                         {
                             (gameObj as EnemyOrbObj).ForceFlying = bool.Parse(xmlReader.Value);
                         }
                     }
                     break;
                 }
                 case "SpriteObj":
                     xmlReader.MoveToAttribute("SpriteName");
                     if (xmlReader.Value == "LightSource_Sprite")
                     {
                         gameObj = new LightSourceObj();
                     }
                     else
                     {
                         gameObj = new SpriteObj(xmlReader.Value);
                     }
                     break;
                 case "PhysicsObj":
                 {
                     xmlReader.MoveToAttribute("SpriteName");
                     gameObj = new PhysicsObj(xmlReader.Value, null);
                     PhysicsObj physicsObj = gameObj as PhysicsObj;
                     physicsObj.CollisionTypeTag = 5;
                     physicsObj.CollidesBottom = false;
                     physicsObj.CollidesLeft = false;
                     physicsObj.CollidesRight = false;
                     break;
                 }
                 case "PhysicsObjContainer":
                 {
                     bool flag2 = false;
                     if (xmlReader.MoveToAttribute("Breakable"))
                     {
                         flag2 = bool.Parse(xmlReader.Value);
                     }
                     xmlReader.MoveToAttribute("SpriteName");
                     if (flag2)
                     {
                         gameObj = new BreakableObj(xmlReader.Value);
                     }
                     else
                     {
                         gameObj = new PhysicsObjContainer(xmlReader.Value, null);
                     }
                     break;
                 }
                 case "ObjContainer":
                     xmlReader.MoveToAttribute("SpriteName");
                     gameObj = new ObjContainer(xmlReader.Value);
                     break;
                 case "PlayerStartObj":
                     gameObj = new PlayerStartObj();
                     break;
                 }
                 LevelParser.ParseGenericXML(xmlReader, gameObj);
                 GameTypes.LevelType levelType = GameTypes.LevelType.NONE;
                 if (xmlReader.MoveToAttribute("LevelType"))
                 {
                     levelType = (GameTypes.LevelType)int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                 }
                 if (levelType == GameTypes.LevelType.CASTLE)
                 {
                     LevelParser.StoreObj(gameObj, roomObj2);
                     LevelParser.StoreSwappedObj(gameObj, GameTypes.LevelType.DUNGEON, roomObj3);
                     LevelParser.StoreSwappedObj(gameObj, GameTypes.LevelType.TOWER, roomObj5);
                     LevelParser.StoreSwappedObj(gameObj, GameTypes.LevelType.GARDEN, roomObj4);
                     SpriteObj spriteObj = gameObj as SpriteObj;
                     if (spriteObj != null && spriteObj.SpriteName == "CastleAssetFrame_Sprite")
                     {
                         spriteObj.ChangeSprite("FramePicture" + CDGMath.RandomInt(1, 16) + "_Sprite");
                     }
                 }
                 else if (levelType == GameTypes.LevelType.DUNGEON)
                 {
                     LevelParser.StoreObj(gameObj, roomObj3);
                 }
                 else if (levelType == GameTypes.LevelType.TOWER)
                 {
                     LevelParser.StoreObj(gameObj, roomObj5);
                 }
                 else if (levelType == GameTypes.LevelType.GARDEN)
                 {
                     LevelParser.StoreObj(gameObj, roomObj4);
                 }
                 else
                 {
                     LevelParser.StoreObj(gameObj, roomObj2);
                     LevelParser.StoreObj(gameObj, roomObj3);
                     LevelParser.StoreObj(gameObj, roomObj5);
                     LevelParser.StoreObj(gameObj, roomObj4);
                     LevelParser.StoreObj(gameObj, roomObj);
                 }
                 if (LevelEV.RUN_TESTROOM && (levelType == LevelEV.TESTROOM_LEVELTYPE || levelType == GameTypes.LevelType.CASTLE))
                 {
                     if (levelType == LevelEV.TESTROOM_LEVELTYPE)
                     {
                         LevelParser.StoreObj(gameObj, roomObj);
                     }
                     else if (levelType == GameTypes.LevelType.CASTLE)
                     {
                         LevelParser.StoreSwappedObj(gameObj, LevelEV.TESTROOM_LEVELTYPE, roomObj);
                     }
                 }
                 if (gameObj is PlayerStartObj)
                 {
                     RoomObj expr_65E = roomObj;
                     expr_65E.Name += "DEBUG_ROOM";
                 }
             }
         }
         else if (xmlReader.NodeType == XmlNodeType.EndElement && xmlReader.Name == "RoomObject")
         {
             if (roomObj.X < 10000f && roomObj.Name != "Boss" && roomObj.Name != "ChallengeBoss")
             {
                 if (!roomObj.Name.Contains("DEBUG_ROOM"))
                 {
                     if (roomObj.AddToCastlePool)
                     {
                         LevelBuilder2.StoreRoom(roomObj2, GameTypes.LevelType.CASTLE);
                         LevelBuilder2.StoreSpecialRoom(roomObj2, GameTypes.LevelType.CASTLE, false);
                     }
                     if (roomObj.AddToDungeonPool)
                     {
                         LevelBuilder2.StoreRoom(roomObj3, GameTypes.LevelType.DUNGEON);
                         LevelBuilder2.StoreSpecialRoom(roomObj3, GameTypes.LevelType.DUNGEON, false);
                     }
                     if (roomObj.AddToGardenPool)
                     {
                         LevelBuilder2.StoreRoom(roomObj4, GameTypes.LevelType.GARDEN);
                         LevelBuilder2.StoreSpecialRoom(roomObj4, GameTypes.LevelType.GARDEN, false);
                     }
                     if (roomObj.AddToTowerPool)
                     {
                         LevelBuilder2.StoreRoom(roomObj5, GameTypes.LevelType.TOWER);
                         LevelBuilder2.StoreSpecialRoom(roomObj5, GameTypes.LevelType.TOWER, false);
                     }
                 }
                 if (roomObj.Name.Contains("DEBUG_ROOM"))
                 {
                     roomObj.Name = roomObj.Name.Replace("DEBUG_ROOM", "");
                     if (LevelEV.TESTROOM_LEVELTYPE != GameTypes.LevelType.CASTLE)
                     {
                         LevelBuilder2.StoreSpecialRoom(roomObj, GameTypes.LevelType.CASTLE, true);
                     }
                     LevelBuilder2.StoreSpecialRoom(roomObj, LevelEV.TESTROOM_LEVELTYPE, true);
                 }
             }
             if (roomObj.X < 10000f && (roomObj.Name == "Boss" || roomObj.Name == "ChallengeBoss"))
             {
                 LevelBuilder2.StoreSpecialRoom(roomObj, GameTypes.LevelType.CASTLE, false);
             }
         }
     }
 }
Esempio n. 14
0
 protected static void AttachEnemyToCurrentRoom(PhysicsObjContainer enemy)
 {
     Game.ScreenManager.Player.AttachedLevel.AddEnemyToCurrentRoom((EnemyObj)enemy);
 }
Esempio n. 15
0
        public static void ParseRooms(string filePath, ContentManager contentManager = null, bool isDLCMap = false)
        {
            var cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();

            cultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
            var xmlReaderSettings = new XmlReaderSettings();

            xmlReaderSettings.IgnoreComments   = true;
            xmlReaderSettings.IgnoreWhitespace = true;
            XmlReader xmlReader;

            if (contentManager == null)
            {
                xmlReader = XmlReader.Create(filePath, xmlReaderSettings);
            }
            else
            {
                xmlReader = XmlReader.Create(contentManager.RootDirectory + "\\Levels\\" + filePath + ".xml",
                                             xmlReaderSettings);
            }
            RoomObj roomObj  = null;
            RoomObj roomObj2 = null;
            RoomObj roomObj3 = null;
            RoomObj roomObj4 = null;
            RoomObj roomObj5 = null;

            while (xmlReader.Read())
            {
                if (xmlReader.NodeType == XmlNodeType.Element)
                {
                    if (xmlReader.Name == "RoomObject")
                    {
                        roomObj = new RoomObj();
                        ParseGenericXML(xmlReader, roomObj);
                        if (isDLCMap)
                        {
                            roomObj.IsDLCMap = true;
                        }
                        roomObj2 = (roomObj.Clone() as RoomObj);
                        roomObj3 = (roomObj.Clone() as RoomObj);
                        roomObj4 = (roomObj.Clone() as RoomObj);
                        roomObj5 = (roomObj.Clone() as RoomObj);
                    }
                    if (xmlReader.Name == "GameObject")
                    {
                        xmlReader.MoveToAttribute("Type");
                        var     value   = xmlReader.Value;
                        GameObj gameObj = null;
                        string  key;
                        switch (key = value)
                        {
                        case "CollHullObj":
                            gameObj = new TerrainObj(0, 0);
                            break;

                        case "DoorObj":
                            gameObj = new DoorObj(roomObj, 0, 0, GameTypes.DoorType.OPEN);
                            break;

                        case "ChestObj":
                            if (xmlReader.MoveToAttribute("Fairy"))
                            {
                                if (bool.Parse(xmlReader.Value))
                                {
                                    gameObj = new FairyChestObj(null);
                                    (gameObj as ChestObj).ChestType = 4;
                                }
                                else
                                {
                                    gameObj = new ChestObj(null);
                                }
                            }
                            else
                            {
                                gameObj = new ChestObj(null);
                            }
                            break;

                        case "HazardObj":
                            gameObj = new HazardObj(0, 0);
                            break;

                        case "BorderObj":
                            gameObj = new BorderObj();
                            break;

                        case "EnemyObj":
                            xmlReader.MoveToAttribute("Procedural");
                            if (!bool.Parse(xmlReader.Value))
                            {
                                xmlReader.MoveToAttribute("EnemyType");
                                var enemyType = byte.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                                xmlReader.MoveToAttribute("Difficulty");
                                var difficulty =
                                    (GameTypes.EnemyDifficulty)
                                    Enum.Parse(typeof(GameTypes.EnemyDifficulty), xmlReader.Value, true);
                                gameObj = EnemyBuilder.BuildEnemy(enemyType, null, null, null, difficulty);
                                if (xmlReader.MoveToAttribute("Flip") && bool.Parse(xmlReader.Value))
                                {
                                    gameObj.Flip = SpriteEffects.FlipHorizontally;
                                }
                                if (xmlReader.MoveToAttribute("InitialDelay"))
                                {
                                    (gameObj as EnemyObj).InitialLogicDelay = float.Parse(xmlReader.Value,
                                                                                          NumberStyles.Any, cultureInfo);
                                }
                            }
                            else
                            {
                                xmlReader.MoveToAttribute("EnemyType");
                                var value2 = xmlReader.Value;
                                gameObj = new EnemyTagObj();
                                (gameObj as EnemyTagObj).EnemyType = value2;
                            }
                            break;

                        case "EnemyOrbObj":
                        {
                            xmlReader.MoveToAttribute("OrbType");
                            var orbType = int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                            var flag    = false;
                            if (xmlReader.MoveToAttribute("IsWaypoint"))
                            {
                                flag = bool.Parse(xmlReader.Value);
                            }
                            if (flag)
                            {
                                gameObj = new WaypointObj();
                                (gameObj as WaypointObj).OrbType = orbType;
                            }
                            else
                            {
                                gameObj = new EnemyOrbObj();
                                (gameObj as EnemyOrbObj).OrbType = orbType;
                                if (xmlReader.MoveToAttribute("ForceFlying"))
                                {
                                    (gameObj as EnemyOrbObj).ForceFlying = bool.Parse(xmlReader.Value);
                                }
                            }
                            break;
                        }

                        case "SpriteObj":
                            xmlReader.MoveToAttribute("SpriteName");
                            if (xmlReader.Value == "LightSource_Sprite")
                            {
                                gameObj = new LightSourceObj();
                            }
                            else
                            {
                                gameObj = new SpriteObj(xmlReader.Value);
                            }
                            break;

                        case "PhysicsObj":
                        {
                            xmlReader.MoveToAttribute("SpriteName");
                            gameObj = new PhysicsObj(xmlReader.Value);
                            var physicsObj = gameObj as PhysicsObj;
                            physicsObj.CollisionTypeTag = 5;
                            physicsObj.CollidesBottom   = false;
                            physicsObj.CollidesLeft     = false;
                            physicsObj.CollidesRight    = false;
                            break;
                        }

                        case "PhysicsObjContainer":
                        {
                            var flag2 = false;
                            if (xmlReader.MoveToAttribute("Breakable"))
                            {
                                flag2 = bool.Parse(xmlReader.Value);
                            }
                            xmlReader.MoveToAttribute("SpriteName");
                            if (flag2)
                            {
                                gameObj = new BreakableObj(xmlReader.Value);
                            }
                            else
                            {
                                gameObj = new PhysicsObjContainer(xmlReader.Value);
                            }
                            break;
                        }

                        case "ObjContainer":
                            xmlReader.MoveToAttribute("SpriteName");
                            gameObj = new ObjContainer(xmlReader.Value);
                            break;

                        case "PlayerStartObj":
                            gameObj = new PlayerStartObj();
                            break;
                        }
                        ParseGenericXML(xmlReader, gameObj);
                        var levelType = GameTypes.LevelType.NONE;
                        if (xmlReader.MoveToAttribute("LevelType"))
                        {
                            levelType = (GameTypes.LevelType) int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                        }
                        if (levelType == GameTypes.LevelType.CASTLE)
                        {
                            StoreObj(gameObj, roomObj2);
                            StoreSwappedObj(gameObj, GameTypes.LevelType.DUNGEON, roomObj3);
                            StoreSwappedObj(gameObj, GameTypes.LevelType.TOWER, roomObj5);
                            StoreSwappedObj(gameObj, GameTypes.LevelType.GARDEN, roomObj4);
                            var spriteObj = gameObj as SpriteObj;
                            if (spriteObj != null && spriteObj.SpriteName == "CastleAssetFrame_Sprite")
                            {
                                spriteObj.ChangeSprite("FramePicture" + CDGMath.RandomInt(1, 16) + "_Sprite");
                            }
                        }
                        else if (levelType == GameTypes.LevelType.DUNGEON)
                        {
                            StoreObj(gameObj, roomObj3);
                        }
                        else if (levelType == GameTypes.LevelType.TOWER)
                        {
                            StoreObj(gameObj, roomObj5);
                        }
                        else if (levelType == GameTypes.LevelType.GARDEN)
                        {
                            StoreObj(gameObj, roomObj4);
                        }
                        else
                        {
                            StoreObj(gameObj, roomObj2);
                            StoreObj(gameObj, roomObj3);
                            StoreObj(gameObj, roomObj5);
                            StoreObj(gameObj, roomObj4);
                            StoreObj(gameObj, roomObj);
                        }
                        if (LevelEV.RUN_TESTROOM &&
                            (levelType == LevelEV.TESTROOM_LEVELTYPE || levelType == GameTypes.LevelType.CASTLE))
                        {
                            if (levelType == LevelEV.TESTROOM_LEVELTYPE)
                            {
                                StoreObj(gameObj, roomObj);
                            }
                            else if (levelType == GameTypes.LevelType.CASTLE)
                            {
                                StoreSwappedObj(gameObj, LevelEV.TESTROOM_LEVELTYPE, roomObj);
                            }
                        }
                        if (gameObj is PlayerStartObj)
                        {
                            var expr_65E = roomObj;
                            expr_65E.Name += "DEBUG_ROOM";
                        }
                    }
                }
                else if (xmlReader.NodeType == XmlNodeType.EndElement && xmlReader.Name == "RoomObject")
                {
                    if (roomObj.X < 10000f && roomObj.Name != "Boss" && roomObj.Name != "ChallengeBoss")
                    {
                        if (!roomObj.Name.Contains("DEBUG_ROOM"))
                        {
                            if (roomObj.AddToCastlePool)
                            {
                                LevelBuilder2.StoreRoom(roomObj2, GameTypes.LevelType.CASTLE);
                                LevelBuilder2.StoreSpecialRoom(roomObj2, GameTypes.LevelType.CASTLE);
                            }
                            if (roomObj.AddToDungeonPool)
                            {
                                LevelBuilder2.StoreRoom(roomObj3, GameTypes.LevelType.DUNGEON);
                                LevelBuilder2.StoreSpecialRoom(roomObj3, GameTypes.LevelType.DUNGEON);
                            }
                            if (roomObj.AddToGardenPool)
                            {
                                LevelBuilder2.StoreRoom(roomObj4, GameTypes.LevelType.GARDEN);
                                LevelBuilder2.StoreSpecialRoom(roomObj4, GameTypes.LevelType.GARDEN);
                            }
                            if (roomObj.AddToTowerPool)
                            {
                                LevelBuilder2.StoreRoom(roomObj5, GameTypes.LevelType.TOWER);
                                LevelBuilder2.StoreSpecialRoom(roomObj5, GameTypes.LevelType.TOWER);
                            }
                        }
                        if (roomObj.Name.Contains("DEBUG_ROOM"))
                        {
                            roomObj.Name = roomObj.Name.Replace("DEBUG_ROOM", "");
                            if (LevelEV.TESTROOM_LEVELTYPE != GameTypes.LevelType.CASTLE)
                            {
                                LevelBuilder2.StoreSpecialRoom(roomObj, GameTypes.LevelType.CASTLE, true);
                            }
                            LevelBuilder2.StoreSpecialRoom(roomObj, LevelEV.TESTROOM_LEVELTYPE, true);
                        }
                    }
                    if (roomObj.X < 10000f && (roomObj.Name == "Boss" || roomObj.Name == "ChallengeBoss"))
                    {
                        LevelBuilder2.StoreSpecialRoom(roomObj, GameTypes.LevelType.CASTLE);
                    }
                }
            }
        }
Esempio n. 16
0
 public bool OnCollision(PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount)
 {
     if (Definition != null)
         return Definition.OnCollision(this, target, targetIsPlayer, knockbackAmount);
     return true;
 }
Esempio n. 17
0
        public StartingRoomObj()
        {
            m_blacksmith                   = new BlacksmithObj();
            m_blacksmith.Flip              = SpriteEffects.FlipHorizontally;
            m_blacksmith.Scale             = new Vector2(2.5f, 2.5f);
            m_blacksmith.Position          = new Vector2(700f, 660f - (m_blacksmith.Bounds.Bottom - m_blacksmith.Y) - 1f);
            m_blacksmith.OutlineWidth      = 2;
            m_blacksmithBoard              = new SpriteObj("StartRoomBlacksmithBoard_Sprite");
            m_blacksmithBoard.Scale        = new Vector2(2f, 2f);
            m_blacksmithBoard.OutlineWidth = 2;
            m_blacksmithBoard.Position     = new Vector2(m_blacksmith.X - m_blacksmithBoard.Width / 2 - 35f,
                                                         m_blacksmith.Bounds.Bottom - m_blacksmithBoard.Height - 1);
            m_blacksmithIcon                 = new SpriteObj("UpArrowBubble_Sprite");
            m_blacksmithIcon.Scale           = new Vector2(2f, 2f);
            m_blacksmithIcon.Visible         = false;
            m_blacksmithIconPosition         = new Vector2(m_blacksmith.X - 60f, m_blacksmith.Y - 10f);
            m_blacksmithIcon.Flip            = m_blacksmith.Flip;
            m_blacksmithIcon.OutlineWidth    = 2;
            m_blacksmithNewIcon              = new SpriteObj("ExclamationSquare_Sprite");
            m_blacksmithNewIcon.Visible      = false;
            m_blacksmithNewIcon.OutlineWidth = 2;
            m_enchantressNewIcon             = (m_blacksmithNewIcon.Clone() as SpriteObj);
            m_enchantress          = new ObjContainer("Enchantress_Character");
            m_enchantress.Scale    = new Vector2(2f, 2f);
            m_enchantress.Flip     = SpriteEffects.FlipHorizontally;
            m_enchantress.Position = new Vector2(1150f,
                                                 660f - (m_enchantress.Bounds.Bottom - m_enchantress.AnchorY) - 2f);
            m_enchantress.PlayAnimation();
            m_enchantress.AnimationDelay = 0.1f;
            (m_enchantress.GetChildAt(4) as IAnimateableObj).StopAnimation();
            m_enchantress.OutlineWidth = 2;
            m_tent              = new SpriteObj("StartRoomGypsyTent_Sprite");
            m_tent.Scale        = new Vector2(1.5f, 1.5f);
            m_tent.OutlineWidth = 2;
            m_tent.Position     = new Vector2(m_enchantress.X - m_tent.Width / 2 + 5f,
                                              m_enchantress.Bounds.Bottom - m_tent.Height);
            m_enchantressIcon              = new SpriteObj("UpArrowBubble_Sprite");
            m_enchantressIcon.Scale        = new Vector2(2f, 2f);
            m_enchantressIcon.Visible      = false;
            m_enchantressIconPosition      = new Vector2(m_enchantress.X - 60f, m_enchantress.Y - 100f);
            m_enchantressIcon.Flip         = m_enchantress.Flip;
            m_enchantressIcon.OutlineWidth = 2;
            m_architect          = new ObjContainer("ArchitectIdle_Character");
            m_architect.Flip     = SpriteEffects.FlipHorizontally;
            m_architect.Scale    = new Vector2(2f, 2f);
            m_architect.Position = new Vector2(1550f, 660f - (m_architect.Bounds.Bottom - m_architect.AnchorY) - 2f);
            m_architect.PlayAnimation();
            m_architect.AnimationDelay = 0.1f;
            m_architect.OutlineWidth   = 2;
            (m_architect.GetChildAt(1) as IAnimateableObj).StopAnimation();
            m_architectIcon              = new SpriteObj("UpArrowBubble_Sprite");
            m_architectIcon.Scale        = new Vector2(2f, 2f);
            m_architectIcon.Visible      = false;
            m_architectIconPosition      = new Vector2(m_architect.X - 60f, m_architect.Y - 100f);
            m_architectIcon.Flip         = m_architect.Flip;
            m_architectIcon.OutlineWidth = 2;
            m_architectRenovating        = false;
            m_screw                      = new SpriteObj("ArchitectGear_Sprite");
            m_screw.Scale                = new Vector2(2f, 2f);
            m_screw.OutlineWidth         = 2;
            m_screw.Position             = new Vector2(m_architect.X + 30f, m_architect.Bounds.Bottom - 1);
            m_screw.AnimationDelay       = 0.1f;
            m_tollCollector              = new PhysicsObjContainer("NPCTollCollectorIdle_Character");
            m_tollCollector.Flip         = SpriteEffects.FlipHorizontally;
            m_tollCollector.Scale        = new Vector2(2.5f, 2.5f);
            m_tollCollector.IsWeighted   = false;
            m_tollCollector.IsCollidable = true;
            m_tollCollector.Position     = new Vector2(2565f,
                                                       420f - (m_tollCollector.Bounds.Bottom - m_tollCollector.AnchorY));
            m_tollCollector.PlayAnimation();
            m_tollCollector.AnimationDelay   = 0.1f;
            m_tollCollector.OutlineWidth     = 2;
            m_tollCollector.CollisionTypeTag = 1;
            m_tollCollectorIcon              = new SpriteObj("UpArrowBubble_Sprite");
            m_tollCollectorIcon.Scale        = new Vector2(2f, 2f);
            m_tollCollectorIcon.Visible      = false;
            m_tollCollectorIcon.Flip         = m_tollCollector.Flip;
            m_tollCollectorIcon.OutlineWidth = 2;
            m_rainFG = new List <RaindropObj>();
            var num = 400;

            if (LevelEV.SAVE_FRAMES)
            {
                num /= 2;
            }
            for (var i = 0; i < num; i++)
            {
                var item =
                    new RaindropObj(new Vector2(CDGMath.RandomInt(-100, 2540), CDGMath.RandomInt(-400, 720)));
                m_rainFG.Add(item);
            }
        }
Esempio n. 18
0
 public virtual bool OnCollision(ProjectileObj proj, PhysicsObjContainer target, bool targetIsPlayer, Vector2 knockbackAmount)
 {
     return true;
 }
Esempio n. 19
0
 public Entity(PhysicsObjContainer gameObject)
 {
     _gameObject = gameObject;
 }
Esempio n. 20
0
        public static PipeEventState <PhysicsObjContainer, RandomItemDrop> PipeRandomDrop(PhysicsObjContainer source)
        {
            var args = new PipeEventState <PhysicsObjContainer, RandomItemDrop>(source, GetRandomDrop());

            if (args.Target != null && ItemDropped != null)
            {
                ItemDropped(args);
            }

            return(args);
        }
Esempio n. 21
0
 public Entity(PhysicsObjContainer gameObject)
 {
     _gameObject = gameObject;
 }
Esempio n. 22
0
 protected virtual void ResetState(PhysicsObjContainer player, Vector2 scale)
 {
     player.DisableAllWeight = false;
     player.Scale            = scale;
 }