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); } Color c = Color1; if (IsRandomStartColor) { //c = RandomColorParam.GetGradientColor(Random.Range(0f, 1f)); c = RandomColorGradient.Evaluate(Random.Range(0f, 1f)); } float oriScalex = Random.Range(OriScaleXMin, OriScaleXMax); float oriScaley = Random.Range(OriScaleYMin, OriScaleYMax); if (UniformRandomScale) { oriScaley = oriScalex; } node.Init(oriDir.normalized, speed, nodeLife, Random.Range(OriRotationMin, OriRotationMax), oriScalex, oriScaley, c, UVTopLeft, UVDimension); } else { continue; } } }
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; 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); } Color c = Color1; if (IsRandomStartColor) { //c = RandomColorParam.GetGradientColor(Random.Range(0f, 1f)); c = RandomColorGradient.Evaluate(Random.Range(0f, 1f)); } float oriScalex = Random.Range(OriScaleXMin, OriScaleXMax); float oriScaley = Random.Range(OriScaleYMin, OriScaleYMax); if (UniformRandomScale) { oriScaley = oriScalex; } node.Init(oriDir.normalized, speed, nodeLife, Random.Range(OriRotationMin, OriRotationMax), oriScalex, oriScaley, c, UVTopLeft, UVDimension); } else { continue; } } }