Exemplo n.º 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));
        }
Exemplo n.º 2
0
 public MessageRequestResources(List<ResourceQuantity> resourcesRequested, Agent owner, Int64 tickSent)
 {
     ResourcesRequested = resourcesRequested;
     Owner = owner;
     TickSent = tickSent;
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 private Agent GetAgent(String seedName)
 {
     Agent ag = new Agent();
     ag.Memory = "";
     ag.Account = getAccount();
     ag.Account.Owner = ag;
     ag.Name = seedName;
     return ag;
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 public AgentControllerState(Agent ag)
 {
     _model = ag;
 }
 public MessageProducedResources(List<ResourceQuantity> resources, Agent owner)
 {
     Resources = resources;
     Owner = owner;
 }
Exemplo n.º 9
0
 private Store getStoreForOwner(Agent owner)
 {
     return _model.Stores[owner.AgentId];
 }
Exemplo n.º 10
0
 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;
 }