• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.ParticleSystem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnEnter

		public override void OnEnter()
		{
			ps = Fsm.GetOwnerDefaultTarget(gameObject).GetComponent<ParticleSystem>();


			if (delay.Value <= 0)
			{
				if (clear.Value) {
					stopWithClear.Value = false;
					ps.Clear();
				}

				else { 
					ps.Stop();
					ps.Clear();

				}

				if(finishEvent != null) Fsm.Event(finishEvent);{
				Finish();
				return;
			}
			}
			
			startTime = Time.realtimeSinceStartup;
			timer = 0f;
		}
开发者ID:BHD7,项目名称:Ghost_Town_FPS_Zombies,代码行数:27,代码来源:particleSystemClear.cs


示例17: Init

 public override void Init()
 {
     ParticleSystem = gameObject.GetComponent<ParticleSystem>();
     arc = ParticleSystem.shape.arc;
     Reloaded = false;
     ReloadStarted = false;
 }
开发者ID:ShvedA,项目名称:RogueRpg1,代码行数:7,代码来源:ReloadParticleShootingScript.cs


示例18: Awake

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

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


示例19: Arc

        public Arc(ParticleSystem particleSystem, Vector3 position)
        {
            particleSystem.name = "Particle: " + ++ID + " clones";
            GameObject parent = new GameObject("Arc clone (" + ID + ") ");

            particleSystem = (ParticleSystem)Object.Instantiate(particleSystem, position, new Quaternion());
            particleSystem.transform.parent = parent.transform;


            arc = new ParticleSystem.Particle[resolution * resolution * resolution];
            float increment = 1f / (resolution - 1);
            int i = 0;
            for (int x = 0; x < resolution; x++)
            {
                for (int z = 0; z < resolution; z++)
                {
                    for (int y = 0; y < resolution; y++)
                    {
                        Vector3 p = new Vector3(x, y, z) * increment;
                        arc[i].position = p;
                        arc[i].color = new Color(p.x, p.y, p.z);
                        arc[i++].size = 0.1f;
                    }
                }
            }
        }
开发者ID:ludo6577,项目名称:Unity,代码行数:26,代码来源:Arc.cs


示例20: PlayEffect

        /// <summary>Plays the particle effect, but replaces the material on the particle with the one specified (mat).</summary>
        public void PlayEffect(ParticleSystem effect, Vector3 pos, Quaternion rot, int parentId, Material mat)
        {
            if (effect == null) return;

            // Check if we're at the maximum active particle limit. If so, ignore the request to play the particle effect.
            if (IsMaxActiveParticles) return;

            // Check if we've reached the max particle limit per destructible object for this object already.
            int parentParticleCount = ActiveParticles.Count(x => x.ParentId == parentId);
            if (parentParticleCount > maxPerDestructible) return;

            // Instantiate and add to the ActiveParticles counter
            GameObject spawn = ObjectPool.Instance.Spawn(effect.gameObject, pos, rot);
            if (spawn == null || spawn.GetComponent<ParticleSystem>() == null) return;
            ActiveParticle aParticle = new ActiveParticle() { GameObject = spawn, InstantiatedTime = Time.time, ParentId = parentId };
            Array.Resize(ref activeParticles, activeParticles.Length + 1);
            ActiveParticles[activeParticles.Length - 1] = aParticle;

            // Replace the materials on the particle effect with the one passed in.
            if (mat != null && spawn.GetComponent<ParticleSystem>() != null)
            {
                foreach (ParticleSystemRenderer ps in spawn.GetComponentsInChildren<ParticleSystemRenderer>())
                {
                    if (ps.renderMode == ParticleSystemRenderMode.Mesh)
                        ps.sharedMaterial = mat;
                }
            }
        }
开发者ID:tegleg,项目名称:mfp,代码行数:29,代码来源:ParticleManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.Plane类代码示例发布时间:2022-05-26
下一篇:
C# UnityEngine.Object类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap