public void UtilizeResources(ResourceTotality res) { if (!CheckResources(res)) { throw new Exception(); } resources = Resources - res; }
public static ResourceTotality operator +(ResourceTotality a, ResourceTotality b) { ResourceTotality res = new ResourceTotality(); foreach (var r in Enum.GetValues(typeof(ResourceType)).Cast <ResourceType>()) { res[r] = a[r] + b[r]; } return(res); }
public bool CheckResources(ResourceTotality res) { if (Resources >= res) { return(true); } else { return(false); } }
public Player(Game game, int id, PlayerController controller) { this.id = id; resources = new ResourceTotality(); resourceLimits = new ResourceTotality(); ownedObjects = new Dictionary <int, GameObject>(); this.controller = controller; this.game = game; Resources.AddAll(10); }
public GameState() { Resources = new ResourceTotality(); ResourceLimits = new ResourceTotality(); GameObjects = new GameObject[0]; }