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


C# UnityEngine.ParticleSystem类代码示例

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


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

示例1: Awake

 public override void Awake()
 {
     base.Awake();
     beamtf = tf.FindChild("Beam").transform;
     ps = tf.FindChild("Particle System").GetComponent<ParticleSystem>();
     capsule = gameObject.GetComponent<CapsuleCollider>();
 }
开发者ID:spi8823,项目名称:Sudenona,代码行数:7,代码来源:TestBeamBulletScript.cs

示例2: 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

示例3: MoveParticle

 void MoveParticle(ref ParticleSystem.Particle p)
 {
     var n = GetDFNoise(p.position + Vector3.up * _animationSpeed * Time.time);
     p.velocity = 
         p.velocity * (1.0f - _damping) +
         n * Time.fixedDeltaTime * _advection;
 }
开发者ID:cupsster,项目名称:DFNoiseTest,代码行数:7,代码来源:Particle3D.cs

示例4: OnInspectorGUI

 public override void OnInspectorGUI(ParticleSystem s)
 {
   if (RotationByVelocityModuleUI.s_Texts == null)
     RotationByVelocityModuleUI.s_Texts = new RotationByVelocityModuleUI.Texts();
   EditorGUI.BeginChangeCheck();
   bool flag = ModuleUI.GUIToggle(RotationByVelocityModuleUI.s_Texts.separateAxes, this.m_SeparateAxes);
   if (EditorGUI.EndChangeCheck())
   {
     if (flag)
     {
       this.m_Z.RemoveCurveFromEditor();
     }
     else
     {
       this.m_X.RemoveCurveFromEditor();
       this.m_Y.RemoveCurveFromEditor();
       this.m_Z.RemoveCurveFromEditor();
     }
   }
   if (flag)
   {
     this.m_Z.m_DisplayName = RotationByVelocityModuleUI.s_Texts.z;
     this.GUITripleMinMaxCurve(GUIContent.none, RotationByVelocityModuleUI.s_Texts.x, this.m_X, RotationByVelocityModuleUI.s_Texts.y, this.m_Y, RotationByVelocityModuleUI.s_Texts.z, this.m_Z, (SerializedProperty) null);
   }
   else
   {
     this.m_Z.m_DisplayName = RotationByVelocityModuleUI.s_Texts.rotation;
     ModuleUI.GUIMinMaxCurve(RotationByVelocityModuleUI.s_Texts.rotation, this.m_Z);
   }
   ModuleUI.GUIMinMaxRange(RotationByVelocityModuleUI.s_Texts.velocityRange, this.m_Range);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:31,代码来源:RotationByVelocityModuleUI.cs

示例5: OnInspectorGUI

 public override void OnInspectorGUI(ParticleSystem s)
 {
     if (s_Texts == null)
     {
         s_Texts = new Texts();
     }
     EditorGUI.BeginChangeCheck();
     bool flag = ModuleUI.GUIToggle(s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);
     if (EditorGUI.EndChangeCheck())
     {
         if (flag)
         {
             this.m_X.RemoveCurveFromEditor();
         }
         else
         {
             this.m_X.RemoveCurveFromEditor();
             this.m_Y.RemoveCurveFromEditor();
             this.m_Z.RemoveCurveFromEditor();
         }
     }
     MinMaxCurveState state = this.m_X.state;
     this.m_Y.state = state;
     this.m_Z.state = state;
     if (flag)
     {
         this.m_X.m_DisplayName = s_Texts.x;
         base.GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, this.m_X, s_Texts.y, this.m_Y, s_Texts.z, this.m_Z, null, new GUILayoutOption[0]);
     }
     else
     {
         this.m_X.m_DisplayName = s_Texts.size;
         ModuleUI.GUIMinMaxCurve(s_Texts.size, this.m_X, new GUILayoutOption[0]);
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:35,代码来源:SizeModuleUI.cs

示例6: OnInspectorGUI

 public override void OnInspectorGUI(ParticleSystem s)
 {
     if (s_Texts == null)
     {
         s_Texts = new Texts();
     }
     ModuleUI.GUIIntDraggableX2(s_Texts.tiles, s_Texts.tilesX, this.m_TilesX, s_Texts.tilesY, this.m_TilesY);
     int num = ModuleUI.GUIPopup(s_Texts.animation, this.m_AnimationType, s_Texts.types);
     if (num == 1)
     {
         ModuleUI.GUIToggle(s_Texts.randomRow, this.m_RandomRow);
         if (!this.m_RandomRow.boolValue)
         {
             ModuleUI.GUIInt(s_Texts.row, this.m_RowIndex);
         }
     }
     if (num == 1)
     {
         this.m_FrameOverTime.m_RemapValue = this.m_TilesX.intValue;
     }
     if (num == 0)
     {
         this.m_FrameOverTime.m_RemapValue = this.m_TilesX.intValue * this.m_TilesY.intValue;
     }
     ModuleUI.GUIMinMaxCurve(s_Texts.frameOverTime, this.m_FrameOverTime);
     ModuleUI.GUIFloat(s_Texts.cycles, this.m_Cycles);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:27,代码来源:UVModuleUI.cs

示例7: OnInspectorGUI

 public override void OnInspectorGUI(ParticleSystem s)
 {
   if (VelocityModuleUI.s_Texts == null)
     VelocityModuleUI.s_Texts = new VelocityModuleUI.Texts();
   this.GUITripleMinMaxCurve(GUIContent.none, VelocityModuleUI.s_Texts.x, this.m_X, VelocityModuleUI.s_Texts.y, this.m_Y, VelocityModuleUI.s_Texts.z, this.m_Z, (SerializedProperty) null);
   ModuleUI.GUIBoolAsPopup(VelocityModuleUI.s_Texts.space, this.m_InWorldSpace, VelocityModuleUI.s_Texts.spaces);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:VelocityModuleUI.cs

示例8: Setup

		public void Setup() {

			this.particleSystem = this.GetComponent<ParticleSystem>();
			if (this.particleSystem != null) {

				//var alpha = this.lastAlpha;
				//this.SetStartAlpha(1f);

				var obj = new UnityEditor.SerializedObject(this.particleSystem);
				var module = obj.FindProperty("InitialModule").FindPropertyRelative("startColor");

				var minColor = module.FindPropertyRelative("minColor");
				var maxColor = module.FindPropertyRelative("maxColor");
				var minGradient = module.FindPropertyRelative("minGradient");
				var maxGradient = module.FindPropertyRelative("maxGradient");
				var minMaxState = module.FindPropertyRelative("minMaxState");
				this.startColor.minColor = minColor.colorValue;
				this.startColor.maxColor = maxColor.colorValue;
				this.startColor.minGradient = minGradient.GetGradient();
				this.startColor.maxGradient = maxGradient.GetGradient();
				this.startColor.minMaxState = (MinMaxState)minMaxState.intValue;

				//if (alpha >= 0f) this.SetStartAlpha(alpha);

			}

		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:27,代码来源:ParticleSystemCachedItem.cs

示例9: Awake

 /*
 [Serializable]
 internal class ExplosionDesc
 {
 public ChuzzleColor color;
 public Color[] possibleColors;
 }
 */
 void Awake()
 {
     if (!ps)
     {
         ps = GetComponent<ParticleSystem>();
     }
 }
开发者ID:GreatVV,项目名称:SouffleMatch,代码行数:15,代码来源:ChuzzleExplosion.cs

示例10: OnInspectorGUI

 public override void OnInspectorGUI(ParticleSystem s)
 {
   if (InitialModuleUI.s_Texts == null)
     InitialModuleUI.s_Texts = new InitialModuleUI.Texts();
   double num1 = (double) ModuleUI.GUIFloat(InitialModuleUI.s_Texts.duration, this.m_LengthInSec, "f2");
   this.m_LengthInSec.floatValue = Mathf.Min(100000f, Mathf.Max(0.0f, this.m_LengthInSec.floatValue));
   bool boolValue1 = this.m_Looping.boolValue;
   ModuleUI.GUIToggle(InitialModuleUI.s_Texts.looping, this.m_Looping);
   if (this.m_Looping.boolValue && !boolValue1 && (double) s.time >= (double) this.m_LengthInSec.floatValue)
     s.time = 0.0f;
   EditorGUI.BeginDisabledGroup(!this.m_Looping.boolValue);
   ModuleUI.GUIToggle(InitialModuleUI.s_Texts.prewarm, this.m_Prewarm);
   EditorGUI.EndDisabledGroup();
   EditorGUI.BeginDisabledGroup(this.m_Prewarm.boolValue && this.m_Looping.boolValue);
   ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.startDelay, this.m_StartDelay);
   EditorGUI.EndDisabledGroup();
   ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.lifetime, this.m_LifeTime);
   ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.speed, this.m_Speed);
   ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.size, this.m_Size);
   EditorGUI.BeginChangeCheck();
   bool flag = ModuleUI.GUIToggle(InitialModuleUI.s_Texts.rotation3D, this.m_Rotation3D);
   if (EditorGUI.EndChangeCheck())
   {
     if (flag)
     {
       this.m_RotationZ.RemoveCurveFromEditor();
     }
     else
     {
       this.m_RotationX.RemoveCurveFromEditor();
       this.m_RotationY.RemoveCurveFromEditor();
       this.m_RotationZ.RemoveCurveFromEditor();
     }
   }
   if (flag)
   {
     this.m_RotationZ.m_DisplayName = InitialModuleUI.s_Texts.z;
     this.GUITripleMinMaxCurve(GUIContent.none, InitialModuleUI.s_Texts.x, this.m_RotationX, InitialModuleUI.s_Texts.y, this.m_RotationY, InitialModuleUI.s_Texts.z, this.m_RotationZ, (SerializedProperty) null);
   }
   else
   {
     this.m_RotationZ.m_DisplayName = InitialModuleUI.s_Texts.rotation;
     ModuleUI.GUIMinMaxCurve(InitialModuleUI.s_Texts.rotation, this.m_RotationZ);
   }
   double num2 = (double) ModuleUI.GUIFloat(InitialModuleUI.s_Texts.randomizeRotationDirection, this.m_RandomizeRotationDirection);
   this.GUIMinMaxGradient(InitialModuleUI.s_Texts.color, this.m_Color);
   double num3 = (double) ModuleUI.GUIFloat(InitialModuleUI.s_Texts.gravity, this.m_GravityModifier);
   ModuleUI.GUIBoolAsPopup(InitialModuleUI.s_Texts.simulationSpace, this.m_SimulationSpace, InitialModuleUI.s_Texts.simulationSpaces);
   ModuleUI.GUIPopup(InitialModuleUI.s_Texts.scalingMode, this.m_ScalingMode, new string[3]
   {
     "Hierarchy",
     "Local",
     "Shape"
   });
   bool boolValue2 = this.m_PlayOnAwake.boolValue;
   bool newPlayOnAwake = ModuleUI.GUIToggle(InitialModuleUI.s_Texts.autoplay, this.m_PlayOnAwake);
   if (boolValue2 != newPlayOnAwake)
     this.m_ParticleSystemUI.m_ParticleEffectUI.PlayOnAwakeChanged(newPlayOnAwake);
   ModuleUI.GUIInt(InitialModuleUI.s_Texts.maxParticles, this.m_MaxNumParticles);
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:60,代码来源:InitialModuleUI.cs

示例11: ParticleEffectInstanceManager

		public ParticleEffectInstanceManager(EffectManager effect_manager, Mesh character_mesh, bool letter_flipped, ParticleEffectSetup effect_setup, AnimationProgressionVariables progression_vars, AnimatePerOptions animate_per, ParticleEmitter particle_emitter = null, ParticleSystem particle_system = null)
		{
			m_particle_emitter = particle_emitter;
			m_particle_system = particle_system;
			m_letter_mesh = character_mesh;
			m_letter_flipped = letter_flipped;
			m_follow_mesh = effect_setup.m_follow_mesh;
			m_duration = effect_setup.m_duration.GetValue(progression_vars, animate_per);
			m_delay = effect_setup.m_delay.GetValue(progression_vars, animate_per);
			m_position_offset = effect_setup.m_position_offset.GetValue(progression_vars, animate_per);
			m_rotation_offset = Quaternion.Euler(effect_setup.m_rotation_offset.GetValue(progression_vars, animate_per));
			m_rotate_with_letter = effect_setup.m_rotate_relative_to_letter;
			m_effect_manager_handle = effect_manager;
			m_active = false;

			if(m_particle_emitter != null)
			{
				m_transform = m_particle_emitter.transform;

				m_particle_emitter.emit = true;
				m_particle_emitter.enabled = false;
			}
			else if(m_particle_system != null)
			{
				m_transform = m_particle_system.transform;

				m_particle_system.playOnAwake = false;
				m_particle_system.Play();
	#if !UNITY_3_5 && UNITY_EDITOR
				p_system_timer = 0;
	#endif
			}
		}
开发者ID:DarkRay,项目名称:neverending-story,代码行数:33,代码来源:ParticleEffectInstanceManager.cs

示例12: GetParticlesInLargetArray

 public static int GetParticlesInLargetArray(this ParticleSystem shuriken, ref ParticleSystem.Particle[] particles)
 {
     if (particles == null || particles.Length < shuriken.particleCount) {
         particles = new ParticleSystem.Particle[shuriken.particleCount * 2];
     }
     return shuriken.GetParticles(particles);
 }
开发者ID:nobnak,项目名称:Boids,代码行数:7,代码来源:ParticleSystemExtension.cs

示例13: Setup

		public void Setup() {

			this.particleSystems = this.GetComponentsInChildren<ParticleSystem>(true);
			this.mainParticleSystem = (this.particleSystems.Length > 0) ? this.particleSystems[0] : null;
			this.count = this.particleSystems.Length;

			this.ValidateCanvasGroup();

			this.particleSystemItems = new ParticleSystemCachedItem[this.particleSystems.Length];
			for (int i = 0; i < this.particleSystems.Length; ++i) {
				
				var ps = this.particleSystems[i];

				var item = ps.gameObject.GetComponent<ParticleSystemCachedItem>();
				if (item == null) item = ps.gameObject.AddComponent<ParticleSystemCachedItem>();

				item.Setup();
				this.particleSystemItems[i] = item;

			}

			var index = System.Array.IndexOf(this.particleSystems, this.mainParticleSystem);
			if (index >= 0) this.mainParticleSystemItem = this.particleSystemItems[index];

		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:25,代码来源:ParticleSystemCached.cs

示例14: GetParticleSystems

 internal static ParticleSystem[] GetParticleSystems(ParticleSystem root)
 {
   List<ParticleSystem> particleSystems = new List<ParticleSystem>();
   particleSystems.Add(root);
   ParticleEffectUI.GetDirectParticleSystemChildrenRecursive(root.transform, particleSystems);
   return particleSystems.ToArray();
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:7,代码来源:ParticleEffectUI.cs

示例15: Awake

 protected override void Awake()
 {
     base.Awake();
     waterSpray = transform.FindChild("WaterSpray").gameObject;
     particles = waterSpray.GetComponent<ParticleSystem>();
     particles.Stop();
 }
开发者ID:MechroCat22,项目名称:VR-Object-Hunt,代码行数:7,代码来源:FireExtinguisher_Sprayer.cs


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