private void CreateApple(int percent) { if (Apples.Count < appleCount && rnd.Next(100) <= percent) { int x = rnd.Next(view.MapWidth - BlockSize); int y = rnd.Next(view.MapHeight - BlockSize); var apple = new AppleViewModel(x, y, 12, 12); if (Player != null) { if (Walls.Find(wall => IsCollision(wall, apple)) == null && IsCollision(Player, apple) == false) { Apples.Add(apple); } } else { if (Walls.Find(wall => IsCollision(wall, apple)) == null && IsCollision(reservePlayer, apple) == false) { Apples.Add(apple); } } } }
public ActionResult Index() { AppleViewModel model = new AppleViewModel() { BodyColor = Global.Apple.BodyColor, LeafColor = Global.Apple.LeafColor, StemColor = Global.Apple.StemColor, }; return(View(model)); }