public static IEnumerator PulseMkGlow(MKGlow glow, float startAlpha, float endAlpha, float duration) { // keep track of when the fading started, when it should finish, and how long it has been running</p> <p>&a var startTime = Time.time; var endTime = Time.time + duration; var elapsedTime = 0f; // set the canvas to the start alpha – this ensures that the canvas is ‘reset’ if you fade it multiple times glow.bloomScattering = startAlpha; // loop repeatedly until the previously calculated end time while (Time.time <= endTime) { elapsedTime = Time.time - startTime; // update the elapsed time var percentage = 1 / (duration / elapsedTime); // calculate how far along the timeline we are if (Time.time <= (endTime / 2)) // if we are fading up { glow.bloomScattering = startAlpha + (endAlpha - startAlpha) * percentage; // calculate the new alpha Debug.Log(endTime / 2); } else // if we are fading down { glow.bloomScattering = endAlpha - (endAlpha - startAlpha) * percentage; // calculate the new alpha } yield return(new WaitForEndOfFrame()); // wait for the next frame before continuing the loop } Debug.Log(endTime / 2); glow.bloomScattering = startAlpha; // force the alpha to the end alpha before finishing – this is here to mitigate any rounding errors, e.g. leaving the alpha at 0.01 instead of 0 }
void Start() { tmp = gameObject.GetComponent <MKGlow>(); time = 0; blurGap = tmp.BlurSpread - blurMiddle; blurBegin = tmp.BlurSpread; intensGap = tmp.GlowIntensity - intensityEnd; intensBegin = tmp.GlowIntensity; }
void Start() { LoadCarHierarchy(); obstaclePrevPos = Vector3.zero; //init position of obstacle spawned rot0 = speed.localRotation; //init rotation of speed needle foreach (Transform t in driverCam.transform) { if (t.name.Equals("Center")) { t.GetComponent <Camera>().allowHDR = true; MKGlow mkg = t.gameObject.AddComponent <MKGlow>(); mkg.GlowType = MKGlowType.Selective; mkg.GlowLayer = LayerMask.GetMask("Graphics"); break; } } CreatePathEnhanced(); CreateCenterLine(); //linesUtils.LineRend = linesUtils.CreateLineRenderer(linesUtils.LineRendererEmpty, "LineRenderer", 2.5f, new Color32(0x3A, 0xC1, 0xAA, 0xFF), mats[2], () => linesUtils.InitGlowTexture()); //linesUtils.LineRend2 = linesUtils.CreateLineRenderer(linesUtils.CenterLineRendererEmpty, "centerLineRenderer", 0.5f, new Color32(0xFF, 0xFF, 0xFF, 0xFF), mats[2], () => linesUtils.InitGlowTexture2()); //linesUtils.CenterLineLerper(); }
void Awake() { mkGlow = this.GetComponent <MKGlow>(); InitGlowSystem(); }
void Awake() { mkGlow = this.GetComponent <MKGlow>(); InitGlowSystem(); skin.horizontalSlider.fixedHeight = 25f; }
private void Start() { mkGlow = masterCamera.GetComponent <MKGlow>(); signalLostPlayer.Prepare(); }
private void Start() { mkGlow = GetComponent <MKGlow>(); }