public static List<GPoint> Generate (Grid g, int numOfTrees) { List<GPoint> trees = new List<GPoint> (); int i = 0; while (i < numOfTrees) { int rX = (int)Random.Range (g.GetXYMin ().x, g.GetXYMax ().x); int rY = (int)Random.Range (g.GetXYMin ().y, g.GetXYMax ().y); if (g.GetPoint (rX, rY).GetPType () == GPoint.PType.TILE_GRASS) { trees.Add (new GPoint (new Vector2 ((float)rX, (float)rY), GPoint.PType.TILE_TREE)); i++; } } return trees; }