public void AddWorldUIData(GameObject worldUIObject, WorldDinoUI worldDinoUI) { WorldUIData[] newWorldUIs = new WorldUIData[worldUIs.Length + 1]; for (int i = 0; i < worldUIs.Length; i++) { newWorldUIs[i] = worldUIs[i]; } WorldUIData data = new WorldUIData(worldUIObject, worldDinoUI); newWorldUIs[newWorldUIs.Length - 1] = data; worldUIs = newWorldUIs; }
private void CreatePlayerWorldUI(int playerNumber, int playerViewer) { PlayerData data = players[playerNumber - 1]; PlayerData viewerdata = players[playerViewer - 1]; // Create world UI object GameObject worldUIObject = (GameObject)Instantiate(dinoWorldUIPrefab, data.dinoObject.transform); WorldDinoUI worldDinoUI = worldUIObject.GetComponent <WorldDinoUI>(); // Configure world UI object worldDinoUI.gameCharacter = data.dinoCharacter; worldDinoUI.playerCamera = viewerdata.playerCamera; worldDinoUI.playerNumber = viewerdata.playerNumber; worldDinoUI.dinoPlayerNumber = data.playerNumber; // Enable the object worldUIObject.SetActive(true); // Add it to the player data. data.AddWorldUIData(worldUIObject, worldDinoUI); }
public WorldUIData(GameObject worldUIObject, WorldDinoUI worldDinoUI) { this.worldUIObject = worldUIObject; this.worldDinoUI = worldDinoUI; }