Пример #1
0
 public void SpawnKolobok()
 {
     if (KolobokMain == null)
     {
         KolobokMain = new Kolobok(NewGameSettings);
         Kolobokview = new KolobokView(KolobokMain, Tanks);
         Tankview    = new TankView(KolobokMain, Tanks);
     }
 }
Пример #2
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);
                }
            }
        }
Пример #3
0
        public void StartGame(Button button)
        {
            Dataview = new DataView(this);
            Dataview.Show();
            Mainscreen.Focus();
            SetSettings();
            CollisionsCheck = new Collisions(NewGameSettings);
            Level           = NewGameSettings.GenerateMap();
            Mapview         = new MapView(Level);

            Scores = 0;
            Apples.Clear();

            button.Hide();
            DrawTimer.Start();
            GameArea.Show();
            var settingsButton = Mainscreen.Controls.Find("SettingsButton", true);

            HideSettings((Button)settingsButton[0]);
            settingsButton[0].Hide();

            KolobokMain = null;
            Tanks.Clear();
        }
Пример #4
0
 public KolobokView(Kolobok _kolobok, List <Tank> _tanks)
 {
     KolobokMain = _kolobok;
     Tanks       = _tanks;
 }
Пример #5
0
 public bool ObjectCollision(Apple apple, Kolobok kolobok)
 {
     return(Rectangle.Intersect(apple.Bounds(), kolobok.Bounds()) != Rectangle.Empty);
 }
Пример #6
0
 public bool ObjectCollision(Tank tank, Kolobok kolobok)
 {
     return(Rectangle.Intersect(tank.Bounds(), kolobok.Bounds()) != Rectangle.Empty);
 }
Пример #7
0
 public bool ObjectCollision(Bullet bullet, Kolobok kolobok)
 {
     return(Rectangle.Intersect(bullet.Bounds(), kolobok.Bounds()) != Rectangle.Empty);
 }
Пример #8
0
 public bool NoBorderCollision(Kolobok kolobok)
 {
     return(gameArea.Contains(kolobok.Bounds()));
 }