当前位置: 首页>>代码示例>>C#>>正文


C# ParticleSystem.GetComponent方法代码示例

本文整理汇总了C#中UnityEngine.ParticleSystem.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleSystem.GetComponent方法的具体用法?C# ParticleSystem.GetComponent怎么用?C# ParticleSystem.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.ParticleSystem的用法示例。


在下文中一共展示了ParticleSystem.GetComponent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

        private void Awake()
        {
            _explosionParticles = Instantiate(ExplosionPrefab).GetComponent<ParticleSystem>();
            _explosionAudio = _explosionParticles.GetComponent<AudioSource>();

            _explosionParticles.gameObject.SetActive(false);
        }
开发者ID:BuriedStPatrick,项目名称:TanksGame,代码行数:7,代码来源:TankHealth.cs

示例2: ParticleState

	public ParticleState( AmplifyMotionCamera owner, AmplifyMotionObjectBase obj )
		: base( owner, obj )
	{
		m_particleSystem = m_obj.GetComponent<ParticleSystem>();
		m_renderer = m_particleSystem.GetComponent<ParticleSystemRenderer>();
		rotationOverLifetime = m_particleSystem.rotationOverLifetime;
		rotationBySpeed = m_particleSystem.rotationBySpeed;
	}
开发者ID:mirrorfishmedia,项目名称:GGJ2016,代码行数:8,代码来源:ParticleState.cs

示例3: Awake

        private void Awake()
        {
            // Instantiate the explosion prefab and get a reference to the particle system on it.
            m_ExplosionParticles = Instantiate (m_ExplosionPrefab).GetComponent<ParticleSystem> ();

            // Get a reference to the audio source on the instantiated prefab.
            m_ExplosionAudio = m_ExplosionParticles.GetComponent<AudioSource> ();

            // Disable the prefab so it can be activated when it's required.
            m_ExplosionParticles.gameObject.SetActive (false);
        }
开发者ID:RaskoSmash,项目名称:TankBattle,代码行数:11,代码来源:TankHealth.cs

示例4: RescaleParticles

        private void RescaleParticles(ParticleSystem particleSystem, float factor)
        {
            Undo.RecordObject(particleSystem, "Scale Particles");

            // the public ParticleSystem api doesn't expose all the parameters that we need to change when scaling the particle system,
            // so we need to go direct into the serialized object and poke the properties there.
            SerializedObject system = new SerializedObject(particleSystem);

            system.FindProperty("InitialModule.startSize.scalar").floatValue *= factor;
            system.FindProperty("InitialModule.startSpeed.scalar").floatValue *= factor;
            system.FindProperty("InitialModule.gravityModifier").floatValue *= factor;
            system.FindProperty("ShapeModule.radius").floatValue *= factor;
            system.FindProperty("ShapeModule.boxX").floatValue *= factor;
            system.FindProperty("ShapeModule.boxY").floatValue *= factor;
            system.FindProperty("ShapeModule.boxZ").floatValue *= factor;
            system.FindProperty("VelocityModule.x.scalar").floatValue *= factor;
            system.FindProperty("VelocityModule.y.scalar").floatValue *= factor;
            system.FindProperty("VelocityModule.z.scalar").floatValue *= factor;
            system.FindProperty("ClampVelocityModule.x.scalar").floatValue *= factor;
            system.FindProperty("ClampVelocityModule.y.scalar").floatValue *= factor;
            system.FindProperty("ClampVelocityModule.z.scalar").floatValue *= factor;
            system.FindProperty("ForceModule.x.scalar").floatValue *= factor;
            system.FindProperty("ForceModule.y.scalar").floatValue *= factor;
            system.FindProperty("ForceModule.z.scalar").floatValue *= factor;
            system.FindProperty("SizeBySpeedModule.range").vector2Value *= factor;
            system.FindProperty("RotationBySpeedModule.range").vector2Value *= factor;
            system.FindProperty("ColorBySpeedModule.range").vector2Value *= factor;

            system.ApplyModifiedProperties();

            ParticleTurbulence turbulence = particleSystem.GetComponent<ParticleTurbulence>();
            if (turbulence != null)
            {
                Undo.RecordObject(turbulence, "Scale Particles");
                SerializedObject turb = new SerializedObject(turbulence);
                turb.FindProperty("amplitude").floatValue *= factor;
                turb.FindProperty("frequency").floatValue /= factor;
                turb.ApplyModifiedProperties();
            }
        }
开发者ID:wilberton,项目名称:Kraven,代码行数:40,代码来源:ParticleScalerEditor.cs

示例5: On_CosmosReady

        void On_CosmosReady()
        {
            isReady = true;

            cacheTransform = Cosmos.instance.SpaceCamera.transform;

            // Create particle system
            gameObject.AddComponent<ParticleSystem>();
            cacheCosmosParticle = GetComponent<ParticleSystem>();

            cacheCosmosParticle.playOnAwake = false;
            cacheCosmosParticle.enableEmission = false;
            cacheCosmosParticle.simulationSpace = ParticleSystemSimulationSpace.Local;
            cacheCosmosParticle.emissionRate = 0;
            cacheCosmosParticle.startSpeed = 0;
            cacheCosmosParticle.startLifetime = Mathf.Infinity;

            cacheCosmosParticle.startRotation = Random.Range(-Mathf.PI,Mathf.PI);

            cacheCosmosParticle.GetComponent<Renderer>().material = mat;
            cacheCosmosParticle.GetComponent<Renderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            cacheCosmosParticle.GetComponent<Renderer>().receiveShadows = false;

            // Pre Spawn
            for (int i=0; i < maxParticle; i ++) {
            Vector3 drift = Vector3.zero;
            if (enableDrift){
                drift =new Vector3( Random.Range(-1f,1f),Random.Range(-1f,1f),0) * driftSpeed;
            }

            cacheCosmosParticle.Emit( cacheTransform.position + (UnityEngine.Random.insideUnitSphere * 200), drift, Random.Range(minSize, maxSize ) , Mathf.Infinity, color.Evaluate( Random.Range(0f,1f)));
            }
        }
开发者ID:bjsvochak,项目名称:hof16,代码行数:33,代码来源:CosmosParticle.cs

示例6: OnInspectorGUI

		public override void OnInspectorGUI(ParticleSystem s)
		{
			if (RendererModuleUI.s_Texts == null)
			{
				RendererModuleUI.s_Texts = new RendererModuleUI.Texts();
			}
			RendererModuleUI.RenderMode intValue = (RendererModuleUI.RenderMode)this.m_RenderMode.intValue;
			RendererModuleUI.RenderMode renderMode = (RendererModuleUI.RenderMode)ModuleUI.GUIPopup(RendererModuleUI.s_Texts.renderMode, this.m_RenderMode, RendererModuleUI.s_Texts.particleTypes);
			if (renderMode == RendererModuleUI.RenderMode.Mesh)
			{
				EditorGUI.indentLevel++;
				this.DoListOfMeshesGUI();
				EditorGUI.indentLevel--;
				if (intValue != RendererModuleUI.RenderMode.Mesh && this.m_Meshes[0].objectReferenceInstanceIDValue == 0)
				{
					this.m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof(Mesh), "Cube.fbx");
				}
			}
			else
			{
				if (renderMode == RendererModuleUI.RenderMode.Stretch3D)
				{
					EditorGUI.indentLevel++;
					ModuleUI.GUIFloat(RendererModuleUI.s_Texts.cameraSpeedScale, this.m_CameraVelocityScale);
					ModuleUI.GUIFloat(RendererModuleUI.s_Texts.speedScale, this.m_VelocityScale);
					ModuleUI.GUIFloat(RendererModuleUI.s_Texts.lengthScale, this.m_LengthScale);
					EditorGUI.indentLevel--;
				}
			}
			if (renderMode != RendererModuleUI.RenderMode.Mesh)
			{
				ModuleUI.GUIFloat(RendererModuleUI.s_Texts.normalDirection, this.m_NormalDirection);
			}
			if (this.m_Material != null)
			{
				ModuleUI.GUIObject(RendererModuleUI.s_Texts.material, this.m_Material);
			}
			ModuleUI.GUIPopup(RendererModuleUI.s_Texts.sortMode, this.m_SortMode, RendererModuleUI.s_Texts.sortTypes);
			ModuleUI.GUIFloat(RendererModuleUI.s_Texts.sortingFudge, this.m_SortingFudge);
			ModuleUI.GUIPopup(RendererModuleUI.s_Texts.castShadows, this.m_CastShadows, this.m_CastShadows.enumDisplayNames);
			ModuleUI.GUIToggle(RendererModuleUI.s_Texts.receiveShadows, this.m_ReceiveShadows);
			ModuleUI.GUIFloat(RendererModuleUI.s_Texts.maxParticleSize, this.m_MaxParticleSize);
			EditorGUILayout.Space();
			EditorGUILayout.SortingLayerField(RendererModuleUI.s_Texts.sortingLayer, this.m_SortingLayerID, ParticleSystemStyles.Get().popup, ParticleSystemStyles.Get().label);
			ModuleUI.GUIInt(RendererModuleUI.s_Texts.sortingOrder, this.m_SortingOrder);
			this.m_Probes.OnGUI(s.GetComponent<Renderer>(), true);
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:47,代码来源:RendererModuleUI.cs

示例7: Start

 void Start()
 {
     targetSystem = GetComponent<ParticleSystem>();
     targetRenderer = targetSystem.GetComponent<ParticleSystemRenderer>();
     targetRenderer.enabled = false;
 }
开发者ID:Evellex,项目名称:Eldrinth,代码行数:6,代码来源:FastMeshParticles.cs

示例8: OnInspectorGUI

 public override void OnInspectorGUI(ParticleSystem s)
 {
   if (RendererModuleUI.s_Texts == null)
     RendererModuleUI.s_Texts = new RendererModuleUI.Texts();
   RendererModuleUI.RenderMode intValue = (RendererModuleUI.RenderMode) this.m_RenderMode.intValue;
   RendererModuleUI.RenderMode renderMode = (RendererModuleUI.RenderMode) ModuleUI.GUIPopup(RendererModuleUI.s_Texts.renderMode, this.m_RenderMode, RendererModuleUI.s_Texts.particleTypes);
   if (renderMode == RendererModuleUI.RenderMode.Mesh)
   {
     ++EditorGUI.indentLevel;
     this.DoListOfMeshesGUI();
     --EditorGUI.indentLevel;
     if (intValue != RendererModuleUI.RenderMode.Mesh && this.m_Meshes[0].objectReferenceInstanceIDValue == 0)
       this.m_Meshes[0].objectReferenceValue = Resources.GetBuiltinResource(typeof (Mesh), "Cube.fbx");
   }
   else if (renderMode == RendererModuleUI.RenderMode.Stretch3D)
   {
     ++EditorGUI.indentLevel;
     double num1 = (double) ModuleUI.GUIFloat(RendererModuleUI.s_Texts.cameraSpeedScale, this.m_CameraVelocityScale);
     double num2 = (double) ModuleUI.GUIFloat(RendererModuleUI.s_Texts.speedScale, this.m_VelocityScale);
     double num3 = (double) ModuleUI.GUIFloat(RendererModuleUI.s_Texts.lengthScale, this.m_LengthScale);
     --EditorGUI.indentLevel;
   }
   if (renderMode != RendererModuleUI.RenderMode.Mesh)
   {
     double num4 = (double) ModuleUI.GUIFloat(RendererModuleUI.s_Texts.normalDirection, this.m_NormalDirection);
   }
   if (this.m_Material != null)
     ModuleUI.GUIObject(RendererModuleUI.s_Texts.material, this.m_Material);
   ModuleUI.GUIPopup(RendererModuleUI.s_Texts.sortMode, this.m_SortMode, RendererModuleUI.s_Texts.sortTypes);
   double num5 = (double) ModuleUI.GUIFloat(RendererModuleUI.s_Texts.sortingFudge, this.m_SortingFudge);
   ModuleUI.GUIPopup(RendererModuleUI.s_Texts.castShadows, this.m_CastShadows, this.m_CastShadows.enumDisplayNames);
   EditorGUI.BeginDisabledGroup(SceneView.IsUsingDeferredRenderingPath());
   ModuleUI.GUIToggle(RendererModuleUI.s_Texts.receiveShadows, this.m_ReceiveShadows);
   EditorGUI.EndDisabledGroup();
   double num6 = (double) ModuleUI.GUIFloat(RendererModuleUI.s_Texts.minParticleSize, this.m_MinParticleSize);
   double num7 = (double) ModuleUI.GUIFloat(RendererModuleUI.s_Texts.maxParticleSize, this.m_MaxParticleSize);
   EditorGUILayout.Space();
   EditorGUILayout.SortingLayerField(RendererModuleUI.s_Texts.sortingLayer, this.m_SortingLayerID, ParticleSystemStyles.Get().popup, ParticleSystemStyles.Get().label);
   ModuleUI.GUIInt(RendererModuleUI.s_Texts.sortingOrder, this.m_SortingOrder);
   if (renderMode == RendererModuleUI.RenderMode.Billboard)
     ModuleUI.GUIPopup(RendererModuleUI.s_Texts.space, this.m_RenderAlignment, RendererModuleUI.s_Texts.spaces);
   ModuleUI.GUIVector3Field(RendererModuleUI.s_Texts.pivot, this.m_Pivot);
   this.m_Probes.OnGUI((Object[]) null, s.GetComponent<Renderer>(), true);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:44,代码来源:RendererModuleUI.cs

示例9: ParticleState

	public ParticleState( AmplifyMotionCamera owner, AmplifyMotionObjectBase obj )
		: base( owner, obj )
	{
		m_particleSystem = m_obj.GetComponent<ParticleSystem>();
		m_meshRenderer = m_particleSystem.GetComponent<Renderer>().GetComponent<ParticleSystemRenderer>();
	}
开发者ID:MaDDoXbr,项目名称:https---github.com-magneticservices-Palomar,代码行数:6,代码来源:ParticleState.cs


注:本文中的UnityEngine.ParticleSystem.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。