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


C# PlaygroundParticlesC.GetLayer方法代码示例

本文整理汇总了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);
                    }
                });
            }
        }
开发者ID:PawkaHub,项目名称:Lore-Unity,代码行数:101,代码来源:PlaygroundParticlesC.cs


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