Galaxy Anpassen
This commit is contained in:
@@ -1,18 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
// Array will contain objects which contain all information about all players
|
||||
public PlayerManager[] playerManagers { get; private set; }
|
||||
static public PlayerManager[] playerManagers { get; private set; }
|
||||
|
||||
// Clock which counts seconds until new day and updates playerManagers at new day
|
||||
public Clock clock;
|
||||
|
||||
public ScienceManager sm;
|
||||
|
||||
public int numberOfPlayers { get; set; }
|
||||
int numberOfPlayers = GameUI.PlayersNumber; // number of the created solarsystems
|
||||
|
||||
public GameObject SolarSystemPrefab; // Prefab of SolarSytem-Objekts
|
||||
|
||||
public static GameObject[] SolarSystems;
|
||||
|
||||
|
||||
//public int numberOfPlayers;//{ get; set; }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -22,8 +32,15 @@ public class GameManager : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
initPlayerManagers(1);
|
||||
SolarSystems = new GameObject[numberOfPlayers];
|
||||
initPlayerManagers(numberOfPlayers);
|
||||
clock.gameManager = this;
|
||||
for (int i = 0; i < numberOfPlayers; i++)
|
||||
{
|
||||
// Erzeuge ein neues GameObject aus dem Prefab
|
||||
SolarSystems[i] = Instantiate(SolarSystemPrefab);
|
||||
}
|
||||
SolarSystems[0].GetComponent<SolarSystemManager>().SetIDPlanet(1, 0);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -32,10 +49,10 @@ public class GameManager : MonoBehaviour
|
||||
// Initializes numberOfPlayers player managers and puts them into array
|
||||
public void initPlayerManagers(int numberOfPlayers)
|
||||
{
|
||||
this.playerManagers = new PlayerManager[numberOfPlayers];
|
||||
playerManagers = new PlayerManager[numberOfPlayers];
|
||||
for (int i = 0; i < numberOfPlayers; i++)
|
||||
{
|
||||
this.playerManagers[i] = new PlayerManager(sm);
|
||||
playerManagers[i] = new PlayerManager(sm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user