private void CreateAndAssignSubEmitter(SerializedProperty objectRefProp, SubModuleUI.SubEmitterType type) { GameObject gameObject = this.m_ParticleSystemUI.m_ParticleEffectUI.CreateParticleSystem(this.m_ParticleSystemUI.m_ParticleSystem, type); gameObject.name = "SubEmitter"; objectRefProp.objectReferenceValue = gameObject.GetComponent <ParticleSystem>(); }
private void CreateAndAssignSubEmitter(SerializedProperty objectRefProp, SubModuleUI.SubEmitterType type) { GameObject gameObject = this.m_ParticleSystemUI.m_ParticleEffectUI.CreateParticleSystem(this.m_ParticleSystemUI.m_ParticleSystem, type); switch (type) { case SubModuleUI.SubEmitterType.Birth: gameObject.name = "SubEmitterBirth"; break; case SubModuleUI.SubEmitterType.Collision: gameObject.name = "SubEmitterCollision"; break; case SubModuleUI.SubEmitterType.Death: gameObject.name = "SubEmitterDeath"; break; default: gameObject.name = "SubEmitter"; break; } objectRefProp.objectReferenceValue = gameObject.GetComponent<ParticleSystem>(); }
public GameObject CreateParticleSystem(ParticleSystem parentOfNewParticleSystem, SubModuleUI.SubEmitterType defaultType) { Type[] components = new Type[] { typeof(ParticleSystem) }; GameObject obj2 = new GameObject(this.GetNextParticleSystemName(), components); if (obj2 == null) { return(null); } if (parentOfNewParticleSystem != null) { obj2.transform.parent = parentOfNewParticleSystem.transform; } obj2.transform.localPosition = Vector3.zero; obj2.transform.localRotation = Quaternion.identity; ParticleSystem component = obj2.GetComponent <ParticleSystem>(); if (defaultType != SubModuleUI.SubEmitterType.None) { component.SetupDefaultType((int)defaultType); } SessionState.SetFloat("CurrentEmitterAreaScroll", this.m_EmitterAreaScrollPos.x); return(obj2); }
public GameObject CreateParticleSystem(ParticleSystem parentOfNewParticleSystem, SubModuleUI.SubEmitterType defaultType) { string nextParticleSystemName = this.GetNextParticleSystemName(); GameObject gameObject = new GameObject(nextParticleSystemName, new Type[] { typeof(ParticleSystem) }); if (gameObject) { if (parentOfNewParticleSystem) { gameObject.transform.parent = parentOfNewParticleSystem.transform; } gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; ParticleSystem component = gameObject.GetComponent <ParticleSystem>(); if (defaultType != SubModuleUI.SubEmitterType.None) { component.SetupDefaultType((int)defaultType); } SessionState.SetFloat("CurrentEmitterAreaScroll", this.m_EmitterAreaScrollPos.x); return(gameObject); } return(null); }
public GameObject CreateParticleSystem(ParticleSystem parentOfNewParticleSystem, SubModuleUI.SubEmitterType defaultType) { GameObject gameObject = new GameObject(this.GetNextParticleSystemName(), new System.Type[1] { typeof(ParticleSystem) }); if (!(bool)((UnityEngine.Object)gameObject)) { return((GameObject)null); } if ((bool)((UnityEngine.Object)parentOfNewParticleSystem)) { gameObject.transform.parent = parentOfNewParticleSystem.transform; } gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; ParticleSystem component = gameObject.GetComponent <ParticleSystem>(); if (defaultType != SubModuleUI.SubEmitterType.None) { component.SetupDefaultType((int)defaultType); } SessionState.SetFloat("CurrentEmitterAreaScroll", this.m_EmitterAreaScrollPos.x); return(gameObject); }
public GameObject CreateParticleSystem(ParticleSystem parentOfNewParticleSystem, SubModuleUI.SubEmitterType defaultType) { string nextParticleSystemName = this.GetNextParticleSystemName(); GameObject gameObject = new GameObject(nextParticleSystemName, new Type[] { typeof(ParticleSystem) }); GameObject result; if (gameObject) { if (parentOfNewParticleSystem) { gameObject.transform.parent = parentOfNewParticleSystem.transform; } gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localRotation = Quaternion.identity; ParticleSystem component = gameObject.GetComponent <ParticleSystem>(); if (defaultType != SubModuleUI.SubEmitterType.None) { component.SetupDefaultType((int)defaultType); } SessionState.SetFloat("CurrentEmitterAreaScroll", this.m_EmitterAreaScrollPos.x); ParticleSystemRenderer component2 = gameObject.GetComponent <ParticleSystemRenderer>(); Renderer arg_AF_0 = component2; Material[] expr_A2 = new Material[2]; expr_A2[0] = AssetDatabase.GetBuiltinExtraResource <Material>("Default-Particle.mat"); arg_AF_0.materials = expr_A2; result = gameObject; } else { result = null; } return(result); }
public GameObject CreateParticleSystem(ParticleSystem parentOfNewParticleSystem, SubModuleUI.SubEmitterType defaultType) { string name = GetNextParticleSystemName(); GameObject go = new GameObject(name, typeof(ParticleSystem)); if (go) { if (parentOfNewParticleSystem) { go.transform.parent = parentOfNewParticleSystem.transform; } go.transform.localPosition = Vector3.zero; go.transform.localRotation = Quaternion.identity; // Setup particle system based on type ParticleSystem ps = go.GetComponent <ParticleSystem>(); if (defaultType != SubModuleUI.SubEmitterType.None) { ps.SetupDefaultType((int)defaultType); } SessionState.SetFloat("CurrentEmitterAreaScroll", m_EmitterAreaScrollPos.x); // Assign default material ParticleSystemRenderer renderer = go.GetComponent <ParticleSystemRenderer>(); Material particleMat = null; if (GraphicsSettings.renderPipelineAsset != null) { particleMat = GraphicsSettings.renderPipelineAsset.GetDefaultParticleMaterial(); } if (particleMat == null) { particleMat = AssetDatabase.GetBuiltinExtraResource <Material>("Default-Particle.mat"); } renderer.materials = new[] { particleMat, null }; Undo.RegisterCreatedObjectUndo(go, "Create ParticleSystem"); return(go); } return(null); }
public GameObject CreateParticleSystem(ParticleSystem parentOfNewParticleSystem, SubModuleUI.SubEmitterType defaultType) { System.Type[] components = new System.Type[] { typeof(ParticleSystem) }; GameObject obj2 = new GameObject(this.GetNextParticleSystemName(), components); if (obj2 != null) { if (parentOfNewParticleSystem != null) { obj2.transform.parent = parentOfNewParticleSystem.transform; } obj2.transform.localPosition = Vector3.zero; obj2.transform.localRotation = Quaternion.identity; ParticleSystem component = obj2.GetComponent <ParticleSystem>(); if (defaultType != SubModuleUI.SubEmitterType.None) { component.SetupDefaultType((int)defaultType); } SessionState.SetFloat("CurrentEmitterAreaScroll", this.m_EmitterAreaScrollPos.x); Material[] materialArray1 = new Material[2]; materialArray1[0] = AssetDatabase.GetBuiltinExtraResource <Material>("Default-Particle.mat"); obj2.GetComponent <ParticleSystemRenderer>().materials = materialArray1; return(obj2); } return(null); }