protected override void Activate() { AIIdleState.SetShouldCheckDashAttackPredicate(ShouldBattlePlayerDashAttack); PlayerSpawner.SpawnAllPlayers(); List <GameModeIntroView.Icon> icons = new List <GameModeIntroView.Icon>(); foreach (Player player in RegisteredPlayers.AllPlayers) { icons.Add(GameModeIntroView.Icon.Player); icons.Add(GameModeIntroView.Icon.Swords); } icons.RemoveLast(); BattlePlayerHealth.LaserDamage = 0; InGameConstants.AllowChargingLasers = false; // NOTE (darren): avoid showing shields to have less visual noise with exploding object InGameConstants.ShowShields = false; GameModeIntroView.Show(DisplayTitle, icons, onFinishedCallback: () => { SetItPlayer(PlayerSpawner.AllSpawnedBattlePlayers.Random()); }); GameNotifications.OnBattlePlayerLaserHit.AddListener(HandleBattlePlayerHit); PlayerSpawner.OnSpawnedPlayerRemoved += HandleSpawnedPlayerRemoved; }
protected override void CleanupInternal() { AIIdleState.ClearShouldCheckDashAttackPredicate(); GameNotifications.OnBattlePlayerLaserHit.RemoveListener(HandleBattlePlayerHit); PlayerSpawner.OnSpawnedPlayerRemoved -= HandleSpawnedPlayerRemoved; BattlePlayerHealth.LaserDamage = 1; InGameConstants.AllowChargingLasers = true; InGameConstants.AllowedChargingLasersWhitelist.Clear(); InGameConstants.ShowShields = true; itPlayer_ = null; foreach (BattlePlayer battlePlayer in PlayerSpawner.AllSpawnedBattlePlayers) { var explosive = battlePlayer.GetComponentInChildren <TagExplosive>(); if (explosive == null) { continue; } ObjectPoolManager.Recycle(explosive); } }