示例#1
0
 public void UtilizeResources(ResourceTotality res)
 {
     if (!CheckResources(res))
     {
         throw new Exception();
     }
     resources = Resources - res;
 }
示例#2
0
        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);
        }
示例#3
0
 public bool CheckResources(ResourceTotality res)
 {
     if (Resources >= res)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#4
0
        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);
        }
示例#5
0
 public GameState()
 {
     Resources      = new ResourceTotality();
     ResourceLimits = new ResourceTotality();
     GameObjects    = new GameObject[0];
 }