public void SpawnKolobok() { if (KolobokMain == null) { KolobokMain = new Kolobok(NewGameSettings); Kolobokview = new KolobokView(KolobokMain, Tanks); Tankview = new TankView(KolobokMain, Tanks); } }
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); } } }
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(); }
public KolobokView(Kolobok _kolobok, List <Tank> _tanks) { KolobokMain = _kolobok; Tanks = _tanks; }
public bool ObjectCollision(Apple apple, Kolobok kolobok) { return(Rectangle.Intersect(apple.Bounds(), kolobok.Bounds()) != Rectangle.Empty); }
public bool ObjectCollision(Tank tank, Kolobok kolobok) { return(Rectangle.Intersect(tank.Bounds(), kolobok.Bounds()) != Rectangle.Empty); }
public bool ObjectCollision(Bullet bullet, Kolobok kolobok) { return(Rectangle.Intersect(bullet.Bounds(), kolobok.Bounds()) != Rectangle.Empty); }
public bool NoBorderCollision(Kolobok kolobok) { return(gameArea.Contains(kolobok.Bounds())); }