/// <summary> /// Initializing the game with data from the opponent to set up mirroring properly. /// </summary> /// <param name="enemyChosenTeam">The chosen team of the opponent</param> /// <param name="enemyChosenFormation">The chosen formation of the opponent</param> /// <param name="enemyUsername">The user name of the opponents</param> void MultiplayerInit(int enemyChosenTeam, int enemyChosenFormation, string enemyUsername) { enemyPucksFormation = SC_GameTactics.EnemyFormation(enemyChosenFormation); enemyChosenTeamIndex = enemyChosenTeam; playerPucksFormation = SC_GameTactics.ChosenFormation(DefinedVariables.chosenFormation); InitPucksTeamLogoImg(); uiObject["Text_Username"].GetComponent <Text>().text = DefinedVariables.userName; uiObject["Text_Computer"].GetComponent <Text>().text = enemyUsername; ResetRound(); }
/// <summary> /// Initialization of required variables for proper game manager behavior. /// </summary> void Init() { /** Player init **/ playerObject = new Dictionary <string, GameObject>(); GameObject[] playerObjects = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject g in playerObjects) { playerObject.Add(g.name, g); } if (DefinedVariables.IsMultiplayerOn == false) { playerPucksFormation = SC_GameTactics.ChosenFormation(DefinedVariables.chosenFormation); } /** Enemy init **/ enemyObject = new Dictionary <string, GameObject>(); GameObject[] enemyObjects = GameObject.FindGameObjectsWithTag("Enemy"); foreach (GameObject g in enemyObjects) { enemyObject.Add(g.name, g); } if (DefinedVariables.IsMultiplayerOn == false) { ChooseEnemyTeamAndFormation(); enemyPucksFormation = SC_GameTactics.EnemyFormation(enemyChosenFormationIndex); } /** UI init **/ uiObject = new Dictionary <string, GameObject>(); GameObject[] uiObjects = GameObject.FindGameObjectsWithTag("SinglePlayerUI"); foreach (GameObject g in uiObjects) { uiObject.Add(g.name, g); } uiObject["Image_GameFinished"].SetActive(false); uiObject["Text_Username"].GetComponent <Text>().text = DefinedVariables.userName; /** General init **/ initialPuckPositioningSpeed = 480.0f; IsPuckMoving = false; IsGameOver = false; EventSubs(); if (DefinedVariables.IsMultiplayerOn == false) { InitPucksTeamLogoImg(); IsPlayerTurn = true; ResetRound(); } }