public void addIslandAt(int i, int j, int p) { PlacedPlayer newCurrentPlayer; Vector3 noise = new Vector3(Random.Range(-maxNoise, maxNoise), 0, Random.Range(-maxNoise, maxNoise)); GameObject newObject = (GameObject)Instantiate(islandPrefab); CompoundIsland newIsland = newObject.GetComponent <CompoundIsland> (); newIsland.init(); // check group int gr = controlHub.gameController.playerDict.ElementAt(p).Value.group; if (controlHub.gameController.playerGroup == gr) { newIsland.disableIsland(); } newIsland.setLabelColor(controlHub.menuController.groupColor [gr]); newObject.transform.localPosition = new Vector3(j * gridSize + noise.x, 0, i * gridSize + noise.y); newObject.transform.Rotate(new Vector3(0, Random.Range(0.0f, 360.0f), 0)); string nick = controlHub.gameController.playerDict.ElementAt(p).Value.nickname; //.playerList [p].nickname; if (nick.Equals("")) { nick = controlHub.gameController.playerDict.ElementAt(p).Value.login; } newIsland.island1.setLabel(nick); newIsland.island1.billboard.cam = cam; newIsland.island1.owner = controlHub.gameController.playerDict.ElementAt(p).Value.login; newIsland.island1.seekPlayerController = this; newIsland.island1.camera = cam; newIsland.island2.setLabel(nick); newIsland.island2.billboard.cam = cam; newIsland.island2.owner = controlHub.gameController.playerDict.ElementAt(p).Value.login; newIsland.island2.seekPlayerController = this; newIsland.island2.camera = cam; GameObject newDotGO = (GameObject)Instantiate(dotPrefab); newDotGO.transform.localPosition = new Vector3(newObject.transform.localPosition.x, -5000.0f, newObject.transform.localPosition.z); newDotGO.transform.parent = matrixParent.transform; subIslandMatrix [i, j] = newDotGO; islandMatrix [i, j] = newObject; newCurrentPlayer = new PlacedPlayer(); newCurrentPlayer.player = controlHub.gameController.playerDict.ElementAt(p).Value; newCurrentPlayer.i = i; newCurrentPlayer.j = j; currentPlayers.Add(controlHub.gameController.playerDict.ElementAt(p).Key, newCurrentPlayer); }
public void refreshIslandAt(int i, int j, string newNick) { CompoundIsland newIsland = islandMatrix [i, j].GetComponent <CompoundIsland> (); //string nick = controlHub.gameController.playerDict.ElementAt (p).Value.nickname; //.playerList [p].nickname; //if (nick.Equals ("")) // nick = controlHub.gameController.playerDict.ElementAt (p).Value.login; newIsland.island1.setLabel(newNick); newIsland.island2.setLabel(newNick); }