public UBillBoard(Transform parent, UTerrain terrain, Material mat, T centerInstance) { m_Center = centerInstance.position; Add(centerInstance); Initialize(parent, terrain, mat, false); UpdateMesh(); }
internal void Initialize(UTreeData data, bool newObj) { if (m_Terrain == null || newObj) { m_Terrain = data.terrain; } if (m_GameObject == null || newObj) { m_GameObject = new GameObject(prefab.name); m_GameObject.transform.parent = data.gameObject.transform; m_GameObject.transform.localPosition = Vector3.zero; m_GameObject.transform.localEulerAngles = Vector3.zero; m_GameObject.transform.localScale = Vector3.one; m_GameObject.hideFlags = HideFlags.DontSave; } m_Material = null; m_Groups.ForEach(g => g.Initialize(m_GameObject.transform, m_Terrain, material, newObj)); #if UNITY_EDITOR m_TreeMesh = prefab.GetComponent <MeshFilter>().sharedMesh; #else m_TreeMesh = prefab.GetComponent <MeshFilter>().mesh; #endif m_ApplyGroup = new List <int>(); active = m_Active; }
internal override void Initialize(Transform parent, UTerrain terrain, Material mat, bool newObj) { base.Initialize(parent, terrain, mat, newObj); if (newObj) { m_Instances.ForEach(ins => ins.NewInit(transform, prefab)); } }
internal void Initialize(UTerrainData data, bool newObj) { if (m_Terrain == null || newObj) { m_Terrain = data.terrain; } if (m_GameObject == null || newObj) { m_GameObject = new GameObject("Tree"); m_GameObject.transform.parent = data.gameObject.transform; m_GameObject.transform.localEulerAngles = Vector3.zero; m_GameObject.transform.localPosition = Vector3.zero; m_GameObject.transform.localScale = Vector3.one; m_GameObject.hideFlags = HideFlags.DontSave; } active = m_Active; m_Trees.ForEach(g => g.Initialize(this, newObj)); }
internal virtual void Initialize(Transform parent, UTerrain terrain, Material mat, bool newObj) { if (m_Terrain == null || newObj) { m_Terrain = terrain; } if (m_GameObject == null || newObj) { m_GameObject = new GameObject("BillBoard", typeof(MeshFilter), typeof(MeshRenderer)); m_MeshFilter = m_GameObject.GetComponent <MeshFilter>(); m_MeshRenderer = m_GameObject.GetComponent <MeshRenderer>(); m_GameObject.transform.parent = parent; m_GameObject.transform.localPosition = Vector3.zero; m_GameObject.transform.eulerAngles = Vector3.zero; m_GameObject.transform.localScale = Vector3.one; m_GameObject.hideFlags = HideFlags.DontSave; } #if UNITY_EDITOR EditorUtility.SetSelectedWireframeHidden(m_GameObject.GetComponent <Renderer>(), true); #endif UpdateMesh(); #if UNITY_EDITOR if (m_MeshFilter.sharedMesh != mesh || newObj) { m_MeshFilter.sharedMesh = mesh; } if (m_MeshRenderer.sharedMaterial != mat || newObj) { m_MeshRenderer.sharedMaterial = mat; } #else if (m_MeshFilter.mesh == null || newObj) { m_MeshFilter.mesh = mesh; } if (m_MeshRenderer.material == null || newObj) { m_MeshRenderer.material = mat; } #endif active = m_Active; }
internal void Initialize(UGrassData data, bool newObj) { if (m_Terrain == null || newObj) { m_Terrain = data.terrain; } if (m_GameObject == null || newObj) { m_GameObject = new GameObject(texture.name); m_GameObject.transform.parent = data.gameObject.transform; m_GameObject.transform.localPosition = Vector3.zero; m_GameObject.transform.localEulerAngles = Vector3.zero; m_GameObject.transform.localScale = Vector3.one; m_GameObject.hideFlags = HideFlags.DontSave; } m_Material = null; m_Groups.ForEach(g => g.Initialize(m_GameObject.transform, m_Terrain, material, newObj)); m_ApplyGroup = new List <int>(); active = m_Active; }
internal void Initialize(UTextureData data, int index, bool newObj) { m_Mesh = data.terrain.GetSubMesh(index); m_Index = index; if (m_Terrain == null || newObj) { m_Terrain = data.terrain; } Transform trans = data.gameObject.transform.Find("SubMesh" + index.ToString()); if (trans != null) { m_GameObject = trans.gameObject; } if (m_GameObject == null || newObj) { m_GameObject = new GameObject("SubMesh" + index.ToString(), typeof(MeshFilter), typeof(MeshRenderer)); m_GameObject.transform.parent = data.gameObject.transform; m_GameObject.transform.localPosition = Vector3.zero; m_GameObject.transform.localEulerAngles = Vector3.zero; m_GameObject.transform.localScale = Vector3.one; m_GameObject.GetComponent <MeshFilter>().sharedMesh = m_Mesh; m_GameObject.hideFlags = HideFlags.None; if (m_Passes.Count > 0) { UpdateMats(); } else #if UNITY_EDITOR { m_GameObject.GetComponent <MeshRenderer>().sharedMaterial = m_Terrain.oldMaterials[index]; } #else { m_GameObject.GetComponent <MeshRenderer>().material = m_Terrain.oldMaterials[index]; } #endif } #if UNITY_EDITOR EditorUtility.SetSelectedWireframeHidden(m_GameObject.GetComponent <Renderer>(), true); #endif m_Passes.ForEach(g => g.Initialize()); }
internal void Initialize(UTerrain terrain, bool newObj) { if (m_Terrain == null || newObj) { m_Terrain = terrain; } if (m_GO == null || newObj) { m_GO = new GameObject("Detail"); #if UNITY_EDITOR Undo.RegisterCreatedObjectUndo(m_GO, "Created CTE Terrain"); #endif m_GO.transform.parent = terrain.transform; m_GO.transform.localPosition = Vector3.zero; m_GO.transform.localEulerAngles = Vector3.zero; m_GO.transform.localScale = Vector3.one; m_GO.transform.parent = null; m_GO.hideFlags = HideFlags.HideAndDontSave; } m_GrassData.Initialize(this, newObj); m_TreeData.Initialize(this, newObj); m_TextureData.Initialize(this, newObj); active = m_Active; }
internal void Initialize(UTerrainData data, bool newObj) { if (m_Terrain == null || newObj) { m_Terrain = data.terrain; } Transform trans = terrain.transform.Find("SubMesh"); if (trans != null) { m_GameObject = trans.gameObject; } if (m_GameObject == null || newObj) { m_GameObject = new GameObject("SubMesh"); m_GameObject.transform.parent = terrain.transform; m_GameObject.transform.localPosition = Vector3.zero; m_GameObject.transform.localEulerAngles = Vector3.zero; m_GameObject.transform.localScale = Vector3.one; m_GameObject.hideFlags = HideFlags.HideInHierarchy; } int i, max; if (m_SubMeshes.Count == 0) { for (i = 0, max = m_Terrain.GetAllSubMesh().Length; i < max; i++) { m_SubMeshes.Add(new USubMesh(this, i)); } } for (i = 0, max = m_SubMeshes.Count; i < max; i++) { m_SubMeshes[i].Initialize(this, i, newObj); } active = m_Active; }
public void Initialize(UTerrain terrain) { Initialize(terrain, false); }
public UGrassGroup(Transform parent, UTerrain terrain, Material mat, UGrassInstance centerInstance) : base(parent, terrain, mat, centerInstance) { }