コード例 #1
0
        internal override void Execute()
        {
            Level    Level    = this.Device.GameMode.Level;
            Building Building = (Building)Level.GameObjectManager.Filter.GetGameObjectById(this.BuildingId);

            if (Building != null)
            {
                if (Globals.CollectAllResourcesAtOnce)
                {
                    List <GameObject> Buildings = Level.GameObjectManager.Filter.GetGameObjectsByData(Building.Data);

                    for (int i = 0; i < Buildings.Count; i++)
                    {
                        Building building = (Building)Buildings[i];

                        if (!building.Constructing)
                        {
                            ResourceProductionComponent ResourceProductionComponent = building.ResourceProductionComponent;

                            ResourceProductionComponent?.CollectResources();
                        }
                    }
                }
                else
                {
                    ResourceProductionComponent ResourceProductionComponent = Building.ResourceProductionComponent;

                    ResourceProductionComponent?.CollectResources();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Executes this instance.
        /// </summary>
        internal override void Execute(Level Level)
        {
            Building Building = (Building)Level.GameObjectManager.Filter.GetGameObjectById(this.Id);

            if (Building != null)
            {
                if (Globals.CollectAllResourcesAtOnce)
                {
                    List <GameObject> Buildings = Level.GameObjectManager.Filter.GetGameObjectsByData(Building.Data);

                    Buildings.ForEach(GameObject =>
                    {
                        Building building = (Building)GameObject;

                        if (!building.Constructing)
                        {
                            ResourceProductionComponent ResourceProductionComponent = building.ResourceProductionComponent;

                            if (ResourceProductionComponent != null)
                            {
                                ResourceProductionComponent.CollectResources();
                            }
                        }
                    });
                }
                else
                {
                    ResourceProductionComponent ResourceProductionComponent = Building.ResourceProductionComponent;

                    if (ResourceProductionComponent != null)
                    {
                        ResourceProductionComponent.CollectResources();
                    }
                }
            }
        }