Galaxy Anpassen
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerManager
|
||||
{
|
||||
@@ -10,6 +12,7 @@ public class PlayerManager
|
||||
//private List<GameObject> fleets = new List<GameObject>();
|
||||
|
||||
private ScienceManager _scienceManager;
|
||||
public static int PlayerID = 1;
|
||||
|
||||
public int ScienceAcumulated; // this int has to be moved to player manager later
|
||||
|
||||
@@ -54,17 +57,43 @@ public class PlayerManager
|
||||
}
|
||||
}
|
||||
|
||||
private PlayerValues _playerAttributes;
|
||||
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<SolarSystemManager>() != null)
|
||||
{
|
||||
int playerID = this._playerAttributes.id;
|
||||
_scienceManager.UpdateScience(this._playerAttributes.science);
|
||||
this._playerAttributes.science = _scienceManager.PublicScienceAcumulated;
|
||||
|
||||
this._playerAttributes.industrialCapacity += GameManager.SolarSystems[i].GetComponent<SolarSystemManager>().GetIndustrialCapacity(playerID) * _scienceManager.techs[0].Level;
|
||||
this._playerAttributes.money += GameManager.SolarSystems[i].GetComponent<SolarSystemManager>().GetMoney(playerID) * _scienceManager.techs[1].Level;
|
||||
this._playerAttributes.science += GameManager.SolarSystems[i].GetComponent<SolarSystemManager>().GetScience(playerID) * _scienceManager.techs[2].Level;
|
||||
|
||||
GameManager.SolarSystems[i].GetComponent<SolarSystemManager>().UpdateFood(playerID, _scienceManager.techs[3].Level);
|
||||
this._playerAttributes.food += GameManager.SolarSystems[i].GetComponent<SolarSystemManager>().GetFood(playerID);
|
||||
this._playerAttributes.population += GameManager.SolarSystems[i].GetComponent<SolarSystemManager>().GetPopulation(playerID);
|
||||
this._playerAttributes.actualFood += GameManager.SolarSystems[i].GetComponent<SolarSystemManager>().GetActualFood(playerID);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//if (starSystems != null)
|
||||
//{
|
||||
// Add resources for each part of each starSystem which belongs to this player
|
||||
@@ -78,11 +107,10 @@ public class PlayerManager
|
||||
// this._playerAttributes.power += ((StarSystem)starSystem).getPower(playerID);
|
||||
// this._playerAttributes.food += ((StarSystem)starSystem).getFood(playerID);
|
||||
// this._playerAttributes.industrialCapacity += ((StarSystem)starSystem).getIC(playerID);
|
||||
this._playerAttributes.science += 5;
|
||||
_scienceManager.UpdateScience(this._playerAttributes.science);
|
||||
this._playerAttributes.science = _scienceManager.PublicScienceAcumulated;
|
||||
//}
|
||||
//}
|
||||
//this._playerAttributes.science += 5 * _scienceManager.techs[2].Level;
|
||||
//_scienceManager.UpdateScience(this._playerAttributes.science);
|
||||
//this._playerAttributes.science = _scienceManager.PublicScienceAcumulated;
|
||||
|
||||
}
|
||||
|
||||
// Deletes overhanded referrence from fleets list
|
||||
|
||||
Reference in New Issue
Block a user