```csharp
usingSystem;usingUnityEngine;usingUnityEngine.UI;usingRandom=UnityEngine.Random;namespaceDefaultNamespace{publicclassCreatPlane:MonoBehaviour{privateint w =100;privateint h =100;privateVector3 posBoth = Vector3.one;privateint num =2;publicGameObject[] obj;//临时publicTransform SceneObjs;privatevoidStart(){VertexHelper vh =newVertexHelper();for(int x =0; x < w; x++){for(int z =0; z < h; z++){var y = Mathf.PerlinNoise(x *0.02f, z *0.02f);var uvx =(float) x /(float) w;var uvy =(float) z /(float) h;
vh.AddVert(newVector3(x, y *10, z), Color.white,newVector2(uvx, uvy));if(posBoth == Vector3.one){
posBoth =newVector3(x +2, y *10+0.5f, z +2);}if(Random.Range(0,1000)==99){var type = Random.Range(1,3);var temp =Instantiate(Resources.Load<GameObject>("SceneObj/"+ type),SceneObjs);
temp.transform.position =newVector3(x, y *10, z);
temp.AddComponent<SceneObj>().Init(type);}if(x != w -1&& z != h -1){
vh.AddTriangle(x * h + z, x * h + z +1,(x +1)* h + z +1);
vh.AddTriangle(x * h + z,(x +1)* h + z +1,(x +1)* h + z);}}}
StaticBatchingUtility.Combine(SceneObjs.gameObject);Mesh mesh =newMesh();
vh.FillMesh(mesh);GetComponent<MeshFilter>().mesh = mesh;GetComponent<MeshCollider>().sharedMesh = mesh;for(int i =0; i < num; i++){var temp =Instantiate(obj[i]);
temp.transform.position = posBoth +newVector3(i *1.3f,0,1);
temp.AddComponent<Player>();}}}}