private void CreateTank(int percent)
        {
            if (Tanks.Count < tankCount && rnd.Next(100) <= percent)
            {
                int x    = rnd.Next(view.MapWidth - BlockSize);
                int y    = rnd.Next(view.MapHeight - BlockSize);
                var tank = new TankViewModel(x, y, 16, 16, (Direction)rnd.Next(4));

                if (Player != null)
                {
                    if (Walls.Find(wall => IsCollision(wall, tank)) == null &&
                        IsCollision(Player, tank) == false &&
                        Tanks.Find(tnk => tnk != tank ? IsCollision(tnk, tank) : false) == null)
                    {
                        Tanks.Add(tank);
                    }
                }
                else
                {
                    if (Walls.Find(wall => IsCollision(wall, tank)) == null &&
                        IsCollision(reservePlayer, tank) == false &&
                        Tanks.Find(tnk => tnk != tank ? IsCollision(tnk, tank) : false) == null)
                    {
                        Tanks.Add(tank);
                    }
                }
            }
        }
        private void Collision(float dt)
        {
            var delWalls   = new List <WallViewModel>();
            var delTanks   = new List <TankViewModel>();
            var delApples  = new List <AppleViewModel>();
            var delBullets = new List <BulletViewModel>();

            if (IsGame)
            {
                DynamicEntity player = Player.Clone() as DynamicEntity;
                player.Move(dt);

                if (ObjectInScreen(player) &&
                    Rivers.Find(river => IsCollision(river, player)) == null &&
                    Walls.Find(wall => IsCollision(wall, player)) == null)
                {
                    bool isFree = true;

                    foreach (var tank in Tanks)
                    {
                        if (IsCollision(tank, player))
                        {
                            isFree = false;
                            CreateBang(player);
                            GameOver();
                        }
                    }

                    if (isFree)
                    {
                        Player.Move(dt);
                    }
                }

                Apples.ForEach(apple =>
                {
                    if (IsCollision(player, apple))
                    {
                        delApples.Add(apple);
                        Score++;
                    }
                });
            }

            Tanks.ForEach(t =>
            {
                t.Move(dt);
                if (!ObjectInScreen(t) ||
                    Walls.Find(wall => IsCollision(wall, t)) != null ||
                    Rivers.Find(river => IsCollision(river, t)) != null ||
                    Tanks.Find(tnk => tnk != t ? IsCollision(tnk, t) : false) != null)
                {
                    t.ChangeDirection();
                    t.Move(dt);
                }
            });

            Bullets.ForEach(bullet =>
            {
                bool delBullet = false;

                if (!ObjectInScreen(bullet))
                {
                    delBullet = true;
                }

                Walls.ForEach(wall =>
                {
                    if (IsCollision(bullet, wall))
                    {
                        if (wall.Destroyable)
                        {
                            delWalls.Add(wall);
                        }
                        delBullet = true;
                        CreateBang(bullet);
                    }
                });

                Tanks.ForEach(tank =>
                {
                    if (IsCollision(tank, bullet) && bullet.Shooter != tank)
                    {
                        delBullet = true;
                        delTanks.Add(tank);
                        CreateBang(tank);
                    }
                });

                if (IsGame)
                {
                    if (IsCollision(bullet, Player) && bullet.Shooter != Player)
                    {
                        delBullet = true;
                        CreateBang(Player);
                        GameOver();
                    }
                }

                if (delBullet)
                {
                    delBullets.Add(bullet);
                }
                else
                {
                    bullet.Move(dt);
                }
            });

            delWalls.ForEach(wall => Walls.Remove(wall));
            delTanks.ForEach(tank => Tanks.Remove(tank));
            delApples.ForEach(apple => Apples.Remove(apple));
            delBullets.ForEach(bullet => Bullets.Remove(bullet));
        }