public void OpenWalls() { for (int i = 0; i < enterTriggers.Count; i++) { if (enterTriggers[i] != null) { IFightRoomTrigger current = enterTriggers[i].GetComponent <IFightRoomTrigger>(); current.ClosePrimary(true, 0.0f); current.CloseSecondary(false, 0.0f); } } }
//move the walls of the room based upon whether the level has been completed void MoveWalls() { for (int i = 0; i < enterTriggers.Count; i++) { IFightRoomTrigger current = enterTriggers[i].GetComponent <IFightRoomTrigger>(); current.ClosePrimary(levelStarted, gateTimer); if (!levelStarted) { current.CloseSecondary(true, gateTimer); } } }
//co routine which will play out the level, spawning in the pooled enemies IEnumerator playLevel() { // Play the blimp spotlight animation if it exists if (blimpSpotlightPlayableDirector != null) { blimpSpotlightLight.gameObject.SetActive(true); blimpSpotlightPlayableDirector.Play(); } while (selectedConfiguration.poolSize > 0 || enemyObjects.Count > 0) { if (SCR_Boss.instance.bossAttacking) { SCR_Boss.instance.BossAttack(false); } if (enemyObjects.Count < selectedConfiguration.maxSpawnSize && selectedConfiguration.poolSize > 0) { int rng = Random.Range(0, selectedConfiguration.poolSize); bool pointChosen = false; int nodeSpawn = 0; GameObject currentNode = this.gameObject; while (!pointChosen) { nodeSpawn = Random.Range(0, spawnNodes.Count); currentNode = spawnNodes[nodeSpawn]; if (!currentNode.GetComponent <SCR_SpiderPortal>().currentlySpawning) { pointChosen = true; } yield return(null); } currentNode.GetComponent <SCR_SpiderPortal>().OpenPortal(0.5f); GameObject spawn = Instantiate(returnEnemyPrefab(selectedConfiguration.ReturnPoolsType(rng)), currentNode.transform.position + (Vector3.down * 3), Quaternion.identity); spawn.transform.parent = transform; enemyObjects.Add(spawn); AssignTypes(); IEnemy currentEnemyInterface = (IEnemy)spawn.GetComponent(typeof(IEnemy)); currentEnemyInterface.SetRoomManager(this.gameObject); if (buffEnemy != null) { currentEnemyInterface.BuffEnemy(buffEnemy.GetComponent <SCR_BuffSpider>().returnBuffType()); } float timer = Random.Range(2.5f, 4.0f); StartCoroutine(currentEnemyInterface.spawnEnemy(currentNode, timer)); } yield return(null); } SCR_AudioManager.instance.Play("DoorOpen"); for (int i = 0; i < enterTriggers.Count; i++) { IFightRoomTrigger current = enterTriggers[i].GetComponent <IFightRoomTrigger>(); current.ClosePrimary(true, gateTimer); } if (buffEnemy != null) { buffEnemy.GetComponent <SCR_BuffSpider>().PowerDown(); } SCR_AudioManager.instance.PlayWalkMusic(); SCR_GameManager.instance.PlayerFighting = false; if (player1 & player2) { SCR_PlayerWorldSpaceUI player1WorldSpaceUIScr = player1.GetComponent <SCR_PlayerWorldSpaceUI>(); SCR_PlayerWorldSpaceUI player2WorldSpaceUIScr = player2.GetComponent <SCR_PlayerWorldSpaceUI>(); if (player1WorldSpaceUIScr) { player1WorldSpaceUIScr.HealPrompt(true); } if (player2WorldSpaceUIScr) { player2WorldSpaceUIScr.HealPrompt(true); } yield return(new WaitForSeconds(4.0f)); if (player1WorldSpaceUIScr) { player1WorldSpaceUIScr.HealPrompt(false); } if (player2WorldSpaceUIScr) { player2WorldSpaceUIScr.HealPrompt(false); } } // Fade out the blimp light if (blimpSpotlightLight != null) { StartCoroutine(FadeOutBlimpSpotlight()); } }