コード例 #1
0
        public static void SetEntityCost(EntityCost cost, String displayName = "")
        {
            if (String.IsNullOrEmpty(cost.Internal_Name))
            {
                throw new InvalidOperationException("EntityCost requires an internal name");
            }

            if (String.IsNullOrEmpty(displayName))
            {
                displayName = cost.Name;
            }

            cost.Name = displayName;
            _TranslateTable[cost.Internal_Name] = cost;
        }
コード例 #2
0
        public int GetResourceRequirements(String type, String resource)
        {
            if (String.IsNullOrEmpty(type) || String.IsNullOrEmpty(resource))
            {
                return(0);
            }

            EntityCost cost = GetEntityCost(type);

            if (cost != null)
            {
                return(cost.GetCost(resource));
            }

            UnityEngine.Debug.LogWarning("Resource requirement not defined: " + type);
            return(0);
        }