// Update is called once per frame void Update() { if (Activated < ActivatedTotal) { PillarsLeft.text = Activated.ToString() + "/" + ActivatedTotal.ToString() + " memories have been activated"; } else if (Vector2.Distance(playerPos.position, Vector3.zero) > 4.5f) { PillarsLeft.text = "all memories have been activated. Return to center"; } else { if (SpawnOnce == false) { Instantiate(Transistion, Transistion.transform.position, Quaternion.identity); Invoke("LoadScene", 2f); SpawnOnce = true; } } GameObject[] AllEnemies = GameObject.FindGameObjectsWithTag("Enemy"); GameObject[] AllPaths = GameObject.FindGameObjectsWithTag("Bridge"); if (AllEnemies.Length <= 0) { EnemyAlive = false; } if (AllEnemies.Length > 0) { EnemyAlive = true; for (int i = 0; i < AllPaths.Length; i++) { PathCollider LineR = AllPaths[i].GetComponent <PathCollider>(); LineR.RemoveColor(); LineR.PathToggle = false; } } else if (Activated > 0) { PathHolder.gameObject.SetActive(true); for (int i = 0; i < AllPaths.Length; i++) { PathCollider LineR = AllPaths[i].GetComponent <PathCollider>(); LineR.ChangeColor(ColorChange); LineR.PathToggle = true; } } DisplayTimer -= Time.deltaTime; if (DisplayTimer < 0) { Title.color = Color.Lerp(Title.color, Color.clear, Time.deltaTime); TextDescriptions.color = Color.Lerp(TextDescriptions.color, Color.clear, Time.deltaTime); } }
// Start is called before the first frame update void Start() { PillarsLeft = GameObject.FindGameObjectWithTag("PillarText").GetComponent <Text>(); TextDescriptions = GameObject.FindGameObjectWithTag("DescriptionText").GetComponent <Text>(); Title = GameObject.FindGameObjectWithTag("TitleText").GetComponent <Text>(); PillarsLeft.text = ""; Title.text = ""; playerPos = GameObject.FindGameObjectWithTag("Player").transform; PlayerControl = playerPos.GetComponent <PlayerController>(); value = 0; for (int i = 0; i < BoardsSpawnLocations.Length; i++) { float RandChance = Random.Range(0f, 1f); if (RandChance >= ChanceToSpawn && BoardsMade >= Min) { print("skipped"); } else { int RandomBoardLoc = Random.Range(0, BoardsSpawnLocations.Length); while (SpawnUsed[RandomBoardLoc]) { RandomBoardLoc = Random.Range(0, BoardsSpawnLocations.Length); } SpawnBoard(BoardsSpawnLocations[RandomBoardLoc]); SpawnUsed[RandomBoardLoc] = true; } } PathHolder.gameObject.SetActive(false); AllPaths = GameObject.FindGameObjectsWithTag("Bridge"); for (int i = 0; i < AllPaths.Length; i++) { PathCollider LineR = AllPaths[i].GetComponent <PathCollider>(); LineR.RemoveColor(); } ActivatedTotal += value + 1; }