public void AddRingRotationEffect(float angle, float step, float propagationSpeed, float flexySpeed) { ChromaRotationEffect ringRotationEffect = SpawnRingRotationEffect(); ringRotationEffect.ProgressPos = 0; ringRotationEffect.RotationAngle = angle; ringRotationEffect.RotationStep = step; ringRotationEffect.RotationPropagationSpeed = propagationSpeed; ringRotationEffect.RotationFlexySpeed = flexySpeed; _activeRingRotationEffects.Add(ringRotationEffect); }
private new ChromaRotationEffect SpawnRingRotationEffect() { ChromaRotationEffect result; if (_ringRotationEffectsPool.Count > 0) { result = _ringRotationEffectsPool[0]; _ringRotationEffectsPool.RemoveAt(0); } else { result = new ChromaRotationEffect(); } return(result); }
private new void FixedUpdate() { TrackLaneRing[] rings = _trackLaneRingsManager.Rings; for (int i = _activeRingRotationEffects.Count - 1; i >= 0; i--) { ChromaRotationEffect ringRotationEffect = _activeRingRotationEffects[i]; int num = (int)ringRotationEffect.ProgressPos; ringRotationEffect.ProgressPos += ringRotationEffect.RotationPropagationSpeed; while (num < ringRotationEffect.ProgressPos && num < rings.Length) { rings[num].SetDestRotation(ringRotationEffect.RotationAngle + (num * ringRotationEffect.RotationStep), ringRotationEffect.RotationFlexySpeed); num++; } if ((int)ringRotationEffect.ProgressPos >= rings.Length) { RecycleRingRotationEffect(_activeRingRotationEffects[i]); _activeRingRotationEffects.RemoveAt(i); } } }
private void RecycleRingRotationEffect(ChromaRotationEffect ringRotationEffect) { _ringRotationEffectsPool.Add(ringRotationEffect); }