本文整理汇总了C#中ParticlePlayground.PlaygroundParticlesC.GetLayer方法的典型用法代码示例。如果您正苦于以下问题:C# PlaygroundParticlesC.GetLayer方法的具体用法?C# PlaygroundParticlesC.GetLayer怎么用?C# PlaygroundParticlesC.GetLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticlePlayground.PlaygroundParticlesC
的用法示例。
在下文中一共展示了PlaygroundParticlesC.GetLayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThreadedCalculations
//.........这里部分代码省略.........
playgroundParticles.playgroundCache.position[p] = PlaygroundC.initialTargetPosition;
}
} else {
// Particle exceeded with death property
if (!playgroundParticles.loop && !playgroundParticles.playgroundCache.isNonBirthed[p]) {
// Send death event for particles which died of unnatural cause such as property death, the worst type of death
if (playgroundParticles.hasEvent||playgroundParticles.hasEventManipulatorGlobal||playgroundParticles.hasEventManipulatorLocal)
SendDeathEvents(playgroundParticles, p);
playgroundParticles.InactivateParticle(p);
continue;
}
// Loop exceeded normally
if (!playgroundParticles.loop && playgroundParticles.localTime>playgroundParticles.simulationStarted+(playgroundParticles.playgroundCache.death[p]-playgroundParticles.playgroundCache.birth[p])-.01f) {
playgroundParticles.loopExceeded = true;
if (playgroundParticles.loopExceededOnParticle==p && evaluatedLife>2f) {
if (playgroundParticles.disableOnDone)
playgroundParticles.queueEmissionHalt = true;
playgroundParticles.threadHadNoActiveParticles = true;
playgroundParticles.hasActiveParticles = false;
}
if (playgroundParticles.loopExceededOnParticle==-1)
playgroundParticles.loopExceededOnParticle = p;
}
playgroundParticles.particleCache[p].velocity = zero;
// Send death event for particles with full lifetime length
if ((playgroundParticles.hasEvent||playgroundParticles.hasEventManipulatorGlobal||playgroundParticles.hasEventManipulatorLocal) && !playgroundParticles.playgroundCache.isNonBirthed[p])
SendDeathEvents(playgroundParticles, p);
// New cycle begins
if (playgroundParticles.localTime>=playgroundParticles.playgroundCache.birth[p]+playgroundParticles.playgroundCache.birthDelay[p] && !playgroundParticles.loopExceeded && playgroundParticles.source!=SOURCEC.Script && playgroundParticles.emit) {
if (!playgroundParticles.playgroundCache.changedByPropertyDeath[p] || playgroundParticles.playgroundCache.changedByPropertyDeath[p] && playgroundParticles.localTime>playgroundParticles.playgroundCache.death[p]) {
Rebirth(playgroundParticles, p, playgroundParticles.internalRandom01);
} else {
playgroundParticles.particleCache[p].velocity = zero;
playgroundParticles.particleCache[p].size = 0;
playgroundParticles.playgroundCache.position[p] = PlaygroundC.initialTargetPosition;
}
} else {
playgroundParticles.InactivateParticle(p);
continue;
}
}
// Local Manipulators
for (int m = 0; m<playgroundParticles.manipulators.Count; m++) {
CalculateManipulator(playgroundParticles, playgroundParticles.manipulators[m], p, t, playgroundParticles.playgroundCache.life[p], playgroundParticles.playgroundCache.position[p], (playgroundParticles.localSpace?playgroundParticles.manipulators[m].transform.localPosition:playgroundParticles.manipulators[m].transform.position)+playgroundParticles.manipulatorFix, playgroundParticles.localSpace);
}
// Global Manipulators
if (playgroundParticles.hasGlobalAffectingManipulators) {
for (int m = 0; m<PlaygroundC.reference.manipulators.Count; m++) {
if ((PlaygroundC.reference.manipulators[m].affects.value & 1<<playgroundParticles.GetLayer())!=0)
CalculateManipulator(playgroundParticles, PlaygroundC.reference.manipulators[m], p, t, playgroundParticles.playgroundCache.life[p], playgroundParticles.playgroundCache.position[p], (playgroundParticles.localSpace?PlaygroundC.reference.manipulators[m].transform.localPosition:PlaygroundC.reference.manipulators[m].transform.position)+playgroundParticles.manipulatorFix, playgroundParticles.localSpace);
}
}
// Set particle size
if (!playgroundParticles.syncPositionsOnMainThread)
playgroundParticles.particleCache[p].size = (playgroundParticles.playgroundCache.maskAlpha[p]>0&&playgroundParticles.particleCache[p].position.y!=initYpos)?playgroundParticles.playgroundCache.size[p]:0;
} else {
// Particle is set to not rebirth
playgroundParticles.InactivateParticle(p);
}
// Set particle position if no sync
if (!playgroundParticles.syncPositionsOnMainThread) {
playgroundParticles.particleCache[p].position = playgroundParticles.playgroundCache.position[p];
}
// Particle got calculated
playgroundParticles.playgroundCache.isCalculatedThisFrame[p] = true;
}// <- Particle loop ends here
// Reset for next frame
if (playgroundParticles.isSettingParticleTime) playgroundParticles.threadHadNoActiveParticles = false;
else playgroundParticles.threadHadNoActiveParticles = noActiveParticles && !playgroundParticles.emit || noActiveParticles && !playgroundParticles.loop;
playgroundParticles.cameFromNonEmissionFrame = false;
playgroundParticles.isDoneThread = true;
// Turbulence calculated here when using PlaygroundC.turbulenceThreadMethod of ThreadMethodComponent.OnePerSystem
if (playgroundParticles.HasTurbulence() && PlaygroundC.reference.turbulenceThreadMethod==ThreadMethodComponent.OnePerSystem) {
PlaygroundC.RunAsync(()=>{
for (int p = 0; p<playgroundParticles.particleCount; p++) {
if (!playgroundParticles.playgroundCache.noForce[p])
Turbulence(playgroundParticles, playgroundParticles.turbulenceSimplex, p, playgroundParticles.t, playgroundParticles.turbulenceType, playgroundParticles.turbulenceTimeScale, playgroundParticles.turbulenceScale/playgroundParticles.velocityScale, playgroundParticles.turbulenceStrength, playgroundParticles.turbulenceApplyLifetimeStrength, playgroundParticles.turbulenceLifetimeStrength);
}
});
}
}