本文整理汇总了C#中ParticlePlayground.PlaygroundParticlesC.Start方法的典型用法代码示例。如果您正苦于以下问题:C# PlaygroundParticlesC.Start方法的具体用法?C# PlaygroundParticlesC.Start怎么用?C# PlaygroundParticlesC.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticlePlayground.PlaygroundParticlesC
的用法示例。
在下文中一共展示了PlaygroundParticlesC.Start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThreadedCalculations
public static void ThreadedCalculations (PlaygroundParticlesC playgroundParticles) {
// Component disabled?
if (!playgroundParticles.enabled || !playgroundParticles.isDoneThread) return;
// Has the calculation been paused previously?
if (playgroundParticles.cameFromNonCalculatedFrame) {
playgroundParticles.Start();
playgroundParticles.cameFromNonCalculatedFrame = false;
return;
}
// Apply locked position
if (playgroundParticles.applyLockPosition) {
if (playgroundParticles.lockPositionIsLocal)
playgroundParticles.particleSystemTransform.localPosition = playgroundParticles.lockPosition;
else
playgroundParticles.particleSystemTransform.position = playgroundParticles.lockPosition;
}
// Apply locked rotation
if (playgroundParticles.applyLockRotation) {
if (playgroundParticles.lockRotationIsLocal)
playgroundParticles.particleSystemTransform.localRotation = Quaternion.Euler(playgroundParticles.lockRotation);
else
playgroundParticles.particleSystemTransform.rotation = Quaternion.Euler(playgroundParticles.lockRotation);
}
// Apply locked scale
if (playgroundParticles.applyLockScale)
playgroundParticles.particleSystemTransform.localScale = playgroundParticles.lockScale;
// Set delta time
playgroundParticles.localDeltaTime = PlaygroundC.globalTime-playgroundParticles.lastTimeUpdated;
playgroundParticles.lastTimeUpdated = PlaygroundC.globalTime;
float t = (playgroundParticles.localDeltaTime*playgroundParticles.particleTimescale);
// Prepare Source positions
Vector3 stPos = Vector3.zero;
Quaternion stRot = Quaternion.identity;
Vector3 stSca = new Vector3(1f, 1f, 1f);
Vector3 stDir = new Vector3();
bool localSpace = (playgroundParticles.shurikenParticleSystem.simulationSpace == ParticleSystemSimulationSpace.Local);
bool overflow = (playgroundParticles.overflowOffset!=Vector3.zero);
bool skinnedWorldObjectReady = false;
playgroundParticles.renderModeStretch = playgroundParticles.particleSystemRenderer2.renderMode==ParticleSystemRenderMode.Stretch;
if (playgroundParticles.emit) {
switch (playgroundParticles.source) {
case SOURCEC.Script:
break;
case SOURCEC.State:
if (playgroundParticles.states.Count>0) {
if (playgroundParticles.states[playgroundParticles.activeState].stateTransform!=null) {
if (!playgroundParticles.states[playgroundParticles.activeState].initialized)
playgroundParticles.states[playgroundParticles.activeState].Initialize ();
stPos = playgroundParticles.states[playgroundParticles.activeState].stateTransform.position;
stRot = playgroundParticles.states[playgroundParticles.activeState].stateTransform.rotation;
stSca = playgroundParticles.states[playgroundParticles.activeState].stateTransform.localScale;
if (localSpace && (playgroundParticles.states[playgroundParticles.activeState].stateTransform.parent==playgroundParticles.particleSystemTransform || playgroundParticles.states[playgroundParticles.activeState].stateTransform==playgroundParticles.particleSystemTransform)) {
stPos = Vector3.zero;
stRot = Quaternion.Euler (Vector3.zero);
}
}
} else return;
break;
case SOURCEC.Transform:
stPos = playgroundParticles.sourceTransform.position;
stRot = playgroundParticles.sourceTransform.rotation;
stSca = playgroundParticles.sourceTransform.localScale;
if (localSpace && playgroundParticles.sourceTransform==playgroundParticles.particleSystemTransform) {
stPos = Vector3.zero;
stRot = Quaternion.Euler (Vector3.zero);
}
break;
case SOURCEC.WorldObject:
// Handle vertex data in active World Object
if (playgroundParticles.worldObject.gameObject!=null) {
if (playgroundParticles.worldObject.gameObject.GetInstanceID()!=playgroundParticles.worldObject.cachedId)
playgroundParticles.worldObject = NewWorldObject(playgroundParticles.worldObject.gameObject.transform);
if (playgroundParticles.worldObject.mesh!=null) {
stPos = playgroundParticles.worldObject.transform.position;
stRot = playgroundParticles.worldObject.transform.rotation;
stSca = playgroundParticles.worldObject.transform.localScale;
if (localSpace) {
stPos = Vector3.zero;
stRot = Quaternion.Euler (Vector3.zero);
}
playgroundParticles.worldObject.updateNormals = playgroundParticles.worldObjectUpdateNormals;
if (playgroundParticles.worldObjectUpdateVertices)
playgroundParticles.worldObject.Update ();
} else return;
} else return;
break;
//.........这里部分代码省略.........
示例2: Update
// Updates a PlaygroundParticlesC object (called from Playground)
public static void Update (PlaygroundParticlesC playgroundParticles) {
if (playgroundParticles.isYieldRefreshing || playgroundParticles.isLoading || playgroundParticles.playgroundCache==null) return;
// Emission halt for disabling called from calculation thread
if (playgroundParticles.queueEmissionHalt)
playgroundParticles.particleSystemGameObject.SetActive(false);
// Particle count
if (playgroundParticles.particleCount!=playgroundParticles.previousParticleCount) {
SetParticleCount(playgroundParticles, playgroundParticles.particleCount);
playgroundParticles.Start();
return;
}
// Particle emission
if (playgroundParticles.emit!=playgroundParticles.previousEmission) {
playgroundParticles.Emit (playgroundParticles.emit);
}
// Particle size
if (playgroundParticles.sizeMin!=playgroundParticles.previousSizeMin || playgroundParticles.sizeMax!=playgroundParticles.previousSizeMax)
SetSizeRandom(playgroundParticles, playgroundParticles.sizeMin, playgroundParticles.sizeMax);
// Particle rotation
if (playgroundParticles.initialRotationMin!=playgroundParticles.previousInitialRotationMin || playgroundParticles.initialRotationMax!=playgroundParticles.previousInitialRotationMax)
SetInitialRotationRandom(playgroundParticles, playgroundParticles.initialRotationMin, playgroundParticles.initialRotationMax);
if (playgroundParticles.rotationSpeedMin!=playgroundParticles.previousRotationSpeedMin || playgroundParticles.rotationSpeedMax!=playgroundParticles.previousRotationSpeedMax)
SetRotationRandom(playgroundParticles, playgroundParticles.rotationSpeedMin, playgroundParticles.rotationSpeedMax);
// Particle velocity
if (playgroundParticles.applyInitialVelocity)
if (playgroundParticles.initialVelocityMin!=playgroundParticles.previousVelocityMin || playgroundParticles.initialVelocityMax!=playgroundParticles.previousVelocityMax || playgroundParticles.playgroundCache.initialVelocity==null || playgroundParticles.playgroundCache.initialVelocity.Length!=playgroundParticles.particleCount)
SetVelocityRandom(playgroundParticles, playgroundParticles.initialVelocityMin, playgroundParticles.initialVelocityMax);
// Particle local velocity
if (playgroundParticles.applyInitialLocalVelocity)
if (playgroundParticles.initialLocalVelocityMin!=playgroundParticles.previousLocalVelocityMin || playgroundParticles.initialLocalVelocityMax!=playgroundParticles.previousLocalVelocityMax || playgroundParticles.playgroundCache.initialLocalVelocity==null || playgroundParticles.playgroundCache.initialLocalVelocity.Length!=playgroundParticles.particleCount)
SetLocalVelocityRandom(playgroundParticles, playgroundParticles.initialLocalVelocityMin, playgroundParticles.initialLocalVelocityMax);
// Particle life
if (playgroundParticles.previousLifetime!=playgroundParticles.lifetime) {
SetLifetime(playgroundParticles, playgroundParticles.sorting, playgroundParticles.lifetime);
return;
}
// Particle emission rate
if (playgroundParticles.previousEmissionRate!=playgroundParticles.emissionRate)
SetEmissionRate(playgroundParticles);
// Particle state change
if (playgroundParticles.source==SOURCEC.State && playgroundParticles.activeState!=playgroundParticles.previousActiveState) {
if (playgroundParticles.states[playgroundParticles.activeState].positionLength>playgroundParticles.particleCount)
SetParticleCount(playgroundParticles, playgroundParticles.states[playgroundParticles.activeState].positionLength);
playgroundParticles.previousActiveState = playgroundParticles.activeState;
}
// Particle calculation
if (PlaygroundC.reference.calculate && playgroundParticles.calculate && !playgroundParticles.inTransition)
ThreadedCalculations(playgroundParticles);
else playgroundParticles.cameFromNonCalculatedFrame = true;
// Assign all particles into the particle system
if (!playgroundParticles.inTransition && playgroundParticles.particleCache.Length>0 && playgroundParticles.calculate)
playgroundParticles.shurikenParticleSystem.SetParticles(playgroundParticles.particleCache, playgroundParticles.particleCache.Length);
// Make sure this particle system is playing
if (playgroundParticles.shurikenParticleSystem.isPaused || playgroundParticles.shurikenParticleSystem.isStopped)
playgroundParticles.shurikenParticleSystem.Play();
}