Esempio n. 1
0
        void MainFormMouseUp(object sender, MouseEventArgs e)
        {
            Node n = graph.getNode(e.X / 10, e.Y / 10);
            Node k = graph.getNode(50, 50);

            if (build_tower)
            {
                g.FillEllipse(Brushes.Red, 50, 50, 20, 20);
                ICollection myCollection = ArrayList.Synchronized(things);
                BasicTower  t1           = new BasicTower(n, graph, 100, 100);

                t1.thinking();
                //t1.action();
                t1.draw(g);

                graph.disableNode(e.X / 10, e.Y / 10);
                lock (myCollection.SyncRoot) {
                    things.Add(t1);
                    Console.WriteLine(things.Count + "DELETE");
                }
                build_tower = false;
            }
            if (build_bug)
            {
                BasicCreature c1 = new BasicCreature(n, k, graph, 100, 100, world);
                build_bug = false;
                things.Add(c1);
                c1.draw(g);
            }

            world.setArray(things);
        }
Esempio n. 2
0
        void MainFormMouseUp(object sender, MouseEventArgs e)
        {
            if (graph.getHeight() <= e.Y / 15 ||
                graph.getWidth() <= e.X / 15
                )
            {
                return;
            }

            Node n = graph.getNode(e.X / 15, e.Y / 15);



            if (build_tower_basic || build_tower_multi)
            {
                ICollection      myCollection = ArrayList.Synchronized(things);
                BasicTower       t1;
                MultiTargetTower t2;

                if (build_tower_basic)
                {
                    t1 = new BasicTower(n, graph, 20, 100, world);
                    lock (myCollection.SyncRoot)
                    {
                        if (n.getTerrain() == 1 && n.isEnable()) // ak je teren stol
                        {
                            things.Add(t1);
                        }
                        else
                        {
                            Console.WriteLine("sem nemoze veza");
                        }
                    }
                    world.substractFromScore(100);
                }

                else
                {
                    t2 = new MultiTargetTower(n, graph, 20, 100, world);
                    lock (myCollection.SyncRoot)
                    {
                        if (n.getTerrain() == 1 && n.isEnable()) // ak je teren stol
                        {
                            things.Add(t2);
                        }
                        else
                        {
                            Console.WriteLine("sem nemoze veza");
                        }
                    }
                    world.substractFromScore(300);
                }

                graph.disableNode(e.X / 15, e.Y / 15);
                showActualScoreValue();
            }
        }