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


C# PlaygroundParticlesC.RefreshScatter方法代码示例

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


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

示例1: SetParticleCount


//.........这里部分代码省略.........
            playgroundParticles.particleCache = new ParticleSystem.Particle[amount];
            playgroundParticles.shurikenParticleSystem.Emit(amount);
            playgroundParticles.shurikenParticleSystem.GetParticles(playgroundParticles.particleCache);

            playgroundParticles.inTransition = false;
            playgroundParticles.hasActiveParticles = true;
            playgroundParticles.threadHadNoActiveParticles = false;

            playgroundParticles.isSettingParticleCount = true;
            PlaygroundC.RunAsync(()=>{
                if (!playgroundParticles.isSettingParticleCount) return;
                if (playgroundParticles.playgroundCache==null)
                    playgroundParticles.playgroundCache = new PlaygroundCache();

                // Rebuild Cache
                playgroundParticles.playgroundCache.size = new float[amount];
                playgroundParticles.playgroundCache.birth = new float[amount];
                playgroundParticles.playgroundCache.death = new float[amount];
                playgroundParticles.playgroundCache.rebirth = new bool[amount];
                playgroundParticles.playgroundCache.birthDelay = new float[amount];
                playgroundParticles.playgroundCache.life = new float[amount];
                playgroundParticles.playgroundCache.lifetimeSubtraction = new float[amount];
                playgroundParticles.playgroundCache.rotation = new float[amount];
                playgroundParticles.playgroundCache.lifetimeOffset = new float[amount];
                playgroundParticles.playgroundCache.emission = new bool[amount];
                playgroundParticles.playgroundCache.changedByProperty = new bool[amount];
                playgroundParticles.playgroundCache.changedByPropertyColor = new bool[amount];
                playgroundParticles.playgroundCache.changedByPropertyColorLerp = new bool[amount];
                playgroundParticles.playgroundCache.changedByPropertyColorKeepAlpha = new bool[amount];
                playgroundParticles.playgroundCache.changedByPropertySize = new bool[amount];
                playgroundParticles.playgroundCache.changedByPropertyTarget = new bool[amount];
                playgroundParticles.playgroundCache.changedByPropertyDeath = new bool[amount];
                playgroundParticles.playgroundCache.propertyTarget = new int[amount];
                playgroundParticles.playgroundCache.propertyId = new int[amount];
                playgroundParticles.playgroundCache.excludeFromManipulatorId = new int[amount];
                playgroundParticles.playgroundCache.propertyColorId = new int[amount];
                playgroundParticles.playgroundCache.manipulatorId = new int[amount];
                playgroundParticles.playgroundCache.color = new Color32[amount];
                playgroundParticles.playgroundCache.scriptedColor = new Color32[amount];
                playgroundParticles.playgroundCache.initialColor = new Color32[amount];
                playgroundParticles.playgroundCache.lifetimeColorId = new int[amount];
                playgroundParticles.playgroundCache.noForce = new bool[amount];
                playgroundParticles.playgroundCache.position = new Vector3[amount];
                playgroundParticles.playgroundCache.targetPosition = new Vector3[amount];
                playgroundParticles.playgroundCache.targetDirection = new Vector3[amount];
                playgroundParticles.playgroundCache.previousTargetPosition = new Vector3[amount];
                playgroundParticles.playgroundCache.previousParticlePosition = new Vector3[amount];
                playgroundParticles.playgroundCache.collisionParticlePosition = new Vector3[amount];
                playgroundParticles.playgroundCache.localSpaceMovementCompensation = new Vector3[amount];
                playgroundParticles.playgroundCache.scatterPosition = new Vector3[amount];
                playgroundParticles.playgroundCache.velocity = new Vector3[amount];
                playgroundParticles.playgroundCache.isMasked = new bool[amount];
                playgroundParticles.playgroundCache.maskAlpha = new float[amount];
                playgroundParticles.playgroundCache.isNonBirthed = new bool[amount];
                playgroundParticles.playgroundCache.isFirstLoop = new bool[amount];
                playgroundParticles.playgroundCache.simulate = new bool[amount];
                playgroundParticles.playgroundCache.isCalculatedThisFrame = new bool[amount];
                playgroundParticles.playgroundCache.maskSorting = null;

                for (int i = 0; i<amount; i++) {
                    playgroundParticles.particleCache[i].size = 0f;
                    playgroundParticles.playgroundCache.rebirth[i] = true;
                    playgroundParticles.playgroundCache.simulate[i] = true;
                    playgroundParticles.playgroundCache.isNonBirthed[i] = true;
                    playgroundParticles.playgroundCache.isFirstLoop[i] = true;

                    // Set color gradient id
                    if (playgroundParticles.colorSource==COLORSOURCEC.LifetimeColors && playgroundParticles.lifetimeColors.Count>0) {
                        playgroundParticles.lifetimeColorId++;playgroundParticles.lifetimeColorId=playgroundParticles.lifetimeColorId%playgroundParticles.lifetimeColors.Count;
                        playgroundParticles.playgroundCache.lifetimeColorId[i] = playgroundParticles.lifetimeColorId;
                    }
                }

                // Set sizes
                SetSizeRandom(playgroundParticles, playgroundParticles.sizeMin, playgroundParticles.sizeMax);
                playgroundParticles.previousSizeMin = playgroundParticles.sizeMin;
                playgroundParticles.previousSizeMax = playgroundParticles.sizeMax;

                // Set rotations
                playgroundParticles.playgroundCache.initialRotation = RandomFloat(amount, playgroundParticles.initialRotationMin, playgroundParticles.initialRotationMax, playgroundParticles.internalRandom01);
                playgroundParticles.playgroundCache.rotationSpeed = RandomFloat(amount, playgroundParticles.rotationSpeedMin, playgroundParticles.rotationSpeedMax, playgroundParticles.internalRandom01);
                playgroundParticles.previousInitialRotationMin = playgroundParticles.initialRotationMin;
                playgroundParticles.previousInitialRotationMax = playgroundParticles.initialRotationMax;
                playgroundParticles.previousRotationSpeedMin = playgroundParticles.rotationSpeedMin;
                playgroundParticles.previousRotationSpeedMax = playgroundParticles.rotationSpeedMax;

                // Set velocities
                SetVelocityRandom(playgroundParticles, playgroundParticles.initialVelocityMin, playgroundParticles.initialVelocityMax);
                SetLocalVelocityRandom(playgroundParticles, playgroundParticles.initialLocalVelocityMin, playgroundParticles.initialLocalVelocityMax);

                // Set Emission
                Emission(playgroundParticles, playgroundParticles.emit, false);

                // Make sure scatter is available first lifetime cycle
                if (playgroundParticles.applySourceScatter)
                    playgroundParticles.RefreshScatter();
                playgroundParticles.isDoneThread = true;
                playgroundParticles.isSettingParticleCount = false;
            });
        }
开发者ID:PawkaHub,项目名称:Lore-Unity,代码行数:101,代码来源:PlaygroundParticlesC.cs

示例2: RefreshScatter

		/// <summary>
		/// Refreshes source scatter for this Particle System.
		/// </summary>
		/// <param name="playgroundParticles">Playground particles.</param>
		public static void RefreshScatter (PlaygroundParticlesC playgroundParticles) {
			playgroundParticles.RefreshScatter();
		}
开发者ID:nermakov777,项目名称:Unity_Tests,代码行数:7,代码来源:PlaygroundC.cs

示例3: SetParticleCount

		// Sets the amount of particles and initiates the necessary arrays
		public static void SetParticleCount (PlaygroundParticlesC playgroundParticles, int amount) {
			if (amount<0) amount = 0;

			playgroundParticles.particleCount = amount;

			// Create Particles
			playgroundParticles.particleCache = new ParticleSystem.Particle[amount];
			playgroundParticles.shurikenParticleSystem.Emit(amount);
			playgroundParticles.shurikenParticleSystem.GetParticles(playgroundParticles.particleCache);

			PlaygroundC.RunAsync(()=>{
			
			
			if (playgroundParticles.playgroundCache==null)
				playgroundParticles.playgroundCache = new PlaygroundCache();
			
			for (int i = 0; i<amount; i++) {
				playgroundParticles.particleCache[i].position = PlaygroundC.initialTargetPosition;
				playgroundParticles.particleCache[i].size = 0f;
			}
			
			playgroundParticles.inTransition = false;

			// Rebuild Cache
			playgroundParticles.playgroundCache.size = new float[amount];
			playgroundParticles.playgroundCache.birth = new float[amount];
			playgroundParticles.playgroundCache.death = new float[amount];
			playgroundParticles.playgroundCache.rebirth = new bool[amount];
			playgroundParticles.playgroundCache.birthDelay = new float[amount];
			playgroundParticles.playgroundCache.life = new float[amount];
			playgroundParticles.playgroundCache.rotation = new float[amount];
			playgroundParticles.playgroundCache.lifetimeOffset = new float[amount];
			playgroundParticles.playgroundCache.emission = new bool[amount];
			playgroundParticles.playgroundCache.changedByProperty = new bool[amount];
			playgroundParticles.playgroundCache.changedByPropertyColor = new bool[amount];
			playgroundParticles.playgroundCache.changedByPropertyColorLerp = new bool[amount];
			playgroundParticles.playgroundCache.changedByPropertyColorKeepAlpha = new bool[amount];
			playgroundParticles.playgroundCache.changedByPropertySize = new bool[amount];
			playgroundParticles.playgroundCache.changedByPropertyTarget = new bool[amount];
			playgroundParticles.playgroundCache.changedByPropertyDeath = new bool[amount];
			playgroundParticles.playgroundCache.propertyTarget = new int[amount];
			playgroundParticles.playgroundCache.propertyId = new int[amount];
			playgroundParticles.playgroundCache.propertyColorId = new int[amount];
			playgroundParticles.playgroundCache.color = new Color32[amount];
			playgroundParticles.playgroundCache.scriptedColor = new Color32[amount];
			playgroundParticles.playgroundCache.initialColor = new Color32[amount];
			playgroundParticles.playgroundCache.lifetimeColorId = new int[amount];
			playgroundParticles.playgroundCache.position = new Vector3[amount];
			playgroundParticles.playgroundCache.targetPosition = new Vector3[amount];
			playgroundParticles.playgroundCache.targetDirection = new Vector3[amount];
			playgroundParticles.playgroundCache.previousTargetPosition = new Vector3[amount];
			playgroundParticles.playgroundCache.previousParticlePosition = new Vector3[amount];
			playgroundParticles.playgroundCache.collisionParticlePosition = new Vector3[amount];
			playgroundParticles.playgroundCache.localSpaceMovementCompensation = new Vector3[amount];
			playgroundParticles.playgroundCache.scatterPosition = new Vector3[amount];
			playgroundParticles.playgroundCache.velocity = new Vector3[amount];
			playgroundParticles.playgroundCache.isMasked = new bool[amount];
			playgroundParticles.playgroundCache.maskAlpha = new float[amount];
			playgroundParticles.previousParticleCount = playgroundParticles.particleCount;

			// Set sizes
			SetSizeRandom(playgroundParticles, playgroundParticles.sizeMin, playgroundParticles.sizeMax);
			playgroundParticles.previousSizeMin = playgroundParticles.sizeMin;
			playgroundParticles.previousSizeMax = playgroundParticles.sizeMax;
			
			// Set rotations
			playgroundParticles.playgroundCache.initialRotation = RandomFloat(amount, playgroundParticles.initialRotationMin, playgroundParticles.initialRotationMax);
			playgroundParticles.playgroundCache.rotationSpeed = RandomFloat(amount, playgroundParticles.rotationSpeedMin, playgroundParticles.rotationSpeedMax);
			playgroundParticles.previousInitialRotationMin = playgroundParticles.initialRotationMin;
			playgroundParticles.previousInitialRotationMax = playgroundParticles.initialRotationMax;
			playgroundParticles.previousRotationSpeedMin = playgroundParticles.rotationSpeedMin;
			playgroundParticles.previousRotationSpeedMax = playgroundParticles.rotationSpeedMax;
		
			// Set velocities
			SetVelocityRandom(playgroundParticles, playgroundParticles.initialVelocityMin, playgroundParticles.initialVelocityMax);
			SetLocalVelocityRandom(playgroundParticles, playgroundParticles.initialLocalVelocityMin, playgroundParticles.initialLocalVelocityMax);
			
			// Set Emission
			Emission(playgroundParticles, playgroundParticles.emit, false);
			
			// Make sure scatter is available first lifetime cycle
			if (playgroundParticles.applySourceScatter)
				playgroundParticles.RefreshScatter();
			
			playgroundParticles.isDoneThread = true;
			});
		}
开发者ID:Raj2509,项目名称:net.kibotu.sandbox.unity.dragnslay,代码行数:88,代码来源:PlaygroundParticlesC.cs


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