private void ApplyCycleSetting(float t) { // Transition cycle settings from activeIndex to nextIndex (then apply them) CycleSetting newSetting = CycleSetting.Interpolate(cycles[activeIndex], cycles[GetNextIndex()], t); targetLight.color = newSetting.lightColor; targetLight.transform.rotation = Quaternion.Euler(newSetting.lightAngle); targetLight.intensity = newSetting.lightIntensity; }
private void Update() { // Check for cycle change if (waveController.GetCurrentCycle() != activeCycle) { activeCycle = waveController.GetCurrentCycle(); StartCoroutine(SpriteSwap()); } clockHand.transform.localRotation = Quaternion.Euler(0.0f, 0.0f, -waveController.GetTimePassed() * (360.0f / activeCycle.duration)); }
public static CycleSetting Interpolate(CycleSetting a, CycleSetting b, float t) { // Create a new cycle instance CycleSetting updatedCycle = CreateInstance <CycleSetting>(); updatedCycle.lightColor = Color.Lerp(a.lightColor, b.lightColor, t); updatedCycle.lightAngle = Vector3.Lerp(a.lightAngle, b.lightAngle, t); updatedCycle.lightIntensity = Mathf.Lerp(a.lightIntensity, b.lightIntensity, t); // Return the interpolated cycle return(updatedCycle); }
private void Start() { activeCycle = waveController.GetCurrentCycle(); }