Exemple #1
0
        public ActorAgent(IActorRef actorTextOutput, Agent ag, IActorRef actorSolarSystem)
        {
            _actorTextOutput = actorTextOutput;
            _actorSolarSystem = actorSolarSystem;
            _agent = ag;
            _tickCompleteCmd = new MessageEngineAgCompletedCommand(_agent.AgentId);

            AgentControllerState stateForAgent = new AgentControllerState(ag);

            switch(_agent.Type)
            {
                //case AgentTypeEnum.Trader:
                //    _agentC = new AgentTraderController(ag, _actorTextOutput);
                //    break;
                default:
                    _agentC = new AgentDefaultController(stateForAgent, _actorTextOutput);
                    break;
            }

            Receive<MessageTick>(msg => receiveDefaultTick(msg));
            Receive<MessageShipResponse>(msg => receiveShipResponse(msg));
            Receive<MessageAgentDestinationReached>(msg => receiveShipDestinationReached(msg));
        }
 public MessageRequestResources(List<ResourceQuantity> resourcesRequested, Agent owner, Int64 tickSent)
 {
     ResourcesRequested = resourcesRequested;
     Owner = owner;
     TickSent = tickSent;
 }
        private void addNewCargoStoreToShip(Ship ship, Agent o)
        {
            Store s = new Store();
            s.Owner = o;
            s.Location = ship;
            ship.Stores.Add(o.AgentId,s);
            o.Stores.Add(s);

            // seed with basic starter resource
            s.StoredResources.Add(ResourceTypeEnum.Spice, 10);
        }
 private Agent GetAgent(String seedName)
 {
     Agent ag = new Agent();
     ag.Memory = "";
     ag.Account = getAccount();
     ag.Account.Owner = ag;
     ag.Name = seedName;
     return ag;
 }
 private void addProducersToPlanet(Agent ag, Planet p)
 {
     addNewStoreToPlanet(p, ag);
     Producer prod = this.GetProducer("Factory Metal", BluePrintEnum.SpiceToPlatinum);
     prod.Owner = ag;
     ag.Producers.Add(prod);
     Producer prod2 = this.GetProducer("Factory Spice", BluePrintEnum.PlatinumToSpice);
     prod2.Owner = ag;
     ag.Producers.Add(prod2);
     p.Producers.Add(prod);
     p.Producers.Add(prod2);
 }
        private void addNewStoreToPlanet(Planet p, Agent o)
        {
            Store s = new Store();
            s.Owner = o;
            s.Location = p;
            p.Stores.Add(o.AgentId,s);
            o.Stores.Add(s);

             // seed with basic starter resource
            s.StoredResources.Add(ResourceTypeEnum.Spice, 100);
            s.StoredResources.Add(ResourceTypeEnum.Platinum, 100);
        }
 public AgentControllerState(Agent ag)
 {
     _model = ag;
 }
 public MessageProducedResources(List<ResourceQuantity> resources, Agent owner)
 {
     Resources = resources;
     Owner = owner;
 }
 private Store getStoreForOwner(Agent owner)
 {
     return _model.Stores[owner.AgentId];
 }
 private Store getOrCreateStoreForOwner(Agent owner)
 {
     Store s = getStoreForOwner(owner);
     if (s == null)
     {
         s = new Store();
         s.Location = _model;
         s.Owner = owner;
         _model.Stores.Add(owner.AgentId, s);
     }
     return s;
 }