예제 #1
0
        private void mayorObject_OnRecallLumberjacks(Object sender)
        {
            var result = from target in this.listOfResources
                         where (target.CanExtractResources && target.resourceType == CellState.Tree)
                         select target;

            if (result.Count() > 0)
            {
                ResourceBase r = result.ElementAt(0);
                r.CanExtractResources = false;
                this.mayorObject.ReleaseLumberjacks(r.GetNeededWorkers());
            }
        }
예제 #2
0
        private void resource_OnDepositsWorkedOut(Object o)
        {
            ResourceBase resource = o as ResourceBase;

            this.listOfResources.Remove(resource);
            if (resource.resourceType == CellState.Tree)
            {
                this.mayorObject.ReleaseLumberjacks(resource.GetNeededWorkers());
            }
            else if (resource.resourceType == CellState.Stone)
            {
                this.mayorObject.ReleaseMiners(resource.GetNeededWorkers());
            }
        }
예제 #3
0
        private void mayorObject_OnAddLumberjacks(Object sender)
        {
            var result = from target in this.listOfResources
                         where (!target.CanExtractResources && target.IsDepreserved() &&
                                target.resourceType == CellState.Tree)
                         select target;

            if (result.Count() > 0)
            {
                ResourceBase r       = result.ElementAt(0);
                Int16        workers = r.GetNeededWorkers();
                if (!this.CheckWorkers(workers, CellState.Tree, true))
                {
                    return;
                }
                r.CanExtractResources = true;
            }
        }