Exemple #1
0
        void loadCommanders(List <int> commanderInt, List <Point> commanderPoint, List <String> commanderPath,
                            List <double> min, List <double> max, Player player)
        {
            int spaceX = 0;

            for (int i = 0; i < commanderInt.Count; i++)
            {
                if (commanderInt[i] == 1)
                {
                    commanderPic[i]        = new Image();
                    commanderPic[i].Source = UtilityMethods.LoadImageFullPath(commanderPath[i]);
                    commanderPic[i].Width  = 34;
                    commanderPic[i].Height = 26;
                    canvas.Children.Add(commanderPic[i]);
                    Canvas.SetLeft(commanderPic[i], commanderPoint[i].X + spaceX);
                    Canvas.SetTop(commanderPic[i], commanderPoint[i].Y);
                    spaceX += 90;
                    Point commanderPos = new Point();
                    commanderPos.X = commanderPoint[i].X;
                    commanderPos.Y = commanderPoint[i].Y;
                    Animation commanderAnimation = new Animation(commanderPic[i], commanderImages, true);
                    Commander commander          = new Commander(commanderPos, commanderPic[i], canvas, commanderAnimation);
                    commander.setMaxX(max[i]);
                    commander.setMinX(min[i]);
                    commanders.Add(commander);
                    enemies.Add(commanders[i]);
                    commanders[i].setTarget(player);
                    commanders[i].Fly(200);
                    arr2.Add(i);
                }
            }
        }