Beispiel #1
0
 public void CreateLog()
 {
     this.m_log.Position = base.Position;
     this.m_smoke.Position = base.Position;
     this.m_smoke.Visible = true;
     this.m_log.Visible = true;
     this.m_log.Opacity = 1f;
     this.m_smoke.PlayAnimation(false);
     Tween.By(this.m_log, 0.1f, new Easing(Linear.EaseNone), new string[]
     {
         "delay",
         "0.2",
         "Y",
         "10"
     });
     Tween.To(this.m_log, 0.2f, new Easing(Linear.EaseNone), new string[]
     {
         "delay",
         "0.3",
         "Opacity",
         "0"
     });
     SoundManager.Play3DSound(this, this.m_target, "Ninja_Teleport");
     base.Visible = false;
     base.IsCollidable = false;
     base.IsWeighted = false;
     this.m_storedRoom = this.m_levelScreen.CurrentRoom;
 }
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         this.SpawnRoom = null;
         base.Dispose();
     }
 }
 public void RemoveEnemyFromRoom(EnemyObj enemy, RoomObj room)
 {
     int num = room.TempEnemyList.IndexOf(enemy);
     if (num != -1)
     {
         room.TempEnemyList.RemoveAt(num);
         this.m_physicsManager.RemoveObject(enemy);
         this.m_tempEnemyStartPositions.RemoveAt(num);
     }
 }
 public void RemoveEnemyFromRoom(EnemyObj enemy, RoomObj room, Vector2 startingPos)
 {
     room.TempEnemyList.Remove(enemy);
     this.m_physicsManager.RemoveObject(enemy);
     this.m_tempEnemyStartPositions.Remove(startingPos);
 }
Beispiel #5
0
 public void RefreshMapChestIcons(RoomObj room)
 {
     m_mapDisplay.RefreshChestIcons(room);
 }
Beispiel #6
0
 public void RefreshChestIcons(RoomObj room)
 {
     foreach (GameObj current in room.GameObjList)
     {
         ChestObj chestObj = current as ChestObj;
         if (chestObj != null && chestObj.IsOpen)
         {
             Vector2 pt = new Vector2(chestObj.X / this.m_spriteScale.X - 8f, chestObj.Y / this.m_spriteScale.Y - 12f);
             for (int i = 0; i < this.m_iconSpritePosList.Count; i++)
             {
                 if (CDGMath.DistanceBetweenPts(pt, this.m_iconSpritePosList[i]) < 15f)
                 {
                     this.m_iconSpriteList[i].ChangeSprite("MapChestUnlocked_Sprite");
                     this.m_iconSpriteList[i].Opacity = 1f;
                     break;
                 }
             }
         }
     }
 }
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         Console.WriteLine("Disposing Procedural Level Screen");
         Tween.StopAll(false);
         this.m_currentRoom = null;
         this.DisposeRTs();
         foreach (RoomObj current in this.m_roomList)
         {
             current.Dispose();
         }
         this.m_roomList.Clear();
         this.m_roomList = null;
         this.m_enemyStartPositions.Clear();
         this.m_enemyStartPositions = null;
         this.m_tempEnemyStartPositions.Clear();
         this.m_tempEnemyStartPositions = null;
         this.m_textManager.Dispose();
         this.m_textManager = null;
         this.m_physicsManager = null;
         this.m_projectileManager.Dispose();
         this.m_projectileManager = null;
         this.m_itemDropManager.Dispose();
         this.m_itemDropManager = null;
         this.m_currentRoom = null;
         this.m_miniMapDisplay.Dispose();
         this.m_miniMapDisplay = null;
         this.m_mapBG.Dispose();
         this.m_mapBG = null;
         this.m_inputMap.Dispose();
         this.m_inputMap = null;
         this.m_lastEnemyHit = null;
         this.m_playerHUD.Dispose();
         this.m_playerHUD = null;
         this.m_player = null;
         this.m_enemyHUD.Dispose();
         this.m_enemyHUD = null;
         this.m_impactEffectPool.Dispose();
         this.m_impactEffectPool = null;
         this.m_blackBorder1.Dispose();
         this.m_blackBorder1 = null;
         this.m_blackBorder2.Dispose();
         this.m_blackBorder2 = null;
         this.m_chestList.Clear();
         this.m_chestList = null;
         this.m_projectileIconPool.Dispose();
         this.m_projectileIconPool = null;
         this.m_objKilledPlayer = null;
         this.m_dungeonLight.Dispose();
         this.m_dungeonLight = null;
         this.m_traitAura.Dispose();
         this.m_traitAura = null;
         this.m_killedEnemyObjList.Clear();
         this.m_killedEnemyObjList = null;
         this.m_roomEnteringTitle.Dispose();
         this.m_roomEnteringTitle = null;
         this.m_roomTitle.Dispose();
         this.m_roomTitle = null;
         this.m_creditsText.Dispose();
         this.m_creditsText = null;
         this.m_creditsTitleText.Dispose();
         this.m_creditsTitleText = null;
         Array.Clear(this.m_creditsTextTitleList, 0, this.m_creditsTextTitleList.Length);
         Array.Clear(this.m_creditsTextList, 0, this.m_creditsTextList.Length);
         this.m_creditsTextTitleList = null;
         this.m_creditsTextList = null;
         this.m_filmGrain.Dispose();
         this.m_filmGrain = null;
         this.m_objectivePlate.Dispose();
         this.m_objectivePlate = null;
         this.m_objectivePlateTween = null;
         this.m_sky.Dispose();
         this.m_sky = null;
         this.m_whiteBG.Dispose();
         this.m_whiteBG = null;
         this.m_compassBG.Dispose();
         this.m_compassBG = null;
         this.m_compass.Dispose();
         this.m_compass = null;
         if (this.m_compassDoor != null)
         {
             this.m_compassDoor.Dispose();
         }
         this.m_compassDoor = null;
         this.m_castleBorderTexture.Dispose();
         this.m_gardenBorderTexture.Dispose();
         this.m_towerBorderTexture.Dispose();
         this.m_dungeonBorderTexture.Dispose();
         this.m_neoBorderTexture.Dispose();
         this.m_castleBorderTexture = null;
         this.m_gardenBorderTexture = null;
         this.m_towerBorderTexture = null;
         this.m_dungeonBorderTexture = null;
         this.DebugTextObj.Dispose();
         this.DebugTextObj = null;
         base.Dispose();
     }
 }
 public void AddRoom(RoomObj room)
 {
     this.m_roomList.Add(room);
     if (room.X < (float)this.m_leftMostBorder)
     {
         this.m_leftMostBorder = (int)room.X;
     }
     if (room.X + (float)room.Width > (float)this.m_rightMostBorder)
     {
         this.m_rightMostBorder = (int)room.X + room.Width;
     }
     if (room.Y < (float)this.m_topMostBorder)
     {
         this.m_topMostBorder = (int)room.Y;
     }
     if (room.Y + (float)room.Height > (float)this.m_bottomMostBorder)
     {
         this.m_bottomMostBorder = (int)room.Y + room.Height;
     }
 }
Beispiel #9
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);
             }
         }
     }
 }
Beispiel #10
0
 public static void StoreSwappedObj(GameObj obj, GameTypes.LevelType levelType, RoomObj currentRoom)
 {
     string[] array;
     switch (levelType)
     {
     case GameTypes.LevelType.GARDEN:
         array = LevelEV.GARDEN_ASSETSWAP_LIST;
         break;
     case GameTypes.LevelType.DUNGEON:
         array = LevelEV.DUNGEON_ASSETSWAP_LIST;
         break;
     case GameTypes.LevelType.TOWER:
         array = LevelEV.TOWER_ASSETSWAP_LIST;
         break;
     default:
         throw new Exception("Cannot find asset swaplist for leveltype " + levelType);
     }
     BreakableObj breakableObj = obj as BreakableObj;
     if (breakableObj != null && breakableObj.SpriteName.Contains("CastleAssetUrn"))
     {
         breakableObj.CollidesTop = false;
     }
     bool flag = false;
     IAnimateableObj animateableObj = obj.Clone() as IAnimateableObj;
     if (animateableObj != null)
     {
         int i = 0;
         while (i < LevelEV.CASTLE_ASSETSWAP_LIST.Length)
         {
             if (animateableObj.SpriteName == LevelEV.CASTLE_ASSETSWAP_LIST[i])
             {
                 string text = array[i];
                 if (text.Contains("RANDOM"))
                 {
                     int max = int.Parse(Convert.ToString(text[text.IndexOf("RANDOM") + 6]));
                     int num = CDGMath.RandomInt(1, max);
                     text = text.Replace("RANDOM" + max.ToString(), num.ToString());
                     if (text.Contains("TowerHole"))
                     {
                         (animateableObj as GameObj).X += (float)CDGMath.RandomInt(-50, 50);
                         (animateableObj as GameObj).Y += (float)CDGMath.RandomInt(-50, 50);
                         if (CDGMath.RandomInt(1, 100) > 70)
                         {
                             (animateableObj as GameObj).Visible = false;
                         }
                     }
                     if (text.Contains("GardenFloatingRock"))
                     {
                         animateableObj = new HoverObj(text)
                         {
                             Position = (animateableObj as GameObj).Position,
                             Amplitude = CDGMath.RandomFloat(-50f, 50f),
                             HoverSpeed = CDGMath.RandomFloat(-2f, 2f),
                             Scale = (animateableObj as GameObj).Scale,
                             Layer = (animateableObj as GameObj).Layer
                         };
                     }
                 }
                 if (text == "CastleAssetFrame_Sprite")
                 {
                     text = "FramePicture" + CDGMath.RandomInt(1, 16) + "_Sprite";
                 }
                 if (!(text != ""))
                 {
                     break;
                 }
                 animateableObj.ChangeSprite(text);
                 flag = true;
                 if (text.Contains("GardenFairy"))
                 {
                     (animateableObj as GameObj).X += (float)CDGMath.RandomInt(-25, 25);
                     (animateableObj as GameObj).Y += (float)CDGMath.RandomInt(-25, 25);
                     (animateableObj as GameObj).Opacity = 0.8f;
                     break;
                 }
                 break;
             }
             else
             {
                 i++;
             }
         }
     }
     if (flag)
     {
         LevelParser.StoreObj(animateableObj as GameObj, currentRoom);
     }
 }
Beispiel #11
0
 public static void StoreObj(GameObj obj, RoomObj currentRoom)
 {
     if (obj is EnemyObj)
     {
         currentRoom.EnemyList.Add(obj as EnemyObj);
         return;
     }
     if (obj is DoorObj)
     {
         currentRoom.DoorList.Add(obj as DoorObj);
         return;
     }
     if (obj is TerrainObj)
     {
         currentRoom.TerrainObjList.Add(obj as TerrainObj);
         return;
     }
     if (obj is BorderObj)
     {
         currentRoom.BorderList.Add(obj as BorderObj);
         return;
     }
     currentRoom.GameObjList.Add(obj);
 }
Beispiel #12
0
        public static void StoreSwappedObj(GameObj obj, GameTypes.LevelType levelType, RoomObj currentRoom)
        {
            string[] array;
            switch (levelType)
            {
            case GameTypes.LevelType.GARDEN:
                array = LevelEV.GARDEN_ASSETSWAP_LIST;
                break;

            case GameTypes.LevelType.DUNGEON:
                array = LevelEV.DUNGEON_ASSETSWAP_LIST;
                break;

            case GameTypes.LevelType.TOWER:
                array = LevelEV.TOWER_ASSETSWAP_LIST;
                break;

            default:
                throw new Exception("Cannot find asset swaplist for leveltype " + levelType);
            }
            var breakableObj = obj as BreakableObj;

            if (breakableObj != null && breakableObj.SpriteName.Contains("CastleAssetUrn"))
            {
                breakableObj.CollidesTop = false;
            }
            var flag           = false;
            var animateableObj = obj.Clone() as IAnimateableObj;

            if (animateableObj != null)
            {
                var i = 0;
                while (i < LevelEV.CASTLE_ASSETSWAP_LIST.Length)
                {
                    if (animateableObj.SpriteName == LevelEV.CASTLE_ASSETSWAP_LIST[i])
                    {
                        var text = array[i];
                        if (text.Contains("RANDOM"))
                        {
                            var max = int.Parse(Convert.ToString(text[text.IndexOf("RANDOM") + 6]));
                            var num = CDGMath.RandomInt(1, max);
                            text = text.Replace("RANDOM" + max, num.ToString());
                            if (text.Contains("TowerHole"))
                            {
                                (animateableObj as GameObj).X += CDGMath.RandomInt(-50, 50);
                                (animateableObj as GameObj).Y += CDGMath.RandomInt(-50, 50);
                                if (CDGMath.RandomInt(1, 100) > 70)
                                {
                                    (animateableObj as GameObj).Visible = false;
                                }
                            }
                            if (text.Contains("GardenFloatingRock"))
                            {
                                animateableObj = new HoverObj(text)
                                {
                                    Position   = (animateableObj as GameObj).Position,
                                    Amplitude  = CDGMath.RandomFloat(-50f, 50f),
                                    HoverSpeed = CDGMath.RandomFloat(-2f, 2f),
                                    Scale      = (animateableObj as GameObj).Scale,
                                    Layer      = (animateableObj as GameObj).Layer
                                };
                            }
                        }
                        if (text == "CastleAssetFrame_Sprite")
                        {
                            text = "FramePicture" + CDGMath.RandomInt(1, 16) + "_Sprite";
                        }
                        if (!(text != ""))
                        {
                            break;
                        }
                        animateableObj.ChangeSprite(text);
                        flag = true;
                        if (text.Contains("GardenFairy"))
                        {
                            (animateableObj as GameObj).X      += CDGMath.RandomInt(-25, 25);
                            (animateableObj as GameObj).Y      += CDGMath.RandomInt(-25, 25);
                            (animateableObj as GameObj).Opacity = 0.8f;
                        }
                        break;
                    }
                    i++;
                }
            }
            if (flag)
            {
                StoreObj(animateableObj as GameObj, currentRoom);
            }
        }
Beispiel #13
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);
                    }
                }
            }
        }
Beispiel #14
0
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         this.SpawnRoom = null;
         if (this.m_deathLoop != null && !this.m_deathLoop.IsDisposed)
         {
             this.m_deathLoop.Dispose();
         }
         this.m_deathLoop = null;
         base.Dispose();
     }
 }
Beispiel #15
0
 public void RefreshMapScreenChestIcons(RoomObj room)
 {
     this.m_mapScreen.RefreshMapChestIcons(room);
 }
 private void CheckForRoomTransition()
 {
     if (this.m_player != null)
     {
         foreach (RoomObj current in this.m_roomList)
         {
             if (current != this.CurrentRoom && current.Bounds.Contains((int)this.m_player.X, (int)this.m_player.Y))
             {
                 this.ResetEnemyPositions();
                 if (this.CurrentRoom != null)
                 {
                     foreach (EnemyObj current2 in this.EnemyList)
                     {
                         current2.ResetState();
                     }
                 }
                 if (this.m_enemiesPaused)
                 {
                     this.UnpauseAllEnemies();
                 }
                 this.m_player.RoomTransitionReset();
                 this.m_miniMapDisplay.AddRoom(current);
                 if (current.Name != "Start")
                 {
                     (base.ScreenManager.Game as Game).SaveManager.SaveFiles(new SaveType[]
                     {
                         SaveType.PlayerData,
                         SaveType.MapData
                     });
                 }
                 if (current.Name == "ChallengeBoss")
                 {
                     this.m_backgroundSprite.Scale = Vector2.One;
                     this.m_backgroundSprite.ChangeSprite("NeoBG_Sprite", base.ScreenManager.Camera);
                     this.m_backgroundSprite.Scale = new Vector2(2f, 2f);
                     this.m_foregroundSprite.Scale = Vector2.One;
                     this.m_foregroundSprite.ChangeSprite("NeoFG_Sprite", base.ScreenManager.Camera);
                     this.m_foregroundSprite.Scale = new Vector2(2f, 2f);
                 }
                 if ((this.CurrentRoom == null || this.CurrentLevelType != current.LevelType || (this.CurrentRoom != null && this.CurrentRoom.Name == "ChallengeBoss")) && current.Name != "Start")
                 {
                     if (current.Name != "ChallengeBoss")
                     {
                         switch (current.LevelType)
                         {
                         case GameTypes.LevelType.CASTLE:
                             this.m_backgroundSprite.Scale = Vector2.One;
                             this.m_foregroundSprite.Scale = Vector2.One;
                             this.m_backgroundSprite.ChangeSprite("CastleBG1_Sprite", base.ScreenManager.Camera);
                             this.m_foregroundSprite.ChangeSprite("CastleFG1_Sprite", base.ScreenManager.Camera);
                             this.m_backgroundSprite.Scale = new Vector2(2f, 2f);
                             this.m_foregroundSprite.Scale = new Vector2(2f, 2f);
                             break;
                         case GameTypes.LevelType.GARDEN:
                             this.m_backgroundSprite.Scale = Vector2.One;
                             this.m_foregroundSprite.Scale = Vector2.One;
                             this.m_backgroundSprite.ChangeSprite("GardenBG_Sprite", base.ScreenManager.Camera);
                             this.m_foregroundSprite.ChangeSprite("GardenFG_Sprite", base.ScreenManager.Camera);
                             this.m_backgroundSprite.Scale = new Vector2(2f, 2f);
                             this.m_foregroundSprite.Scale = new Vector2(2f, 2f);
                             break;
                         case GameTypes.LevelType.DUNGEON:
                             this.m_backgroundSprite.Scale = Vector2.One;
                             this.m_foregroundSprite.Scale = Vector2.One;
                             this.m_backgroundSprite.ChangeSprite("DungeonBG1_Sprite", base.ScreenManager.Camera);
                             this.m_foregroundSprite.ChangeSprite("DungeonFG1_Sprite", base.ScreenManager.Camera);
                             this.m_backgroundSprite.Scale = new Vector2(2f, 2f);
                             this.m_foregroundSprite.Scale = new Vector2(2f, 2f);
                             break;
                         case GameTypes.LevelType.TOWER:
                             this.m_backgroundSprite.Scale = Vector2.One;
                             this.m_foregroundSprite.Scale = Vector2.One;
                             this.m_backgroundSprite.ChangeSprite("TowerBG2_Sprite", base.ScreenManager.Camera);
                             this.m_foregroundSprite.ChangeSprite("TowerFG2_Sprite", base.ScreenManager.Camera);
                             this.m_backgroundSprite.Scale = new Vector2(2f, 2f);
                             this.m_foregroundSprite.Scale = new Vector2(2f, 2f);
                             break;
                         }
                     }
                     if (Game.PlayerStats.Traits.X == 32f || Game.PlayerStats.Traits.Y == 32f)
                     {
                         this.m_foregroundSprite.Scale = Vector2.One;
                         this.m_foregroundSprite.ChangeSprite("NeoFG_Sprite", base.ScreenManager.Camera);
                         this.m_foregroundSprite.Scale = new Vector2(2f, 2f);
                     }
                     if (current.LevelType == GameTypes.LevelType.DUNGEON || Game.PlayerStats.Traits.X == 35f || Game.PlayerStats.Traits.Y == 35f || current.Name == "Compass")
                     {
                         Game.ShadowEffect.Parameters["ShadowIntensity"].SetValue(0.7f);
                     }
                     else
                     {
                         Game.ShadowEffect.Parameters["ShadowIntensity"].SetValue(0);
                     }
                     this.m_roomTitle.Text = WordBuilder.BuildDungeonName(current.LevelType);
                     if (Game.PlayerStats.Traits.X == 5f || Game.PlayerStats.Traits.Y == 5f)
                     {
                         this.m_roomTitle.RandomizeSentence(false);
                     }
                     this.m_roomTitle.Opacity = 0f;
                     if (current.Name != "Boss" && current.Name != "Tutorial" && current.Name != "Ending" && current.Name != "ChallengeBoss")
                     {
                         Tween.StopAllContaining(this.m_roomEnteringTitle, false);
                         Tween.StopAllContaining(this.m_roomTitle, false);
                         this.m_roomTitle.Opacity = 0f;
                         this.m_roomEnteringTitle.Opacity = 0f;
                         if (this.m_player.X > (float)current.Bounds.Center.X)
                         {
                             this.m_roomTitle.X = 50f;
                             this.m_roomTitle.Align = Types.TextAlign.Left;
                             this.m_roomEnteringTitle.X = 70f;
                             this.m_roomEnteringTitle.Align = Types.TextAlign.Left;
                         }
                         else
                         {
                             this.m_roomTitle.X = 1270f;
                             this.m_roomTitle.Align = Types.TextAlign.Right;
                             this.m_roomEnteringTitle.X = 1250f;
                             this.m_roomEnteringTitle.Align = Types.TextAlign.Right;
                         }
                         Tween.To(this.m_roomTitle, 0.5f, new Easing(Linear.EaseNone), new string[]
                         {
                             "delay",
                             "0.2",
                             "Opacity",
                             "1"
                         });
                         this.m_roomTitle.Opacity = 1f;
                         Tween.To(this.m_roomTitle, 0.5f, new Easing(Linear.EaseNone), new string[]
                         {
                             "delay",
                             "2.2",
                             "Opacity",
                             "0"
                         });
                         this.m_roomTitle.Opacity = 0f;
                         Tween.To(this.m_roomEnteringTitle, 0.5f, new Easing(Linear.EaseNone), new string[]
                         {
                             "Opacity",
                             "1"
                         });
                         this.m_roomEnteringTitle.Opacity = 1f;
                         Tween.To(this.m_roomEnteringTitle, 0.5f, new Easing(Linear.EaseNone), new string[]
                         {
                             "delay",
                             "2",
                             "Opacity",
                             "0"
                         });
                         this.m_roomEnteringTitle.Opacity = 0f;
                     }
                     else
                     {
                         Tween.StopAllContaining(this.m_roomEnteringTitle, false);
                         Tween.StopAllContaining(this.m_roomTitle, false);
                         this.m_roomTitle.Opacity = 0f;
                         this.m_roomEnteringTitle.Opacity = 0f;
                     }
                     this.JukeboxEnabled = false;
                     Console.WriteLine("Now entering " + current.LevelType);
                 }
                 if (this.m_currentRoom != null)
                 {
                     this.m_currentRoom.OnExit();
                 }
                 this.m_currentRoom = current;
                 this.m_backgroundSprite.Position = this.CurrentRoom.Position;
                 this.m_foregroundSprite.Position = this.CurrentRoom.Position;
                 this.m_gardenParallaxFG.Position = this.CurrentRoom.Position;
                 if (SoundManager.IsMusicPaused)
                 {
                     SoundManager.ResumeMusic();
                 }
                 if (!this.DisableSongUpdating && !this.JukeboxEnabled)
                 {
                     this.UpdateLevelSong();
                 }
                 if (this.m_currentRoom.Player == null)
                 {
                     this.m_currentRoom.Player = this.m_player;
                 }
                 if (this.m_currentRoom.Name != "Start" && this.m_currentRoom.Name != "Tutorial" && this.m_currentRoom.Name != "Ending" && this.m_currentRoom.Name != "CastleEntrance" && this.m_currentRoom.Name != "Bonus" && this.m_currentRoom.Name != "Throne" && this.m_currentRoom.Name != "Secret" && this.m_currentRoom.Name != "Boss" && this.m_currentRoom.LevelType != GameTypes.LevelType.NONE && this.m_currentRoom.Name != "ChallengeBoss" && (Game.PlayerStats.Traits.X == 26f || Game.PlayerStats.Traits.Y == 26f) && CDGMath.RandomFloat(0f, 1f) < 0.2f)
                 {
                     this.SpawnDementiaEnemy();
                 }
                 if (this.m_currentRoom.HasFairyChest)
                 {
                     this.m_currentRoom.DisplayFairyChestInfo();
                 }
                 this.m_tempEnemyStartPositions.Clear();
                 this.m_enemyStartPositions.Clear();
                 foreach (EnemyObj current3 in this.CurrentRoom.EnemyList)
                 {
                     this.m_enemyStartPositions.Add(current3.Position);
                 }
                 foreach (EnemyObj current4 in this.CurrentRoom.TempEnemyList)
                 {
                     this.m_tempEnemyStartPositions.Add(current4.Position);
                 }
                 this.m_projectileManager.DestroyAllProjectiles(false);
                 this.LoadPhysicsObjects(current);
                 this.m_itemDropManager.DestroyAllItemDrops();
                 this.m_projectileIconPool.DestroyAllIcons();
                 this.m_enemyPauseDuration = 0f;
                 if (LevelEV.SHOW_ENEMY_RADII)
                 {
                     foreach (EnemyObj current5 in current.EnemyList)
                     {
                         current5.InitializeDebugRadii();
                     }
                 }
                 this.m_lastEnemyHit = null;
                 foreach (GameObj current6 in this.m_currentRoom.GameObjList)
                 {
                     FairyChestObj fairyChestObj = current6 as FairyChestObj;
                     if (fairyChestObj != null)
                     {
                         bool arg_BC6_0 = fairyChestObj.IsOpen;
                     }
                     IAnimateableObj animateableObj = current6 as IAnimateableObj;
                     if (animateableObj != null && animateableObj.TotalFrames > 1 && !(animateableObj is ChestObj) && !(current6 is BreakableObj))
                     {
                         animateableObj.AnimationDelay = 0.1f;
                         animateableObj.PlayAnimation(true);
                     }
                 }
                 if (!this.DisableRoomOnEnter)
                 {
                     this.m_currentRoom.OnEnter();
                     break;
                 }
                 break;
             }
         }
     }
 }
 private void LoadPhysicsObjects(RoomObj room)
 {
     Rectangle value = new Rectangle((int)room.X - 100, (int)room.Y - 100, room.Width + 200, room.Height + 200);
     this.m_physicsManager.RemoveAllObjects();
     foreach (TerrainObj current in this.CurrentRoom.TerrainObjList)
     {
         this.m_physicsManager.AddObject(current);
     }
     foreach (ProjectileObj current2 in this.m_projectileManager.ActiveProjectileList)
     {
         this.m_physicsManager.AddObject(current2);
     }
     foreach (GameObj current3 in this.CurrentRoom.GameObjList)
     {
         IPhysicsObj physicsObj = current3 as IPhysicsObj;
         if (physicsObj != null && current3.Bounds.Intersects(value))
         {
             BreakableObj breakableObj = current3 as BreakableObj;
             if (breakableObj == null || !breakableObj.Broken)
             {
                 this.m_physicsManager.AddObject(physicsObj);
             }
         }
     }
     foreach (DoorObj current4 in this.CurrentRoom.DoorList)
     {
         this.m_physicsManager.AddObject(current4);
     }
     foreach (EnemyObj current5 in this.CurrentRoom.EnemyList)
     {
         this.m_physicsManager.AddObject(current5);
         if (current5 is EnemyObj_BallAndChain && !current5.IsKilled)
         {
             this.m_physicsManager.AddObject((current5 as EnemyObj_BallAndChain).BallAndChain);
             if (current5.Difficulty > GameTypes.EnemyDifficulty.BASIC)
             {
                 this.m_physicsManager.AddObject((current5 as EnemyObj_BallAndChain).BallAndChain2);
             }
         }
     }
     foreach (EnemyObj current6 in this.CurrentRoom.TempEnemyList)
     {
         this.m_physicsManager.AddObject(current6);
     }
     this.m_physicsManager.AddObject(this.m_player);
 }
Beispiel #18
0
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         this.m_fireballSummon = null;
         this.m_iceballSummon = null;
         if (this.m_earthSummonInSprite != null)
         {
             this.m_earthSummonInSprite.Dispose();
             this.m_earthSummonInSprite = null;
         }
         if (this.m_earthSummonOutSprite != null)
         {
             this.m_earthSummonOutSprite.Dispose();
             this.m_earthSummonOutSprite = null;
         }
         if (this.m_earthProjectileObj != null)
         {
             this.m_earthProjectileObj.Dispose();
             this.m_earthProjectileObj = null;
         }
         this.SpawnRoom = null;
         base.Dispose();
     }
 }
 public void CloseBossDoor(RoomObj linkedRoom, GameTypes.LevelType levelType)
 {
     bool flag = false;
     switch (levelType)
     {
     case GameTypes.LevelType.CASTLE:
         if (Game.PlayerStats.EyeballBossBeaten)
         {
             flag = true;
         }
         break;
     case GameTypes.LevelType.GARDEN:
         if (Game.PlayerStats.FairyBossBeaten)
         {
             flag = true;
         }
         break;
     case GameTypes.LevelType.DUNGEON:
         if (Game.PlayerStats.BlobBossBeaten)
         {
             flag = true;
         }
         break;
     case GameTypes.LevelType.TOWER:
         if (Game.PlayerStats.FireballBossBeaten)
         {
             flag = true;
         }
         break;
     }
     if (flag)
     {
         foreach (DoorObj current in linkedRoom.DoorList)
         {
             if (current.IsBossDoor)
             {
                 foreach (GameObj current2 in linkedRoom.GameObjList)
                 {
                     if (current2.Name == "BossDoor")
                     {
                         current2.ChangeSprite((current2 as SpriteObj).SpriteName.Replace("Open", ""));
                         current2.TextureColor = Color.White;
                         current2.Opacity = 1f;
                         linkedRoom.LinkedRoom = null;
                         break;
                     }
                 }
                 current.Locked = true;
                 break;
             }
         }
     }
     this.OpenChallengeBossDoor(linkedRoom, levelType);
     if (Game.PlayerStats.ChallengeLastBossUnlocked)
     {
         this.OpenLastBossChallengeDoors();
     }
 }
Beispiel #20
0
 public void CopyRoomObjects(RoomObj room)
 {
     foreach (TerrainObj current in room.TerrainObjList)
     {
         this.TerrainObjList.Add(current.Clone() as TerrainObj);
     }
     foreach (GameObj current2 in room.GameObjList)
     {
         this.GameObjList.Add(current2.Clone() as GameObj);
     }
     foreach (DoorObj current3 in room.DoorList)
     {
         DoorObj doorObj = current3.Clone() as DoorObj;
         doorObj.Room = this;
         this.DoorList.Add(doorObj);
     }
     foreach (EnemyObj current4 in room.EnemyList)
     {
         this.EnemyList.Add(current4.Clone() as EnemyObj);
     }
     foreach (BorderObj current5 in room.BorderList)
     {
         this.BorderList.Add(current5.Clone() as BorderObj);
     }
 }
Beispiel #21
0
 public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         this.m_storedRoom = null;
         this.m_smoke.Dispose();
         this.m_smoke = null;
         this.m_log.Dispose();
         this.m_log = null;
         this.m_closestCeiling = null;
         base.Dispose();
     }
 }
Beispiel #22
0
 public void CopyRoomProperties(RoomObj room)
 {
     base.Name = room.Name;
     this.SetWidth(room.Width);
     this.SetHeight(room.Height);
     base.Position = room.Position;
     this.AddToCastlePool = room.AddToCastlePool;
     this.AddToGardenPool = room.AddToGardenPool;
     this.AddToDungeonPool = room.AddToDungeonPool;
     this.AddToTowerPool = room.AddToTowerPool;
     this.PoolIndex = room.PoolIndex;
     this.RedEnemyType = room.RedEnemyType;
     this.BlueEnemyType = room.BlueEnemyType;
     this.GreenEnemyType = room.GreenEnemyType;
     this.LinkedRoom = room.LinkedRoom;
     this.IsReversed = room.IsReversed;
     this.DebugRoomPosition = room.DebugRoomPosition;
     this.Tag = room.Tag;
     this.LevelType = room.LevelType;
     this.IsDLCMap = room.IsDLCMap;
     base.TextureColor = room.TextureColor;
 }
Beispiel #23
0
 public void AddRoom(RoomObj room)
 {
     if (!this.m_addedRooms.Contains(room) && room.Width / 1320 < 5)
     {
         SpriteObj spriteObj = new SpriteObj(string.Concat(new object[]
         {
             "MapRoom",
             room.Width / 1320,
             "x",
             room.Height / 720,
             "_Sprite"
         }));
         spriteObj.Position = new Vector2(room.X / this.m_spriteScale.X, room.Y / this.m_spriteScale.Y);
         spriteObj.Scale = new Vector2(((float)spriteObj.Width - 3f) / (float)spriteObj.Width, ((float)spriteObj.Height - 3f) / (float)spriteObj.Height);
         spriteObj.ForceDraw = true;
         spriteObj.TextureColor = room.TextureColor;
         this.m_roomSpriteList.Add(spriteObj);
         this.m_roomSpritePosList.Add(spriteObj.Position);
         foreach (DoorObj current in room.DoorList)
         {
             if (!(room.Name == "CastleEntrance") || !(current.DoorPosition == "Left"))
             {
                 bool flag = false;
                 SpriteObj spriteObj2 = new SpriteObj("MapDoor_Sprite");
                 spriteObj2.ForceDraw = true;
                 string doorPosition;
                 if ((doorPosition = current.DoorPosition) != null)
                 {
                     if (!(doorPosition == "Left"))
                     {
                         if (!(doorPosition == "Right"))
                         {
                             if (!(doorPosition == "Bottom"))
                             {
                                 if (doorPosition == "Top")
                                 {
                                     spriteObj2.Rotation = -90f;
                                     spriteObj2.Position = new Vector2(current.X / this.m_spriteScale.X, current.Y / this.m_spriteScale.Y + 2f);
                                     flag = true;
                                 }
                             }
                             else
                             {
                                 spriteObj2.Rotation = -90f;
                                 spriteObj2.Position = new Vector2(current.X / this.m_spriteScale.X, (current.Y + (float)current.Height) / this.m_spriteScale.Y + 2f);
                                 flag = true;
                             }
                         }
                         else
                         {
                             spriteObj2.Position = new Vector2((float)room.Bounds.Right / this.m_spriteScale.X - 5f, current.Y / this.m_spriteScale.Y - 2f);
                             flag = true;
                         }
                     }
                     else
                     {
                         spriteObj2.Position = new Vector2((float)room.Bounds.Left / this.m_spriteScale.X - (float)spriteObj2.Width + 2f, current.Y / this.m_spriteScale.Y - 2f);
                         flag = true;
                     }
                 }
                 if (flag)
                 {
                     this.m_doorSpritePosList.Add(spriteObj2.Position);
                     this.m_doorSpriteList.Add(spriteObj2);
                 }
             }
         }
         if (room.Name != "Bonus" && Game.PlayerStats.Class != 13)
         {
             foreach (GameObj current2 in room.GameObjList)
             {
                 ChestObj chestObj = current2 as ChestObj;
                 if (chestObj != null)
                 {
                     SpriteObj spriteObj3;
                     if (chestObj.IsOpen)
                     {
                         spriteObj3 = new SpriteObj("MapChestUnlocked_Sprite");
                     }
                     else if (chestObj is FairyChestObj)
                     {
                         spriteObj3 = new SpriteObj("MapFairyChestIcon_Sprite");
                         if ((chestObj as FairyChestObj).ConditionType == 10)
                         {
                             spriteObj3.Opacity = 0.2f;
                         }
                     }
                     else
                     {
                         spriteObj3 = new SpriteObj("MapLockedChestIcon_Sprite");
                     }
                     this.m_iconSpriteList.Add(spriteObj3);
                     spriteObj3.AnimationDelay = 0.0333333351f;
                     spriteObj3.PlayAnimation(true);
                     spriteObj3.ForceDraw = true;
                     spriteObj3.Position = new Vector2(current2.X / this.m_spriteScale.X - 8f, current2.Y / this.m_spriteScale.Y - 12f);
                     if (room.IsReversed)
                     {
                         spriteObj3.X -= (float)current2.Width / this.m_spriteScale.X;
                     }
                     this.m_iconSpritePosList.Add(spriteObj3.Position);
                 }
             }
         }
         if (room.Name == "EntranceBoss")
         {
             SpriteObj spriteObj4 = new SpriteObj("MapBossIcon_Sprite");
             spriteObj4.AnimationDelay = 0.0333333351f;
             spriteObj4.ForceDraw = true;
             spriteObj4.PlayAnimation(true);
             spriteObj4.Position = new Vector2((room.X + (float)room.Width / 2f) / this.m_spriteScale.X - (float)(spriteObj4.Width / 2) - 1f, (room.Y + (float)room.Height / 2f) / this.m_spriteScale.Y - (float)(spriteObj4.Height / 2) - 2f);
             this.m_iconSpriteList.Add(spriteObj4);
             this.m_iconSpritePosList.Add(spriteObj4.Position);
             this.m_teleporterList.Add(spriteObj4);
             this.m_teleporterPosList.Add(spriteObj4.Position);
         }
         else if (room.Name == "Linker")
         {
             SpriteObj spriteObj5 = new SpriteObj("MapTeleporterIcon_Sprite");
             spriteObj5.AnimationDelay = 0.0333333351f;
             spriteObj5.ForceDraw = true;
             spriteObj5.PlayAnimation(true);
             spriteObj5.Position = new Vector2((room.X + (float)room.Width / 2f) / this.m_spriteScale.X - (float)(spriteObj5.Width / 2) - 1f, (room.Y + (float)room.Height / 2f) / this.m_spriteScale.Y - (float)(spriteObj5.Height / 2) - 2f);
             this.m_iconSpriteList.Add(spriteObj5);
             this.m_iconSpritePosList.Add(spriteObj5.Position);
             this.m_teleporterList.Add(spriteObj5);
             this.m_teleporterPosList.Add(spriteObj5.Position);
         }
         else if (room.Name == "CastleEntrance")
         {
             SpriteObj spriteObj6 = new SpriteObj("MapTeleporterIcon_Sprite");
             spriteObj6.AnimationDelay = 0.0333333351f;
             spriteObj6.ForceDraw = true;
             spriteObj6.PlayAnimation(true);
             spriteObj6.Position = new Vector2((room.X + (float)room.Width / 2f) / this.m_spriteScale.X - (float)(spriteObj6.Width / 2) - 1f, (room.Y + (float)room.Height / 2f) / this.m_spriteScale.Y - (float)(spriteObj6.Height / 2) - 2f);
             this.m_iconSpriteList.Add(spriteObj6);
             this.m_iconSpritePosList.Add(spriteObj6.Position);
             this.m_teleporterList.Add(spriteObj6);
             this.m_teleporterPosList.Add(spriteObj6.Position);
         }
         if (Game.PlayerStats.Class != 13 && room.Name == "Bonus")
         {
             SpriteObj spriteObj7 = new SpriteObj("MapBonusIcon_Sprite");
             spriteObj7.PlayAnimation(true);
             spriteObj7.AnimationDelay = 0.0333333351f;
             spriteObj7.ForceDraw = true;
             spriteObj7.Position = new Vector2((room.X + (float)room.Width / 2f) / this.m_spriteScale.X - (float)(spriteObj7.Width / 2) - 1f, (room.Y + (float)room.Height / 2f) / this.m_spriteScale.Y - (float)(spriteObj7.Height / 2) - 2f);
             this.m_iconSpriteList.Add(spriteObj7);
             this.m_iconSpritePosList.Add(spriteObj7.Position);
         }
         this.m_addedRooms.Add(room);
     }
 }
 public void OpenChallengeBossDoor(RoomObj linkerRoom, GameTypes.LevelType levelType)
 {
     bool flag = false;
     switch (levelType)
     {
     case GameTypes.LevelType.CASTLE:
         if (Game.PlayerStats.EyeballBossBeaten && !Game.PlayerStats.ChallengeEyeballBeaten && Game.PlayerStats.ChallengeEyeballUnlocked)
         {
             flag = true;
         }
         break;
     case GameTypes.LevelType.GARDEN:
         if (Game.PlayerStats.FairyBossBeaten && !Game.PlayerStats.ChallengeSkullBeaten && Game.PlayerStats.ChallengeSkullUnlocked)
         {
             flag = true;
         }
         break;
     case GameTypes.LevelType.DUNGEON:
         if (Game.PlayerStats.BlobBossBeaten && !Game.PlayerStats.ChallengeBlobBeaten && Game.PlayerStats.ChallengeBlobUnlocked)
         {
             flag = true;
         }
         break;
     case GameTypes.LevelType.TOWER:
         if (Game.PlayerStats.FireballBossBeaten && !Game.PlayerStats.ChallengeFireballBeaten && Game.PlayerStats.ChallengeFireballUnlocked)
         {
             flag = true;
         }
         break;
     }
     if (flag)
     {
         RoomObj challengeBossRoomFromRoomList = LevelBuilder2.GetChallengeBossRoomFromRoomList(levelType, this.m_roomList);
         linkerRoom.LinkedRoom = challengeBossRoomFromRoomList;
         foreach (DoorObj current in linkerRoom.DoorList)
         {
             if (current.IsBossDoor)
             {
                 foreach (GameObj current2 in linkerRoom.GameObjList)
                 {
                     if (current2.Name == "BossDoor")
                     {
                         current2.ChangeSprite((current2 as SpriteObj).SpriteName.Replace("_Sprite", "Open_Sprite"));
                         current2.TextureColor = new Color(0, 255, 255);
                         current2.Opacity = 0.6f;
                         break;
                     }
                 }
                 current.Locked = false;
                 break;
             }
         }
     }
 }
Beispiel #25
0
 public void RunDisplacerEffect(RoomObj room, PlayerObj player)
 {
     int num = 2147483647;
     TerrainObj terrainObj = null;
     Vector2 value = Vector2.Zero;
     foreach (TerrainObj current in room.TerrainObjList)
     {
         value = Vector2.Zero;
         float num2 = 3.40282347E+38f;
         if (player.Flip == SpriteEffects.None)
         {
             if (current.X > base.X && current.Bounds.Top < this.Bounds.Bottom && current.Bounds.Bottom > this.Bounds.Top)
             {
                 if (current.Rotation < 0f)
                 {
                     value = CollisionMath.LineToLineIntersect(base.Position, new Vector2(base.X + 6600f, base.Y), CollisionMath.UpperLeftCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero), CollisionMath.UpperRightCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero));
                 }
                 else if (current.Rotation > 0f)
                 {
                     value = CollisionMath.LineToLineIntersect(base.Position, new Vector2(base.X + 6600f, base.Y), CollisionMath.LowerLeftCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero), CollisionMath.UpperLeftCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero));
                 }
                 if (value != Vector2.Zero)
                 {
                     num2 = value.X - base.X;
                 }
                 else
                 {
                     num2 = (float)(current.Bounds.Left - this.Bounds.Right);
                 }
             }
         }
         else if (current.X < base.X && current.Bounds.Top < this.Bounds.Bottom && current.Bounds.Bottom > this.Bounds.Top)
         {
             if (current.Rotation < 0f)
             {
                 value = CollisionMath.LineToLineIntersect(new Vector2(base.X - 6600f, base.Y), base.Position, CollisionMath.UpperRightCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero), CollisionMath.LowerRightCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero));
             }
             else if (current.Rotation > 0f)
             {
                 value = CollisionMath.LineToLineIntersect(new Vector2(base.X - 6600f, base.Y), base.Position, CollisionMath.UpperLeftCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero), CollisionMath.UpperRightCorner(current.NonRotatedBounds, current.Rotation, Vector2.Zero));
             }
             if (value != Vector2.Zero)
             {
                 num2 = base.X - value.X;
             }
             else
             {
                 num2 = (float)(this.Bounds.Left - current.Bounds.Right);
             }
         }
         if (num2 < (float)num)
         {
             num = (int)num2;
             terrainObj = current;
         }
     }
     if (terrainObj != null)
     {
         if (player.Flip == SpriteEffects.None)
         {
             if (terrainObj.Rotation == 0f)
             {
                 player.X += (float)num - (float)player.TerrainBounds.Width / 2f;
                 return;
             }
             player.X += (float)num - (float)player.Width / 2f;
             return;
         }
         else
         {
             if (terrainObj.Rotation == 0f)
             {
                 player.X -= (float)num - (float)player.TerrainBounds.Width / 2f;
                 return;
             }
             player.X -= (float)num - (float)player.Width / 2f;
         }
     }
 }
Beispiel #26
0
 public void RefreshMapChestIcons(RoomObj room)
 {
     this.m_mapDisplay.RefreshChestIcons(room);
 }