コード例 #1
0
        public double GetFullMassOverBase(int currentStage, HashSet <int> resourceTypes)
        {
            if (decoupledInStage >= currentStage)
            {
                return(0);
            }

            double mass = 0;

            for (int i = 0; i < maxResources.Types.Count; i++)
            {
                foreach (int type in resourceTypes)
                {
                    if (type == maxResources.Types[i])
                    {
                        if (maxResources.HasType(type) && maxResources[type] > SimManager.RESOURCE_PART_EMPTY_THRESH)
                        {
                            mass += maxResources.GetResourceMass(type);
                        }

                        if (resources.HasType(type) && resources[type] > SimManager.RESOURCE_PART_EMPTY_THRESH)
                        {
                            mass -= resources.GetResourceMass(type);
                        }

                        break;
                    }
                }
            }

            return(mass);
        }
コード例 #2
0
        public bool EmptyOf(HashSet <int> types)
        {
            foreach (int type in types)
            {
                if (resources.HasType(type) && resourceFlowStates[type] != 0 && resources[type] > SimManager.RESOURCE_PART_EMPTY_THRESH)
                {
                    return(false);
                }
            }

            return(true);
        }