Exemplo n.º 1
0
    public void OnAgentAdded(SimAgent agent)
    {
        GameObject goAgent = new GameObject();

        goAgent.transform.parent = agentsContainer;
        SimAgentUnity agentUnity = goAgent.AddComponent <SimAgentUnity>();

        agentUnity.Init(agent);

        agentsUnity.Add(agentUnity);
    }
Exemplo n.º 2
0
    public SimAgent AddAgent(SimAgentType agentType, SimPoint position, SimUnit owner, SimResourceBinCollection resources, string searchTarget)
    {
        SimAgent agent = new SimAgent();

        agent.Init(agentType, nextAgentId++, position, owner, resources, searchTarget);

        agents.Add(agent);

        boxListener.OnAgentAdded(agent);

        return(agent);
    }
Exemplo n.º 3
0
 public void OnAgentRemoved(SimAgent agent)
 {
     for (int i = 0; i < agentsUnity.Count; i++)
     {
         if (agentsUnity[i].agent == agent)
         {
             GameObject.Destroy(agentsUnity[i].gameObject);
             agentsUnity.RemoveAt(i);
             break;
         }
     }
 }
    public void Init(SimAgent agent)
    {
        this.agent = agent;

        gameObject.name = agent.agentType.id + "-" + agent.id;

        transform.localPosition = agent.worldPosition;

        sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere).transform;

        sphere.parent        = transform;
        sphere.localPosition = Vector3.zero;

        Material unitMaterial = MaterialsFactory.CreateDiffuseColor(agent.agentType.color);

        sphere.renderer.sharedMaterial = unitMaterial;
    }
Exemplo n.º 5
0
    public void RemoveAgent(SimAgent agent)
    {
        agents.Remove(agent);

        boxListener.OnAgentRemoved(agent);
    }
 public void OnAgentRemoved(SimAgent agent)
 {
 }
 public void OnAgentAdded(SimAgent agent)
 {
 }