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


C# PlaygroundParticlesC.SetSourcePosition方法代码示例

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


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

示例1: ThreadedCalculations


//.........这里部分代码省略.........
                        } else {
                            playgroundParticles.playgroundCache.maskAlpha[maskedP] += (1f/playgroundParticles.particleMaskTime)*playgroundParticles.localDeltaTime;
                        }
                    }
                } else {
                    playgroundParticles.playgroundCache.isMasked[p] = false;
                    playgroundParticles.playgroundCache.maskAlpha[p] = 1f;
                }

                Color32 lifetimeColor = playgroundParticles.GetParticleColor(p, normalizedLife, normalizedP);

                // Assign color to particle
                playgroundParticles.particleCache[p].color = lifetimeColor;

                // Give Playground Cache its color value
                playgroundParticles.playgroundCache.color[p] = lifetimeColor;

                // Source positions
                if (playgroundParticles.emit) {
                    if (!playgroundParticles.syncPositionsOnMainThread)
                        playgroundParticles.playgroundCache.previousTargetPosition[p] = playgroundParticles.playgroundCache.targetPosition[p];
                    switch (playgroundParticles.source) {
                    case SOURCEC.State:
                        if (playgroundParticles.playgroundCache.rebirth[p] || playgroundParticles.onlySourcePositioning || playgroundParticles.onlyLifetimePositioning) {

                            if (playgroundParticles.applyInitialLocalVelocity && !playgroundParticles.onlyLifetimePositioning)
                                playgroundParticles.playgroundCache.targetDirection[p] = fMx.MultiplyPoint3x4(Vector3Scale(playgroundParticles.playgroundCache.initialLocalVelocity[p], playgroundParticles.states[playgroundParticles.activeState].GetNormal(p)));
                            if (playgroundParticles.onlyLifetimePositioning) {
                                playgroundParticles.playgroundCache.targetDirection[p] = fMx.MultiplyPoint3x4(Vector3Scale(playgroundParticles.lifetimePositioning.Evaluate(normalizedLife*lifetimePositioningTimeScale, playgroundParticles.lifetimePositioningScale), playgroundParticles.states[playgroundParticles.activeState].GetNormal(p)));
                                if (playgroundParticles.applyLifetimePositioningPositionScale)
                                    playgroundParticles.playgroundCache.targetDirection[p] *= playgroundParticles.lifetimePositioningPositionScale.Evaluate(normalizedLife);
                            }

                            playgroundParticles.SetSourcePosition(p);

                            // Local space compensation calculation
                            if (playgroundParticles.localSpace && playgroundParticles.applyLocalSpaceMovementCompensation)
                                playgroundParticles.playgroundCache.localSpaceMovementCompensation[p] = playgroundParticles.playgroundCache.targetPosition[p]-playgroundParticles.playgroundCache.previousTargetPosition[p];
                        }
                    break;
                    case SOURCEC.Transform:
                        if (playgroundParticles.playgroundCache.rebirth[p] || playgroundParticles.onlySourcePositioning || playgroundParticles.onlyLifetimePositioning) {

                            if (playgroundParticles.applyInitialLocalVelocity && !playgroundParticles.onlyLifetimePositioning)
                                if (playgroundParticles.localSpace && playgroundParticles.transformIndex!=playgroundParticles.psTransformNum)
                                    playgroundParticles.playgroundCache.targetDirection[p] = playgroundParticles.particleSystemInverseRotation*playgroundParticles.sourceTransforms[playgroundParticles.transformIndex].rotation*playgroundParticles.playgroundCache.initialLocalVelocity[p];
                                else
                                    playgroundParticles.playgroundCache.targetDirection[p] = playgroundParticles.sourceTransforms[playgroundParticles.transformIndex].rotation*playgroundParticles.playgroundCache.initialLocalVelocity[p];
                            if (playgroundParticles.onlyLifetimePositioning) {
                                playgroundParticles.playgroundCache.targetDirection[p] = playgroundParticles.sourceTransforms[playgroundParticles.transformIndex].rotation*playgroundParticles.lifetimePositioning.Evaluate(normalizedLife*lifetimePositioningTimeScale, playgroundParticles.lifetimePositioningScale);
                                if (playgroundParticles.applyLifetimePositioningPositionScale)
                                    playgroundParticles.playgroundCache.targetDirection[p] *= playgroundParticles.lifetimePositioningPositionScale.Evaluate(normalizedLife*lifetimePositioningTimeScale);
                            }

                            playgroundParticles.SetSourcePosition(p);

                            // Local space compensation calculation
                            if (playgroundParticles.localSpace && playgroundParticles.applyLocalSpaceMovementCompensation)
                                playgroundParticles.playgroundCache.localSpaceMovementCompensation[p] = playgroundParticles.playgroundCache.targetPosition[p]-playgroundParticles.playgroundCache.previousTargetPosition[p];
                        }
                    break;
                    case SOURCEC.WorldObject:
                        if (playgroundParticles.playgroundCache.rebirth[p] || playgroundParticles.onlySourcePositioning || playgroundParticles.onlyLifetimePositioning) {
                            if (playgroundParticles.applyInitialLocalVelocity && !playgroundParticles.onlyLifetimePositioning)
                                playgroundParticles.playgroundCache.targetDirection[p] = fMx.MultiplyPoint3x4(Vector3Scale(playgroundParticles.playgroundCache.initialLocalVelocity[p], playgroundParticles.worldObject.normals[p%playgroundParticles.worldObject.normals.Length]));
                            if (playgroundParticles.onlyLifetimePositioning) {
开发者ID:PawkaHub,项目名称:Lore-Unity,代码行数:67,代码来源:PlaygroundParticlesC.cs


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