コード例 #1
0
 public bool CheckResources(ResourceStack st)
 {
     return(CheckResources(new ResourceTotality().Add(st)));
 }
コード例 #2
0
        /// <summary>
        /// Adds stack to player resources, considering limits.
        /// </summary>
        /// <param name="stack">Stack to add to player resources</param>
        /// <returns>Not used resources, that does not fit to limits</returns>
        public ResourceStack AddResource(ResourceStack stack)
        {
            int c = GetResource(stack.Type);

            return(new ResourceStack(stack.Type, stack.Count - (SetResource(stack.Type, c + stack.Count) - c)));
        }
コード例 #3
0
 public ResourceTotality Add(ResourceStack s)
 {
     this[s.Type] += s.Count;
     return(this);
 }