public override void Dispose()
 {
     if (!base.IsDisposed)
     {
         this.m_obj = null;
         base.Dispose();
     }
 }
 public override void Execute()
 {
     if (this.ParentLogicSet != null && this.ParentLogicSet.IsActive)
     {
         this.m_obj = (this.ParentLogicSet.ParentGameObj as EnemyObj);
         this.SequenceType = Types.Sequence.Serial;
         base.Execute();
     }
 }
Beispiel #3
0
 private void FixMiniboss(EnemyObj enemy)
 {
     byte type = enemy.Type;
     switch (type)
     {
     case 2:
         this.m_blobBoss = (enemy as EnemyObj_Blob);
         enemy.ChangeSprite("EnemyBlobBossIdle_Character");
         enemy.GetChildAt(0).TextureColor = Color.White;
         enemy.GetChildAt(2).TextureColor = Color.LightSkyBlue;
         enemy.GetChildAt(2).Opacity = 0.8f;
         (enemy.GetChildAt(1) as SpriteObj).OutlineColour = Color.Black;
         enemy.GetChildAt(1).TextureColor = Color.Black;
         break;
     case 3:
     case 4:
         break;
     case 5:
         if (enemy.Flip == SpriteEffects.None)
         {
             enemy.Name = "Amon";
         }
         else
         {
             enemy.Name = "Barbatos";
         }
         break;
     case 6:
         enemy.ChangeSprite("EnemyEyeballBossEye_Character");
         (enemy as EnemyObj_Eyeball).ChangeToBossPupil();
         break;
     case 7:
         enemy.ChangeSprite("EnemyFairyGhostBossIdle_Character");
         break;
     case 8:
         enemy.ChangeSprite("EnemyGhostBossIdle_Character");
         break;
     default:
         if (type != 15)
         {
             if (type == 22)
             {
                 if (enemy.Flip == SpriteEffects.None)
                 {
                     enemy.Name = "Stolas";
                 }
                 else
                 {
                     enemy.Name = "Focalor";
                 }
             }
         }
         else if (enemy.Flip == SpriteEffects.None)
         {
             enemy.Name = "Berith";
         }
         else
         {
             enemy.Name = "Halphas";
         }
         break;
     }
     enemy.PlayAnimation(true);
 }
 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 AddEnemyToCurrentRoom(EnemyObj enemy)
 {
     this.m_currentRoom.TempEnemyList.Add(enemy);
     this.m_physicsManager.AddObject(enemy);
     this.m_tempEnemyStartPositions.Add(enemy.Position);
     enemy.SetPlayerTarget(this.m_player);
     enemy.SetLevelScreen(this);
     enemy.Initialize();
 }
 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;
             }
         }
     }
 }
 public void SetLastEnemyHit(EnemyObj enemy)
 {
     this.m_lastEnemyHit = enemy;
     this.m_enemyHUDCounter = this.m_enemyHUDDuration;
     this.m_enemyHUD.UpdateEnemyInfo(this.m_lastEnemyHit.Name, this.m_lastEnemyHit.Level, (float)this.m_lastEnemyHit.CurrentHealth / (float)this.m_lastEnemyHit.MaxHealth);
 }
 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);
 }
 public void KillEnemy(EnemyObj enemy)
 {
     if (enemy.SaveToFile)
     {
         Vector2 item = new Vector2((float)this.m_roomList.IndexOf(this.CurrentRoom), (float)this.CurrentRoom.EnemyList.IndexOf(enemy));
         if (item.X < 0f || item.Y < 0f)
         {
             throw new Exception("Could not find killed enemy in either CurrentRoom or CurrentRoom.EnemyList. This may be because the enemy was a blob");
         }
         Game.PlayerStats.EnemiesKilledInRun.Add(item);
     }
 }