Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Comienza la demo");
            Agent1 ag1 = new Agent1();
            Agent2 ag2 = new Agent2();

            Task tsk  = ag1.Run();
            Task tsk2 = ag2.Run();


            Message msg1 = new Message()
            {
                Count   = 5.0M,
                Incremt = 2.0M,
                Price   = 4.0M,
                Text    = "Manzanas"
            };

            Message msg2 = new Message()
            {
                Count   = 3.0M,
                Incremt = 4.0M,
                Price   = 3.5M,
                Text    = "Naranjas"
            };

            ag1.Input.Enqueue(msg1);
            ag2.Input.Enqueue(msg1);
            ag1.Input.Enqueue(msg2);
            ag2.Input.Enqueue(msg2);

            Console.WriteLine("Fin de la demo");

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Agent1     agent1     = new Agent1();
            Agent2     agent2     = new Agent2();
            Agent3     agent3     = new Agent3();
            Product1   product1   = new Product1();
            Product2   product2   = new Product2();
            Management management = new Management();

            management._agents.Add(agent1);
            management._agents.Add(agent2);
            management._agents.Add(agent3);
            management._products.Add(product1);
            management._products.Add(product2);
        }
    // Update is called once per frame
    void Update()
    {
        if (Time.time > 15)
        {
            if (Time.time > i)
            {
                Agent aM1 = Agent1.GetComponent <Agent>();
                aM1.id = Random.Range(0, 4);
                Agent aM2 = Agent2.GetComponent <Agent>();
                aM2.id = Random.Range(5, 10);
                Agent aM3 = Agent3.GetComponent <Agent>();
                aM3.id = Random.Range(11, 15);

                //PathManager pM2 = Agent2.GetComponent<PathManager>();
                //pM2.goal.x = Random.Range(-3, 3);
                //pM2.goal.y = Random.Range(-11, -15);
                //Agent aM2 = Agent1.GetComponent<Agent>();
                //aM2.id = Random.Range(5, 10);

                //PathManager pM2 = Agent2.GetComponent<PathManager>();
                //pM2.goal.x = Random.Range(-3, 3);
                //pM2.goal.y = Random.Range(-11, -15);

                //PathManager pM3 = Agent3.GetComponent<PathManager>();
                //pM3.goal.x = Random.Range(-3, 3);
                //pM3.goal.y = Random.Range(-11, -15);

                i += 15;


                Instantiate(Agent1, agentSpawn1.transform.position, Quaternion.identity);
                Instantiate(Agent2, agentSpawn2.transform.position, Quaternion.identity);
                Instantiate(Agent3, agentSpawn3.transform.position, Quaternion.identity);
            }
        }
    }