public void EditSelfNation() { if (PlayerEnumUtils.GetCurrentPlayer() == PlayerEnum.LEFT) { Game.Instance.EditingNation01 = true; } else { Game.Instance.EditingNation02 = true; } }
// Use this for initialization void OnEnable() { PlayerEnum player = PlayerEnumUtils.GetCurrentPlayer(); if (player == PlayerEnum.LEFT) { Selection01.SetActive(true); Selection02.SetActive(false); } else { Selection01.SetActive(false); Selection02.SetActive(true); } }
void Start() { lastNation01 = Game.Instance.Nation01; lastNation02 = Game.Instance.Nation02; if (id == -1) { if (PlayerEnumUtils.GetCurrentPlayer() == PlayerEnum.LEFT) { id = 0; } else { id = 1; } } //Set (); }
void Start() { PlayerEnum player = PlayerEnumUtils.GetCurrentPlayer(); bool leftPlayer = (player == PlayerEnum.LEFT); if (leftLable == leftPlayer) { label.text = Localization.Get("Choose Team"); SelectionWindows.SetActive(true); WaitingWindow.SetActive(false); } else { label.text = Localization.Get("The Opponent"); SelectionWindows.SetActive(false); WaitingWindow.SetActive(true); } }
public void ConfigureOnlineFinished() { UniversalOnline.Instance.Progress = 90; byte[] dataSmall = new byte[20]; PlayerEnum player = PlayerEnumUtils.GetCurrentPlayer(); dataSmall [0] = Constants.CODE_CONFIGURE_MATCH; if (player == PlayerEnum.RIGHT) { int nationId02 = NationalSuits.getNationId(Game.Instance.Nation02); Game.Instance.LandscapeId = (byte)Random.Range(0, (int)Constants.BACKGROUNDS); dataSmall [1] = Game.Instance.LandscapeId; dataSmall [2] = Constants.CODE_NOTHING; dataSmall [3] = (byte)nationId02; Game.Instance.Nation02 = NationalSuits.getNationById((byte)nationId02); } else { int nationId01 = NationalSuits.getNationId(Game.Instance.Nation01); dataSmall [1] = Constants.CODE_NOTHING; dataSmall [2] = (byte)nationId01; dataSmall [3] = Constants.CODE_NOTHING; Game.Instance.Nation01 = NationalSuits.getNationById((byte)nationId01); } if (Game.Instance.OnlinePlay) { PlayGamesPlatform.Instance.RealTime.SendMessageToAll(true, dataSmall); } else if (Game.Instance.BluetoothPlay) { #if UNITY_ANDROID SendInfoToServerMainMenu(dataSmall); #endif } UniversalOnline.Instance.State = UniversalOnline.States.Playing; if (UniversalOnline.Instance.TheOpponentIsReady) { Invoke("StartOnlineMatch", 2.5f); } }
void Start() { isInGoldenGoal = false; // stop timer, but play the game Game.Instance.TimerActive = false; CancelInvoke("PrepareEnemie"); Game.Instance.SetGameActive(true); // distance from the screen float dFromScreen = 4f; points01 = new PointsManager(); points02 = new PointsManager(); canShoot = false; float doorPos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x; currentPlayer = PlayerEnumUtils.GetCurrentPlayer(); offlineMatch = Game.Instance.OnlinePlay == false && Game.Instance.BluetoothPlay == false && Game.Instance.LocalMultiPlayer == false; if (SavedVariables.FirstPlay) { SavedVariables.FirstPlay = false; tutorial.SetActive(true); } // disable some components MenuPause.SetActive(false); MenuGameEnded.SetActive(false); if (Game.Instance.TournamentMode) { GameEndedRowOffline.SetActive(false); GameEndedRowOnline.SetActive(false); GameEndedTournament.SetActive(true); RedoButton.enabled = false; RedoButton.SetState(UIButton.State.Disabled, true); } else if (Game.Instance.OnlinePlay || Game.Instance.BluetoothPlay) { GameEndedRowOffline.SetActive(false); GameEndedRowOnline.SetActive(true); GameEndedTournament.SetActive(false); } else if (Game.Instance.LocalPlay || Game.Instance.LocalMultiPlayer) { GameEndedRowOffline.SetActive(true); GameEndedRowOnline.SetActive(false); GameEndedTournament.SetActive(false); } Points01.enabled = false; Points02.enabled = false; if (Game.Instance.BluetoothPlay || Game.Instance.OnlinePlay) { PauseButton.SetActive(false); } else { EndMatchButton.SetActive(false); } // get the letters distance for (byte i = 0; i < letters.Length; i++) // count the distance from the letter on the left { if (i == 0) { lettersDistances[i] = 0; } else { lettersDistances[i] = letters[i].transform.position.x - letters[i - 1].transform.position.x; } } // SET WALLS POSITION { //Move each wall to its edge location: topDeath.size = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2 * 2, 1); topDeath.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y + 0.5f + dFromScreen); bottomDeath.size = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2 * 2, 1); bottomDeath.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).y - 0.5f - dFromScreen); leftDeath.size = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2 * 2);; leftDeath.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x - 0.5f - dFromScreen, 0); rightDeath.size = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2 * 2); rightDeath.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x + 0.5f + dFromScreen, 0); //Move each wind to its edge location: topWall.size = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2, 1); topWall.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y + 0.5f); bottomWall.size = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x * 2, 1); bottomWall.offset = new Vector2(0, Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).y - 0.5f); leftWall.size = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2);; leftWall.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x - 0.5f, 0); rightWall.size = new Vector2(1, Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0)).y * 2); rightWall.offset = new Vector2(Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).x + 0.5f, 0); } // SETUP BALL AND DOORS { // move down the referee Whistle(true); // doors doorLeft.transform.position = new Vector3(-doorPos, 0, 0); doorRight.transform.position = new Vector3(+doorPos, 0, 0); } GameObject player01 = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject; GameObject player02 = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject; GameObject goalKeeper = GameObject.Instantiate(playerBase, Vector3.zero, Quaternion.identity) as GameObject; while (Game.Instance.Nation01 == Nationals.NONE) { System.Array A = System.Enum.GetValues(typeof(Nationals)); Nationals V = (Nationals)A.GetValue(UnityEngine.Random.Range(0, A.Length)); Game.Instance.Nation01 = V; } while (Game.Instance.Nation02 == Nationals.NONE || Game.Instance.Nation02 == Game.Instance.Nation01) { System.Array A = System.Enum.GetValues(typeof(Nationals)); Nationals V = (Nationals)A.GetValue(UnityEngine.Random.Range(0, A.Length)); Game.Instance.Nation02 = V; } Flag01.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation01); Flag02.sprite2D = NationalSuits.getNationFlag(Game.Instance.Nation02); PlayerName01.text = NationalSuits.getNationNameShort(Game.Instance.Nation01); PlayerName02.text = NationalSuits.getNationNameShort(Game.Instance.Nation02); NationalSuit nationalSuit01 = NationalSuits.getSuitForNation(Game.Instance.Nation01); NationalSuit nationalSuit02 = NationalSuits.getSuitForNation(Game.Instance.Nation02); //LifeBarContent01.color = nationalSuit01.NationalColors.Jersey; //LifeBarContent02.color = nationalSuit02.NationalColors.Jersey; // SETUP PLAYERS { // set suit colors PlayerConfigurer.ConfigurePlayer(player01, nationalSuit01); PlayerConfigurer.ConfigurePlayer(player02, nationalSuit02); PlayerConfigurer.ConfigurePlayer(goalKeeper, NationalSuits.getGoalKeeperSuit()); // create many copies PlayerShooter.Instance.SetupPlayers(player01, player02, goalKeeper); Destroy(player01); Destroy(player02); Destroy(goalKeeper); } }