public IEnumerator ListenForSelfie(SelfieTarget target, float requiredTime) { var progressIndicator = GameObject.Instantiate(SelfieProgressIndicatorPrefab).GetComponent <SelfieProgressIndicator>(); progressIndicator.Init(Player.Instance); progressIndicator.SetTarget(target); bool inSelfie = target.IsInSelfie; progressIndicator.SetVisible(inSelfie); while (true) { float lerp = Mathf.InverseLerp(0, requiredTime, target.SelfieTime); if (target.IsInSelfie != inSelfie) { inSelfie = target.IsInSelfie; progressIndicator.SetVisible(inSelfie); } if (inSelfie) { progressIndicator.SetProgress(lerp); } if (lerp >= 1) { break; } progressIndicator.SetTarget(target); yield return(null); } GameObject.Destroy(progressIndicator); }
public IEnumerator ListenForSelfie(SelfieTarget selfieTarget) { return(ListenForSelfie(selfieTarget, defaultSelfieTime)); }
public void SetTarget(SelfieTarget target) { transform.position = target.IndicatorPoint; }