public void ClearAllDetails(int x, int z) { GrassObject[] infos = GrassRootGo.GetComponentsInChildren <GrassObject>(); foreach (GrassObject info in infos) { if (info._x == x && info._z == z) { //DestroyImmediate(info.gameObject); DestoryObj(info.gameObject); } } }
public void ClearDetail(GrassPrototype prototype, int x, int z) { GrassObject[] infos = GrassRootGo.GetComponentsInChildren <GrassObject>(); foreach (GrassObject info in infos) { if (info._material == prototype._material && info._x == x && info._z == z) { //DestroyImmediate(info.gameObject); DestoryObj(info.gameObject); } } }
public void RemoveDetailObjs(GrassPrototype prototype) { GrassObject[] infos = GrassRootGo.GetComponentsInChildren <GrassObject>(); foreach (GrassObject info in infos) { if (info._material == prototype._material) { //DestroyImmediate(info.gameObject); DestoryObj(info.gameObject); } } }
public void UpdateDetailsSize(GrassPrototype prototype) { GrassObject[] grassObjs = GrassRootGo.GetComponentsInChildren <GrassObject>(); foreach (GrassObject grassObj in grassObjs) { if (grassObj._material == prototype._material) { float width = Random.Range(prototype._minWidth, prototype._maxWidth); float height = Random.Range(prototype._minHeight, prototype._maxHeight); grassObj.transform.localScale = new Vector3(width, height, 1); } } }
public void UpdateAllScaleInLightmap() { GrassObject[] infos = GrassRootGo.GetComponentsInChildren <GrassObject>(); foreach (GrassObject info in infos) { GameObject go = info.gameObject; SerializedObject so = new SerializedObject(go.GetComponent <MeshRenderer>()); SerializedProperty goScaleProperty = so.FindProperty("m_ScaleInLightmap"); if (_editor._scaleInLightmap != goScaleProperty.floatValue) { Undo.RecordObject(go, "Set ScaleInLightmap"); goScaleProperty.floatValue = _editor._scaleInLightmap; so.ApplyModifiedProperties(); } } }
public void GetDetailObjs(GrassPrototype prototype, int x, int z, ref List <GameObject> objs) { //GrassEditor.Detail detail = null; GrassObject[] infos = GrassRootGo.GetComponentsInChildren <GrassObject>(); foreach (GrassObject info in infos) { if (info._material == prototype._material && info._x == x && info._z == z) { /* * if (detail == null) { * detail = new GrassEditor.Detail(); * detail.objs = new List<GameObject>(); * } * detail.objs.Add(info.gameObject); */ objs.Add(info.gameObject); } } // return detail; }