public void Reset() { gameStateMachine_Ref = this; if (canvas_Ref == null) { if (transform.GetChild(0).gameObject != null) canvas_Ref = transform.GetChild(0).gameObject; else Debug.Log("GameStateMachine is missing a reference to the Canvas"); } if (bordersParent_Ref == null) { if (GameObject.Find("BordersParent") != null) bordersParent_Ref = GameObject.Find("BordersParent"); else Debug.Log("GameStateMachine is missing a reference to BordersParent"); } if (playerInfoOne_Ref == null) Debug.Log("GameStateMachine is missing a reference to playerOneInfo"); if (playerInfoTwo_Ref == null) Debug.Log("GameStateMachine is missing a reference to playerTwoInfo"); //when games played are more than the gamesPlayedBeforeRefill this //if statemant will refill the arrays that hold portraits and phrases. if (gamesPlayed > gamesPlayedBeforeRefill || !devMode) { if (devMode) portrait_Refs = Resources.LoadAll("Portraits", typeof(Sprite)); else portrait_Refs = Resources.LoadAll("WitchPortraits", typeof(Sprite)); gamerTag_Refs = Resources.LoadAll("GamerTags", typeof(TextAsset)); introPhrases = Resources.LoadAll("IntroPhrases", typeof(TextAsset)); victoryPhrases = Resources.LoadAll("VictoryPhrases", typeof(TextAsset)); gamesPlayed = -1; } playerOneCharacter = new PlayerCharacter(portrait_Refs, introPhrases, victoryPhrases, gamerTag_Refs); playerTwoCharacter = new PlayerCharacter(portrait_Refs, introPhrases, victoryPhrases, gamerTag_Refs); playerCharacterArray = new PlayerCharacter[] { playerOneCharacter, playerTwoCharacter }; playerOneBlocksCollected = new bool[playerOneSpawner_Ref.GetComponent<Spawner>().groups.Length]; playerOneBlocksLanded = 0; playerTwoBlocksCollected = new bool[playerTwoSpawner_Ref.GetComponent<Spawner>().groups.Length]; playerTwoBlocksLanded = 0; gameOver = false; playerOneWon = false; introIsDone = false; inGameUIManager_Ref.ResetCollectedBlocks(); inGameUIManager_Ref.UpdatePlayerDisplays(); inGameText_Ref.text = "Get Ready!"; RefillSpawners(); playerOneSpawner_Ref.GetComponent<Spawner>().RemoveRemainingBlocks(); playerTwoSpawner_Ref.GetComponent<Spawner>().RemoveRemainingBlocks(); inGameUIManager_Ref.UpdatePlayerStatus(WhoIsInTheLead()); gamesPlayed++; }