using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using UnityEngine; public class PlayerManager { // Contains all star systems of player //private List starSystems = new List(); // Contains all fleets of player //private List fleets = new List(); private ScienceManager _scienceManager; public static int PlayerID = 1; public int ScienceAcumulated; // this int has to be moved to player manager later public enum PlayerColor { None, Red, Blue, Green, Yellow } public PlayerColor PlayerColor2 { get { return _playerColor; } set { _playerColor = value; } } private PlayerColor _playerColor; // Player values public PlayerValues PlayerAttributes { get { if (_playerAttributes == null) { _playerAttributes = new PlayerValues(); } return new PlayerValues(); } set { _playerAttributes = value; } } public PlayerValues _playerAttributes; public PlayerManager(ScienceManager sm) { this._scienceManager = sm; this._playerAttributes = new PlayerValues(); this._playerAttributes.id = PlayerID; PlayerID++; } // Called by clock over game manager, once per day public void simulateDay() { if (GameManager.SolarSystems != null) { for (int i = 0; i < GameUI.PlayersNumber; i++) { if (GameManager.SolarSystems[i].GetComponent() != null) { int playerID = this._playerAttributes.id; _scienceManager.UpdateScience(this._playerAttributes.science); this._playerAttributes.science = _scienceManager.PublicScienceAcumulated; this._playerAttributes.industrialCapacity += GameManager.SolarSystems[i].GetComponent().GetIndustrialCapacity(playerID) * _scienceManager.techs[0].Level; this._playerAttributes.money += GameManager.SolarSystems[i].GetComponent().GetMoney(playerID) * _scienceManager.techs[1].Level; this._playerAttributes.science += GameManager.SolarSystems[i].GetComponent().GetScience(playerID) * _scienceManager.techs[2].Level; GameManager.SolarSystems[i].GetComponent().UpdateFood(playerID, _scienceManager.techs[3].Level); this._playerAttributes.food += GameManager.SolarSystems[i].GetComponent().GetFood(playerID); this._playerAttributes.population += GameManager.SolarSystems[i].GetComponent().GetPopulation(playerID); this._playerAttributes.actualFood += GameManager.SolarSystems[i].GetComponent().GetActualFood(playerID); } } } //if (starSystems != null) //{ // Add resources for each part of each starSystem which belongs to this player //foreach (var starSystem in starSystems) //{ // int playerID = this._playerAttributes.id; // // StarSystem.getComponent