Example #1
0
        public void placePeaces()
        {
            for (i = 0; i < 12; i++)
                for (j = 0; j < 12; j++)
                {
                    switch (table[i, j])
                    {

                        case 1: play2[i, j] = new Enemy();
                            play[i, j].BackgroundImage = play2[i, j].Image;

                            break;



                        case 2: 
                                
                                break;
                   



                        case 3: play2[i, j] = new Hero(table[i, j]);
                                play[i, j].BackgroundImage = play2[i, j].Image;
                            break;
                        case 4: play2[i, j] = new Hero(table[i, j]);
                                play[i, j].BackgroundImage = play2[i, j].Image;
                            break;
                        case 5: play2[i,j] = new Hero(table[i,j]);
                            play[i, j].BackgroundImage = play2[i, j].Image;
                            break;
                        default: break;
                    }
                }
        }
Example #2
0
        static void Main(string[] args)
        {

            Enemy[] enemies = new Enemy[2]; //创建一个数组,包括两个Enemy基类
            enemies[0] = new Enemy();       //创建一个Enemy, 执行Enemy的构造函数
            enemies[1] = new Boss();        //创建一个Boss,先执行Enemy的构造函数,再执行Boss的

            for (int i = 0; i < 2; i++)
            {
                // enemies[0]会调用Enemy类的UpdateAI
                // enemies[1]会调用Boss类的UpdateAI
                enemies[i].UpdateAI();
            }

            // 输入任意键退出
            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            List<IAttack> fighters = new List<IAttack>();
            List<Stats> info = new List<Stats>();

            for (int i = 0; i < 2; i++)
            {
                Player player = new Player();
                Enemy enemy = new Enemy();
                fighters.Add(player);
                fighters.Add(enemy);
            }
            for (int i = 0; i < 2; i++)
            {
                Player player = new Player();
                Enemy enemy = new Enemy();

            }
            for (int a = 0; a < 1; a++)
            foreach (IAttack i in fighters)
            {
                i.attack();
            }
            foreach (Stats a in fighters)
            {
                a.stats();
            }

            Console.ReadLine();
        }
Example #4
0
        public void design_and_place()
        {
            
            int i, j;

            for (i = 0; i < 12; i++)
                for (j = 0; j < 12; j++)
                {
                    string value = Convert.ToString(i, 16);
                    string value2 = Convert.ToString(j, 16);
                    string value3 = value + value2;

                     
                    
                    switch (table[i, j])
                    {

                        case 1 :   play2[i,j] =  new Enemy(i,j);
                                   play[i, j].BackgroundImage = play2[i, j].Image;
                                   
                                   break;

                        case 2:    play2[i, j] = new Terrain();
                                   play[i,j].BackgroundImage = play2[i,j].getImage(table[i,j]);
                                                                  
                                   break;


                        
                        case 3:    play2[i,j] =  new Hero();
                                   play[i, j].BackgroundImage = play2[i,j].Image; 
                                   break;
                        default: break; 
                    }
                }


            

         

        }