示例#1
0
 public DataView(PackmanController pc)
 {
     InitializeComponent();
     Pc          = pc;
     tanksAmount = pc.NewGameSettings.TanksAmount;
     //KolobokLabel.Hide();
     //CenterToScreen();
     //Location = new Point(pc.mainscreen.Location.X , pc.mainscreen.Location.Y);
     //Location = new Point(pc.mainscreen.Location.X + pc.mainscreen.Width, 0);
 }
示例#2
0
 public void UpdateValues(PackmanController pc)
 {
     Pc          = pc;
     tanksAmount = pc.NewGameSettings.TanksAmount;
     Refresh();
     try
     {
         Labels.Clear();
         CoordinatesX.Clear();
         CoordinatesY.Clear();
     }
     catch (Exception)
     {
     }
 }
示例#3
0
        //Kolobok kolobok;
        //Tank tank;
        //List<Tank> tanks = new List<Tank>();
        //int enemySpawnLeft = GameSettings.tanksAmount;
        //int timerCounter = 0;
        //List<Obstacle> mapObstacles;



        public MainScreen()
        {
            InitializeComponent();
            packmancontroller = new PackmanController(this);
            packmancontroller.AddRequiredElements();
            packmancontroller.GameArea.Paint += GameArea_Paint;
            packmancontroller.DrawTimer.Tick += UpdateScreen;
            //CreateBitmapAtRuntime();
            //kolobok = new Kolobok(GameSettings.areaWidth, GameSettings.areaHeight);
            //kolobok = KolobokView.SpawnKolobok();
            //for (int i = 0; i < GameSettings.tanksAmount; i++)
            //{

            //    tanks.Add(new Tank(i));
            //    enemySpawnLeft--;
            //}

            // TankView.SpawnTank(tanks, timerCounter, enemySpawnLeft);
            //mapObstacles = GameSettings.GenerateObstacles(GameSettings.map);
        }
示例#4
0
        public void HandleApplesCollision(List <Apple> apples, Kolobok kolobok, PackmanController pc)
        {
            foreach (var apple in apples)
            {
                if (this.ObjectCollision(apple, kolobok))
                {
                    pc.Scores++;
                    Obstacle place;
                    bool     found = false;
                    Random   r     = new Random();

                    do
                    {
                        place = pc.EmptyPlaces.ElementAt(r.Next(pc.EmptyPlaces.Count));
                        if (pc.CheckApplePlace(place))
                        {
                            apple.X = place.X;
                            apple.Y = place.Y;
                            found   = true;
                        }
                    } while (!found);
                }
            }
        }