IEnumerator ActivateScanner() { state = Activation.Activating; float timer = 0f; float percentage = 0f; while (percentage < 1f) { timer += Time.deltaTime; output.Reset(); defaultSetting.Blend(output, 1 - percentage); activatedSetting.Blend(output, percentage); output.Apply(mat); mat.SetFloat("_ScannerStrength", maxScan * percentage); percentage = timer / changeTime; yield return(wait); } StartCoroutine(StayActive()); }
void Start() { mat = GetComponent <Renderer>().material; output.Reset(); defaultSetting.Blend(output, 1); mat.SetFloat("_ScannerStrength", 0f); output.Apply(mat); state = Activation.Deactivated; }