public void Update() { if (battery != null) { battery.charge = battery.capacity; } if (energyMixin != null) { energyMixin.AddEnergy(energyMixin.capacity - energyMixin.charge); } timer += Time.deltaTime; if (timer > changeTime) { currentStrength = nextStrength; nextStrength = currentStrength == 2 ? 0 : 2; timer = 0.0f; } if (renderer == null) { return; } renderer.material.SetFloat(ShaderPropertyID._GlowStrength, Mathf.Lerp(currentStrength, nextStrength, timer / changeTime)); renderer.material.SetFloat(ShaderPropertyID._GlowStrengthNight, Mathf.Lerp(currentStrength, nextStrength, timer / changeTime)); }