示例#1
0
        public void AddObject(WorldObject obj)
        {
            this.allObjects.Add(obj);

            IControllable objAsControllable = obj as IControllable;

            if (objAsControllable != null)
            {
                this.controllables.Add(objAsControllable);
            }

            IResource objAsResource = obj as IResource;

            if (objAsResource != null)
            {
                this.resources.Add(objAsResource);
            }

            IGatherer objAsGatherer = obj as IGatherer;

            if (objAsGatherer != null)
            {
                this.gatherers.Add(objAsGatherer);
            }

            IFighter objAsFighter = obj as IFighter;

            if (objAsFighter != null)
            {
                this.fighters.Add(objAsFighter);
            }
        }
示例#2
0
        public void ReadyData(Func <int, ICollection <string>, IGatherer> creator)
        {
            List <string> stockNames = new List <string>(new string[] { "AAPL", "MSFT", "GOOG" });

            results               = new List <string[]>();
            gatherer              = creator(300, stockNames);
            gatherer.DataUpdated += Gatherer_DataUpdated;
        }
示例#3
0
        private void HandleGathering(IGatherer gatherer, IResource resource)
        {
            bool gatheringSuccess = gatherer.TryGather(resource);

            if (gatheringSuccess)
            {
                Console.WriteLine("{0} gathered {1} {2} from {3}", gatherer, resource.Quantity, resource.Type, resource);
                resource.HitPoints = 0;
            }
        }
        public override bool CheckComponents()
        {
            if (movement == null || gatherer == null)
            {
                movement = GetAbility <IMovement>();
                gatherer = GetAbility <IGatherer>();
            }

            return(movement != null && gatherer != null);
        }
        public bool AddGatherer(IGatherer gatherer)
        {
            var numGatherers = gatherers.Count;

            if (numGatherers >= maxGatherers)
            {
                return(false);
            }
            if (numResources < 1 + numGatherers)
            {
                return(false);
            }
            gatherers.Add(gatherer);
            return(true);
        }
示例#6
0
 private void HandleGathering(IGatherer gatherer, IResource resource)
 {
     bool gatheringSuccess = gatherer.TryGather(resource);
     if (gatheringSuccess)
     {
         Console.WriteLine("{0} gathered {1} {2} from {3}", gatherer, resource.Quantity, resource.Type, resource);
         resource.HitPoints = 0;
     }
 }
 public Notifier(ActDbContext ctx, IGatherer gatherer, ILoggerFactory logger)
 {
     _logger   = logger.CreateLogger <Notifier>();
     _ctx      = ctx;
     _gatherer = gatherer;
 }
示例#8
0
 public NodesController(INodeFactory nodeFactory, ISpecificationFactory <AppSpecInformation, AppSpecSearchResult> appSpecificationFactory, IGatherer gatherer, ILoggerFactory logger) : base(logger)
 {
     _nodeFactory             = nodeFactory;
     _appSpecificationFactory = appSpecificationFactory;
     _gatherer = gatherer;
 }
 public void RemoveGatherer(IGatherer gatherer)
 {
     gatherers.Remove(gatherer);
 }
示例#10
0
 public void RemoveData()
 {
     gatherer.DataUpdated -= Gatherer_DataUpdated;
     gatherer              = null;
     results = null;
 }
示例#11
0
 public GatherState(IAIAgent <AIAttributes, object> agent, IGatherer gatherer) : base(agent)
 {
     this.gatherer = gatherer;
 }