protected void AddNodes(int num) { int num2 = 0; for (int i = 0; i < this.MaxENodes; i++) { if (num2 == num) { break; } EffectNode node = this.AvailableENodes[i]; if (node != null) { this.AddActiveNode(node); num2++; this.emitter.SetEmitPosition(node); float life = 0f; if (this.IsNodeLifeLoop) { life = -1f; } else { life = UnityEngine.Random.Range(this.NodeLifeMin, this.NodeLifeMax); } Vector3 emitRotation = this.emitter.GetEmitRotation(node); node.Init(emitRotation.normalized, this.OriSpeed, life, UnityEngine.Random.Range(this.OriRotationMin, this.OriRotationMax), UnityEngine.Random.Range(this.OriScaleXMin, this.OriScaleXMax), UnityEngine.Random.Range(this.OriScaleYMin, this.OriScaleYMax), this.Color1, this.OriLowerLeftUV, this.OriUVDimensions); } } }
protected void AddNodes(int num) { int added = 0; for (int i = 0; i < MaxENodes; i++) { if (added == num) { break; } EffectNode node = AvailableENodes[i]; if (node != null) { AddActiveNode(node); added++; //activate on birth subemitter. if (UseSubEmitters && !string.IsNullOrEmpty(BirthSubEmitter)) { XffectComponent sub = SpawnCache.GetEffect(BirthSubEmitter); if (sub == null) { return; } node.SubEmitter = sub; sub.Active(); } emitter.SetEmitPosition(node); float nodeLife = 0; float realNodeLife = 0; if (IsNodeLifeLoop) { nodeLife = -1; realNodeLife = Random.Range(NodeLifeMin, NodeLifeMax); } else { nodeLife = Random.Range(NodeLifeMin, NodeLifeMax); realNodeLife = nodeLife; } Vector3 oriDir = emitter.GetEmitRotation(node); float speed = OriSpeed; if (IsRandomSpeed) { speed = Random.Range(SpeedMin, SpeedMax); } node.Init(oriDir.normalized, speed, nodeLife, Random.Range(OriRotationMin, OriRotationMax), Random.Range(OriScaleXMin, OriScaleXMax), Random.Range(OriScaleYMin, OriScaleYMax), Color1, UVTopLeft, UVDimension, OriScaleZ, realNodeLife); } else { continue; } } }
// for out caller use. public EffectNode EmitByPos(Vector3 pos) { int added = 0; EffectNode ret = null; for (int i = 0; i < MaxENodes; i++) { if (added == 1) { break; } EffectNode node = AvailableENodes[i]; if (node != null) { AddActiveNode(node); added++; node.SetLocalPosition(pos); float nodeLife = 0; float realLife = 0; if (IsNodeLifeLoop) { nodeLife = -1; realLife = Random.Range(NodeLifeMin, NodeLifeMax); } else { nodeLife = Random.Range(NodeLifeMin, NodeLifeMax); realLife = nodeLife; } Vector3 oriDir = emitter.GetEmitRotation(node); node.Init(oriDir.normalized, OriSpeed, nodeLife, Random.Range(OriRotationMin, OriRotationMax), Random.Range(OriScaleXMin, OriScaleXMax), Random.Range(OriScaleYMin, OriScaleYMax), Color1, UVTopLeft, UVDimension, OriScaleZ, realLife); ret = node; } else { continue; } } return(ret); }
protected void AddNodes(int num) { int num2 = 0; for (int i = 0; i < MaxENodes; i++) { if (num2 == num) { break; } EffectNode effectNode = AvailableENodes[i]; if (effectNode != null) { AddActiveNode(effectNode); num2++; emitter.SetEmitPosition(effectNode); effectNode.Init(life: (!IsNodeLifeLoop) ? Random.Range(NodeLifeMin, NodeLifeMax) : (-1f), oriDir: emitter.GetEmitRotation(effectNode).normalized, speed: OriSpeed, oriRot: Random.Range(OriRotationMin, OriRotationMax), oriScaleX: Random.Range(OriScaleXMin, OriScaleXMax), oriScaleY: Random.Range(OriScaleYMin, OriScaleYMax), oriColor: Color1, oriLowerUv: OriLowerLeftUV, oriUVDimension: OriUVDimensions); } } }
protected void AddNodes(int num) { int added = 0; for (int i = 0; i < MaxENodes; i++) { if (added == num) { break; } EffectNode node = AvailableENodes[i]; if (node != null) { AddActiveNode(node); added++; emitter.SetEmitPosition(node); float nodeLife = 0; if (IsNodeLifeLoop) { nodeLife = -1; } else { nodeLife = Random.Range(NodeLifeMin, NodeLifeMax); } Vector3 oriDir = emitter.GetEmitRotation(node); float speed = OriSpeed; if (IsRandomSpeed) { speed = Random.Range(SpeedMin, SpeedMax); } node.Init(oriDir.normalized, speed, nodeLife, Random.Range(OriRotationMin, OriRotationMax), Random.Range(OriScaleXMin, OriScaleXMax), Random.Range(OriScaleYMin, OriScaleYMax), Color1, UVTopLeft, UVDimension); } else { continue; } } }