public static void Game_InFo_UpDate(Snake_Info snake, Game_Info info, Food_Info food, Obstacle_Info oe_indo)//游戏信息更新 { X_Y_K xyz; xyz = (X_Y_K)Snake_AL[0]; //bmp_id:0 dot树 1 crossbar草丛 2cross山 3around海 //XYAround 0左上,1右上,2左下,3为右下 if (Coordinate_date[1, xyz.X, xyz.Y] != -1) //判断是否碰到障碍物 { if (Coordinate_date[1, xyz.X, xyz.Y] == (int)oe_indo.Bmp_ID[0]) { snake.PH = snake.PH - 10; } else if (Coordinate_date[1, xyz.X, xyz.Y] == (int)oe_indo.Bmp_ID[1]) { snake.PH = snake.PH - 20; } else if (Coordinate_date[1, xyz.X, xyz.Y] == (int)oe_indo.Bmp_ID[2]) { snake.PH = snake.PH - 15; } else if (Coordinate_date[1, xyz.X, xyz.Y] == (int)oe_indo.Bmp_ID[3]) { snake.PH = snake.PH - 30; } } if (Coordinate_date[2, xyz.X, xyz.Y] != -1)//判断是否碰到蛇身 { snake.PH = snake.PH - 5; } if (Coordinate_date[3, xyz.X, xyz.Y] != -1) //判断是吃到食物 { Coordinate_date[3, xyz.X, xyz.Y] = -1; food.Need_Add(); info.Game_Mark++; snake.WaitAdd_Body++; snake.PH = snake.PH + 1; } }
public static void Food_Co_MakeUp(Food_Info food)//食物坐标化 { if (food.If_Need_AddFood()) { bool flag; for (int i = 0; i < food.Wait_Add_Food; i++) { flag = true; Random ran = new Random();//实例一个随机 while (flag) { int x = ran.Next(0, M_x); int y = ran.Next(0, M_y); if (Coordinate_date[1, x, y] == -1 && Coordinate_date[2, x, y] == -1 && Coordinate_date[3, x, y] == -1) { Coordinate_date[3, x, y] = food.Food_ID; flag = false; } } } } food.Add_NewFood_Finish(); }
public void Update(Food_Info obj) { DbSet.Update(obj); }
public void Add(Food_Info obj) { DbSet.Add(obj); }
public Food_Info GetInfoByFoodId(int id) { Food_Info food_Info = DbSet.Single(uid => uid.Id.Equals(id)); return(food_Info); }