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); } }
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; }
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); }
public Notifier(ActDbContext ctx, IGatherer gatherer, ILoggerFactory logger) { _logger = logger.CreateLogger <Notifier>(); _ctx = ctx; _gatherer = gatherer; }
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); }
public void RemoveData() { gatherer.DataUpdated -= Gatherer_DataUpdated; gatherer = null; results = null; }
public GatherState(IAIAgent <AIAttributes, object> agent, IGatherer gatherer) : base(agent) { this.gatherer = gatherer; }