public void SetVislble(bool visible) { isVisible = visible; if (isVisible) { playerVisibility = GetComponent <PlayerVisibility>(); foreach (Empire empire in empires) { playerVisibility.AddEmpire(empire); foreach (SolarSystem system in empire.GetSystems()) { if (system.GetComponent <PlayerBuildingController>().GetPlayerSpyNetwork(this)) { playerVisibility.AddObject(system.gameObject); } } } foreach (GameObject agent in agents) { playerVisibility.AddObject(agent); } foreach (PlayerBase playerBase in playerBases) { playerVisibility.AddObject(playerBase.gameObject); } } else { playerVisibility = null; } }
public void AddPlayerBase(PlayerBase playerBase) { playerBases.Add(playerBase); if (isVisible) { playerVisibility.AddObject(playerBase.gameObject); } }