Exemple #1
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="name"></param>
        /// <param name="parent"></param>
        protected AiState(string name, IAiAgent parent)
        {
            Validation.IsNotNullOrEmpty(name, "name");
            Validation.IsNotNull(parent, "parent");

            Name   = name;
            Parent = parent;
        }
 public ArtificialIntelligenceNhu(IEventAgent eventAgent, string id)
     : base(eventAgent, id)
 {
     ComponentService = new ComponentService();
     EventProcessor = new AiEventProcessor(ComponentService);
     OrientationService = new OrientationService(new Vector2(0,0),ComponentService);
     var productionManager = new ProductionManager(ComponentService, new ProductionFacilityProvider(ComponentService), OrientationService,eventAgent, id);
     HeatMapService = new HeatMapService(new HeatPortionCalculationService(),new Vector2(800,800));
     HeatMapService.Initialize();
     InfanteryMindStateService = new InfanteryMindStateService(EventProcessor as AiEventProcessor,HeatMapService,ComponentService);
     var movementService = new MovementService(ComponentService, EventAgent, OrientationService, InfanteryMindStateService,HeatMapService);
     Agent = new AiAgent(ComponentService, productionManager, movementService, InfanteryMindStateService, HeatMapService);
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="agent"></param>
        public void Unregister(IAiAgent agent)
        {
            Validation.IsNotNull(agent, "agent");

            _repository.Keys.Select(key => _repository.Get(key))
            .Where(entityList => entityList.Contains(agent))
            .ToList()
            .ForEach(entityList
                     =>
            {
                entityList.Remove(agent);
                OnAgentUnregistered?.Invoke(this, null);
            });
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="agent"></param>
        public void Register(IAiAgent agent)
        {
            Validation.IsNotNull(agent, "agent");

            var entities = _repository.Get(NextBucket);

            entities.Add(agent);

            NextBucket++;
            if (NextBucket > NumberBuckets)
            {
                NextBucket = 1;
            }

            OnAgentRegistered?.Invoke(this, null);
        }
Exemple #5
0
 public FakeAiState(string name, IAiAgent parent)
     : base(name, parent)
 {
 }
Exemple #6
0
 public AiFightState(IAiAgent parent, DictionaryAtom initAtom)
     : base("Fight", parent, initAtom)
 {
 }
 public AiChaseState(IAiAgent parent, DictionaryAtom initAtom)
     : base("Chase", parent, initAtom)
 {
 }
Exemple #8
0
 public AiDoNothingState(IAiAgent parent, DictionaryAtom initAtom)
     : base("DoNothing", parent, initAtom)
 {
 }
Exemple #9
0
 public AiWanderState(IAiAgent parent, DictionaryAtom initAtom)
     : base("Wander", parent, initAtom)
 {
 }
 public AiFleeState(IAiAgent parent, DictionaryAtom initAtom)
     : base("Flee", parent, initAtom)
 {
 }
Exemple #11
0
 public AiDeadState(IAiAgent parent, DictionaryAtom initAtom)
     : base("Dead", parent, initAtom)
 {
 }
 protected BaseAiState(string name, IAiAgent parent, DictionaryAtom initAtom)
     : base(name, parent)
 {
 }
Exemple #13
0
 public AiMoveToState(IAiAgent parent, DictionaryAtom initAtom)
     : base("MoveTo", parent, initAtom)
 {
 }
Exemple #14
0
 public AiPatrolState(IAiAgent parent, DictionaryAtom initAtom)
     : base("Patrol", parent, initAtom)
 {
 }