コード例 #1
0
	// Use this for initialization
		void Start () 
		{
			//Cache vars
			myParticleSystem	=	GetComponent<ParticleSystem>();
			particleArray = new ParticleSystem.Particle[GetComponent<ParticleSystem>().maxParticles];
			particlesInitialPositions = new Vector3[GetComponent<ParticleSystem>().maxParticles];
		}
コード例 #2
0
        public void shoot(bool _fire, ParticleSystem _projectile)
        {
            rotate(gattlingGunData.warmupDelay);

            if (_fire)
            {
                if (gattlingGunData.warmupDelay < gattlingGunData.warmState)
                {
                    gattlingGunData.warmupDelay++;
                    return;
                }
                gattlingGunData.currentShotDelay--;
                if (gattlingGunData.currentShotDelay <= 0)
                {
                    _projectile.Emit(1);
                    gattlingGunData.currentShotDelay = gattlingGunData.shotDelayMax;
                }
            }
            else
            {
                if (gattlingGunData.warmupDelay > gattlingGunData.coldState)
                {
                    gattlingGunData.warmupDelay--;
                }
            }
        }
コード例 #3
0
ファイル: Arc.cs プロジェクト: ludo6577/Unity
        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;
                    }
                }
            }
        }
コード例 #4
0
 public override void OnInspectorGUI(ParticleSystem s)
 {
     if (s_Texts == null)
     {
         s_Texts = new Texts();
     }
     ModuleUI.GUIFloat(s_Texts.ratio, this.m_Ratio, new GUILayoutOption[0]);
     ModuleUI.GUIMinMaxCurve(s_Texts.lifetime, this.m_Lifetime, new GUILayoutOption[0]);
     ModuleUI.GUIFloat(s_Texts.minVertexDistance, this.m_MinVertexDistance, new GUILayoutOption[0]);
     ModuleUI.GUIPopup(s_Texts.textureMode, this.m_TextureMode, s_Texts.textureModeOptions, new GUILayoutOption[0]);
     ModuleUI.GUIToggle(s_Texts.worldSpace, this.m_WorldSpace, new GUILayoutOption[0]);
     ModuleUI.GUIToggle(s_Texts.dieWithParticles, this.m_DieWithParticles, new GUILayoutOption[0]);
     ModuleUI.GUIToggle(s_Texts.sizeAffectsWidth, this.m_SizeAffectsWidth, new GUILayoutOption[0]);
     ModuleUI.GUIToggle(s_Texts.sizeAffectsLifetime, this.m_SizeAffectsLifetime, new GUILayoutOption[0]);
     ModuleUI.GUIToggle(s_Texts.inheritParticleColor, this.m_InheritParticleColor, new GUILayoutOption[0]);
     base.GUIMinMaxGradient(s_Texts.colorOverLifetime, this.m_ColorOverLifetime, new GUILayoutOption[0]);
     ModuleUI.GUIMinMaxCurve(s_Texts.widthOverTrail, this.m_WidthOverTrail, new GUILayoutOption[0]);
     base.GUIMinMaxGradient(s_Texts.colorOverTrail, this.m_ColorOverTrail, new GUILayoutOption[0]);
     if (base.m_ParticleSystemUI.m_ParticleSystem.trails.enabled)
     {
         ParticleSystemRenderer component = base.m_ParticleSystemUI.m_ParticleSystem.GetComponent<ParticleSystemRenderer>();
         if ((component != null) && (component.trailMaterial == null))
         {
             EditorGUILayout.HelpBox("Assign a Trail Material in the Renderer Module", MessageType.Warning, true);
         }
     }
 }
コード例 #5
0
ファイル: Particle3D.cs プロジェクト: cupsster/DFNoiseTest
 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;
 }
コード例 #6
0
 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);
 }
コード例 #7
0
 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]);
     }
 }
コード例 #8
0
 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);
 }
コード例 #9
0
ファイル: UVModuleUI.cs プロジェクト: randomize/VimConfig
 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);
 }
コード例 #10
0
 public override void OnInspectorGUI(ParticleSystem s)
 {
   if (ColorByVelocityModuleUI.s_Texts == null)
     ColorByVelocityModuleUI.s_Texts = new ColorByVelocityModuleUI.Texts();
   this.GUIMinMaxGradient(ColorByVelocityModuleUI.s_Texts.color, this.m_Gradient);
   ModuleUI.GUIMinMaxRange(ColorByVelocityModuleUI.s_Texts.velocityRange, this.m_Range);
 }
コード例 #11
0
 public override void Awake()
 {
     base.Awake();
     beamtf = tf.FindChild("Beam").transform;
     ps = tf.FindChild("Particle System").GetComponent<ParticleSystem>();
     capsule = gameObject.GetComponent<CapsuleCollider>();
 }
コード例 #12
0
 private void Awake()
 {
     ParticleSystem = GetComponent<ParticleSystem>();
       lastTime = Time.realtimeSinceStartup;
       if(!ParticleSystem.playOnAwake)
     ParticleSystem.time = ParticleSystem.duration;
 }
コード例 #13
0
		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);

			}

		}
コード例 #14
0
		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
			}
		}
コード例 #15
0
 /*
 [Serializable]
 internal class ExplosionDesc
 {
 public ChuzzleColor color;
 public Color[] possibleColors;
 }
 */
 void Awake()
 {
     if (!ps)
     {
         ps = GetComponent<ParticleSystem>();
     }
 }
コード例 #16
0
 internal static ParticleSystem[] GetParticleSystems(ParticleSystem root)
 {
   List<ParticleSystem> particleSystems = new List<ParticleSystem>();
   particleSystems.Add(root);
   ParticleEffectUI.GetDirectParticleSystemChildrenRecursive(root.transform, particleSystems);
   return particleSystems.ToArray();
 }
コード例 #17
0
 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);
 }
コード例 #18
0
        public KiPunch(ParticleSystem particleSystem)
        {
            if (particleSystem == null)
                throw new ArgumentNullException("Particle system cannot be null");

            this.particleSystem = particleSystem;
        }
コード例 #19
0
ファイル: ParticleManager.cs プロジェクト: tegleg/mfp
        /// <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;
                }
            }
        }
コード例 #20
0
ファイル: Wheel.cs プロジェクト: FairyHamaLab/Desertion
        private void Start()
        {
            car = transform.parent.GetComponent<CarController>();
            wheelCollider = GetComponent<Collider>() as WheelCollider;

            if (wheelModel != null)
            {
                originalWheelModelPosition = wheelModel.localPosition;
                transform.position = wheelModel.position; // - wheelCollider.suspensionDistance*0.5f*transform.up;
            }

            // store initial starting values of wheelCollider
            sidewaysFriction = wheelCollider.sidewaysFriction;
            forwardFriction = wheelCollider.forwardFriction;
            sidewaysStiffness = wheelCollider.sidewaysFriction.stiffness;
            forwardStiffness = wheelCollider.forwardFriction.stiffness;

            // nominal max rpm at Car's top speed (can be more if Car is rolling downhill!)
            MaxRpm = (car.MaxSpeed/(Mathf.PI*wheelCollider.radius*2))*60;

            // get a reference to the particle system for the tire smoke
            skidSmokeSystem = car.GetComponentInChildren<ParticleSystem>();
            rb = wheelCollider.attachedRigidbody;

            if (skidTrailsDetachedParent == null)
            {
                skidTrailsDetachedParent = new GameObject("Skid Trails - Detached").transform;
            }
        }
コード例 #21
0
 protected override void OnResetPlugin()
 {
     fluidB = null;
     fluidC = null;
     fluidD = null;
     distanceMultiplier = 0.5f;
 }
コード例 #22
0
 public override void Init()
 {
     ParticleSystem = gameObject.GetComponent<ParticleSystem>();
     arc = ParticleSystem.shape.arc;
     Reloaded = false;
     ReloadStarted = false;
 }
コード例 #23
0
		public override void OnInspectorGUI(ParticleSystem s)
		{
			EditorGUI.BeginChangeCheck();
			bool flag = ModuleUI.GUIToggle(ClampVelocityModuleUI.s_Texts.separateAxis, this.m_SeparateAxis);
			if (EditorGUI.EndChangeCheck())
			{
				if (flag)
				{
					this.m_Magnitude.RemoveCurveFromEditor();
				}
				else
				{
					this.m_X.RemoveCurveFromEditor();
					this.m_Y.RemoveCurveFromEditor();
					this.m_Z.RemoveCurveFromEditor();
				}
			}
			if (flag)
			{
				base.GUITripleMinMaxCurve(GUIContent.none, ClampVelocityModuleUI.s_Texts.x, this.m_X, ClampVelocityModuleUI.s_Texts.y, this.m_Y, ClampVelocityModuleUI.s_Texts.z, this.m_Z, null);
				ModuleUI.GUIBoolAsPopup(ClampVelocityModuleUI.s_Texts.space, this.m_InWorldSpace, ClampVelocityModuleUI.s_Texts.spaces);
			}
			else
			{
				ModuleUI.GUIMinMaxCurve(ClampVelocityModuleUI.s_Texts.magnitude, this.m_Magnitude);
			}
			ModuleUI.GUIFloat(ClampVelocityModuleUI.s_Texts.dampen, this.m_Dampen);
		}
コード例 #24
0
		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;
		}
コード例 #25
0
ファイル: CosmosParticle.cs プロジェクト: bjsvochak/hof16
        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)));
            }
        }
コード例 #26
0
        private void Awake()
        {
            _explosionParticles = Instantiate(ExplosionPrefab).GetComponent<ParticleSystem>();
            _explosionAudio = _explosionParticles.GetComponent<AudioSource>();

            _explosionParticles.gameObject.SetActive(false);
        }
コード例 #27
0
 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);
 }
コード例 #28
0
		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];

		}
コード例 #29
0
ファイル: BunchOfLeaves.cs プロジェクト: Kundara/project1
		// Use this for initialization
		void Start () {
			particles = GetComponent<ParticleSystem>();
			circleColider = GetComponent <CircleCollider2D>();
			animator = GetComponent<Animator>();

			timeToRespawn = timeToRespawn + Random.Range ( timeToRespawn * 0.96f , timeToRespawn * 1.04f);
		}
コード例 #30
0
 protected override void Awake()
 {
     base.Awake();
     waterSpray = transform.FindChild("WaterSpray").gameObject;
     particles = waterSpray.GetComponent<ParticleSystem>();
     particles.Stop();
 }
コード例 #31
0
 static public int GetSafeTriggerParticlesSize(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         UnityEngine.ParticleSystemTriggerEventType a2;
         checkEnum(l, 2, out a2);
         var ret = self.GetSafeTriggerParticlesSize(a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #32
0
 static public int SetCustomParticleData(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         System.Collections.Generic.List <UnityEngine.Vector4> a1;
         checkType(l, 2, out a1);
         UnityEngine.ParticleSystemCustomData a2;
         checkEnum(l, 3, out a2);
         self.SetCustomParticleData(a1, a2);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #33
0
 static void ParticleSystem_randomSeed(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         var result = _this.randomSeed;
         JSApi.setUInt32((int)JSApi.SetType.Rval, (System.UInt32)(result));
     }
     else
     {
         System.UInt32 arg0 = (System.UInt32)JSApi.getUInt32((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         _this.randomSeed = arg0;
     }
 }
コード例 #34
0
 static void ParticleSystem_playOnAwake(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         var result = _this.playOnAwake;
         JSApi.setBooleanS((int)JSApi.SetType.Rval, (System.Boolean)(result));
     }
     else
     {
         System.Boolean             arg0  = (System.Boolean)JSApi.getBooleanS((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         _this.playOnAwake = arg0;
     }
 }
コード例 #35
0
 static public int SetParticles(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem            self = (UnityEngine.ParticleSystem)checkSelf(l);
         UnityEngine.ParticleSystem.Particle[] a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.SetParticles(a1, a2);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #36
0
 static void ParticleSystem_simulationSpace(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         var result = _this.simulationSpace;
         JSApi.setEnum((int)JSApi.SetType.Rval, (int)result);
     }
     else
     {
         UnityEngine.ParticleSystemSimulationSpace arg0 = (UnityEngine.ParticleSystemSimulationSpace)JSApi.getEnum((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         _this.simulationSpace = arg0;
     }
 }
コード例 #37
0
 static public int GetParticles(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem            self = (UnityEngine.ParticleSystem)checkSelf(l);
         UnityEngine.ParticleSystem.Particle[] a1;
         checkArray(l, 2, out a1);
         var ret = self.GetParticles(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #38
0
 static public int GetParticles(IntPtr l)
 {
     try{
         UnityEngine.ParticleSystem            self = (UnityEngine.ParticleSystem)checkSelf(l);
         UnityEngine.ParticleSystem.Particle[] a1;
         checkType(l, 2, out a1);
         System.Int32 ret = self.GetParticles(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #39
0
 static void ParticleSystem_gravityModifier(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         var result = _this.gravityModifier;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         _this.gravityModifier = arg0;
     }
 }
コード例 #40
0
 static void ParticleSystem_startRotation3D(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         var result = _this.startRotation3D;
         JSApi.setVector3S((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.Vector3        arg0  = (UnityEngine.Vector3)JSApi.getVector3S((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         _this.startRotation3D = arg0;
     }
 }
コード例 #41
0
 static public int IsAlive__Boolean(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         System.Boolean             a1;
         checkType(l, 2, out a1);
         var ret = self.IsAlive(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #42
0
 static void ParticleSystem_playbackSpeed(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         var result = _this.playbackSpeed;
         JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result));
     }
     else
     {
         System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         _this.playbackSpeed = arg0;
     }
 }
コード例 #43
0
 static void ParticleSystem_startColor(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         var result = _this.startColor;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.Color          arg0  = (UnityEngine.Color)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem _this = (UnityEngine.ParticleSystem)vc.csObj;
         _this.startColor = arg0;
     }
 }
コード例 #44
0
 static public int TriggerSubEmitter__Int32__List_1_Particle(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.List <UnityEngine.ParticleSystem.Particle> a2;
         checkType(l, 3, out a2);
         self.TriggerSubEmitter(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #45
0
 static public int SetTriggerParticles__ParticleSystem__ParticleSystemTriggerEventType__List_1_Particle(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         UnityEngine.ParticleSystemTriggerEventType a2;
         checkEnum(l, 2, out a2);
         System.Collections.Generic.List <UnityEngine.ParticleSystem.Particle> a3;
         checkType(l, 3, out a3);
         self.SetTriggerParticles(a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #46
0
        public static void ClusterSimulate(this UnityEngine.ParticleSystem ps, float t)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Simulate(t);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.simulate;
            op.paras     = new object[1];
            op.paras[0]  = t;
            observer.addOperation(op);
        }
コード例 #47
0
        public static void ClusterSetRandomSeed(this UnityEngine.ParticleSystem ps, uint randomSeed)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.randomSeed = randomSeed;
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.setRandomSeed;
            op.paras     = new object[1];
            op.paras[0]  = (int)randomSeed;
            observer.addOperation(op);
        }
コード例 #48
0
        public static void ClusterEmit(this UnityEngine.ParticleSystem ps, int count)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Emit(count);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.emit;
            op.paras     = new object[1];
            op.paras[0]  = count;
            observer.addOperation(op);
        }
コード例 #49
0
        public static void ClusterClear(this UnityEngine.ParticleSystem ps, bool withChildren)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Clear(withChildren);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.clear;
            op.paras     = new object[1];
            op.paras[0]  = withChildren;
            observer.addOperation(op);
        }
 static void SubEmittersModule_collision1(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem.SubEmittersModule _this = (UnityEngine.ParticleSystem.SubEmittersModule)vc.csObj;
         var result = _this.collision1;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.ParticleSystem arg0 = (UnityEngine.ParticleSystem)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem.SubEmittersModule _this = (UnityEngine.ParticleSystem.SubEmittersModule)vc.csObj;
         _this.collision1 = arg0;
         JSMgr.changeJSObj(vc.jsObjID, _this);
     }
 }
コード例 #51
0
 static public int Emit__EmitParams__Int32(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem            self = (UnityEngine.ParticleSystem)checkSelf(l);
         UnityEngine.ParticleSystem.EmitParams a1;
         checkValueType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         self.Emit(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #52
0
 static public int Stop__Boolean__ParticleSystemStopBehavior(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         System.Boolean             a1;
         checkType(l, 2, out a1);
         UnityEngine.ParticleSystemStopBehavior a2;
         checkEnum(l, 3, out a2);
         self.Stop(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #53
0
 static public int Simulate__Single__Boolean(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         System.Boolean a2;
         checkType(l, 3, out a2);
         self.Simulate(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #54
0
        private void AddEmitterSource(ref UnityEngine.ParticleSystem uParticleSystem, Entity eParticleSystem)
        {
            if (!uParticleSystem.shape.enabled)
            {
                return;
            }

            switch (uParticleSystem.shape.shapeType)
            {
            case ParticleSystemShapeType.Cone:
                DstEntityManager.AddComponentData(eParticleSystem, new EmitterConeSource
                {
                    Radius = uParticleSystem.shape.radius,
                    Angle  = uParticleSystem.shape.angle
                });
                break;

            case ParticleSystemShapeType.Circle:
                DstEntityManager.AddComponentData(eParticleSystem, new EmitterCircleSource
                {
                    Radius = uParticleSystem.shape.radius
                });
                break;

            case ParticleSystemShapeType.Rectangle:
                DstEntityManager.AddComponentData(eParticleSystem, new EmitterRectangleSource());
                break;

            case ParticleSystemShapeType.Sphere:
                DstEntityManager.AddComponentData(eParticleSystem, new EmitterSphereSource
                {
                    Radius = uParticleSystem.shape.radius
                });
                break;

            case ParticleSystemShapeType.Hemisphere:
                DstEntityManager.AddComponentData(eParticleSystem, new EmitterHemisphereSource
                {
                    Radius = uParticleSystem.shape.radius
                });
                break;

            default:
                UnityEngine.Debug.LogWarning("ParticleSystemShapeType " + nameof(uParticleSystem.shape.shapeType) + " not supported.");
                break;
            }
        }
コード例 #55
0
 static public int Emit(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(UnityEngine.ParticleSystem.Particle)))
         {
             UnityEngine.ParticleSystem          self = (UnityEngine.ParticleSystem)checkSelf(l);
             UnityEngine.ParticleSystem.Particle a1;
             checkValueType(l, 2, out a1);
             self.Emit(a1);
             pushValue(l, true);
             return(1);
         }
         else if (matchType(l, argc, 2, typeof(int)))
         {
             UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             self.Emit(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 6)
         {
             UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
             UnityEngine.Vector3        a1;
             checkType(l, 2, out a1);
             UnityEngine.Vector3 a2;
             checkType(l, 3, out a2);
             System.Single a3;
             checkType(l, 4, out a3);
             System.Single a4;
             checkType(l, 5, out a4);
             UnityEngine.Color32 a5;
             checkValueType(l, 6, out a5);
             self.Emit(a1, a2, a3, a4, a5);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #56
0
 static public int GetCollisionEvents(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         UnityEngine.GameObject     a1;
         checkType(l, 2, out a1);
         UnityEngine.ParticleSystem.CollisionEvent[] a2;
         checkType(l, 3, out a2);
         var ret = self.GetCollisionEvents(a1, a2);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #57
0
 static public int TriggerSubEmitter__Int32__R_Particle(IntPtr l)
 {
     try {
         UnityEngine.ParticleSystem self = (UnityEngine.ParticleSystem)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         UnityEngine.ParticleSystem.Particle a2;
         checkValueType(l, 3, out a2);
         self.TriggerSubEmitter(a1, ref a2);
         pushValue(l, true);
         pushValue(l, a2);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #58
0
 private static void FillEffector(UnityEngine.ParticleSystem ups, ParticleSystem ps)
 {
     foreach (var effect in ps.Effectors)
     {
         try
         {
             effect.ApplyToUnityParticleSystem(ups, ps);
         }
         catch (NotImplementedException ex)
         {
             UnityEngine.Debug.LogErrorFormat("{0},{1}", ex.Message, effect.GetType().ToString());
         }
         finally
         {
         }
     }
 }
コード例 #59
0
        public static void ClusterStop(this UnityEngine.ParticleSystem ps, bool withChildren, ParticleSystemStopBehavior stopBehavior)
        {
            var observer = validateCheck(ps);

            if (observer == null)
            {
                return;
            }
            ps.Stop(withChildren, stopBehavior);
            FduParticleSystemOP op = new FduParticleSystemOP();

            op.operation = FduParticleSystemOP.Operation.stop;
            op.paras     = new object[2];
            op.paras[0]  = withChildren;
            op.paras[1]  = (byte)stopBehavior;
            observer.addOperation(op);
        }
コード例 #60
0
        static int _m_Stop(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.ParticleSystem __cl_gen_to_be_invoked = (UnityEngine.ParticleSystem)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 1)
                {
                    __cl_gen_to_be_invoked.Stop(  );



                    return(0);
                }
                if (__gen_param_count == 2 && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2))
                {
                    bool withChildren = LuaAPI.lua_toboolean(L, 2);

                    __cl_gen_to_be_invoked.Stop(withChildren);



                    return(0);
                }
                if (__gen_param_count == 3 && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2) && translator.Assignable <UnityEngine.ParticleSystemStopBehavior>(L, 3))
                {
                    bool withChildren = LuaAPI.lua_toboolean(L, 2);
                    UnityEngine.ParticleSystemStopBehavior stopBehavior; translator.Get(L, 3, out stopBehavior);

                    __cl_gen_to_be_invoked.Stop(withChildren, stopBehavior);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.ParticleSystem.Stop!"));
        }