void Update() { if (GameManager.GameIsNotFrozen) { currentCooldown -= Time.deltaTime; if (currentCooldown <= 0 && !isBlinking) { isBlinking = true; currentCooldown = 0; SmoothVectorTransformation.StartUnstoppable(this, () => { return(eyes.Select(e => e.localScale).ToArray()); }, (v) => { foreach (Transform t in eyes) { t.localScale = v; } }, blinkDownScale, blinkDuration / 2); } else if (currentCooldown <= -blinkDuration / 2) { SmoothVectorTransformation.StartUnstoppable(this, () => { return(eyes.Select(e => e.localScale).ToArray()); }, (v) => { foreach (Transform t in eyes) { t.localScale = v; } }, eyeDefaultScale, blinkDuration / 2); currentCooldown = NextCoolDown; isBlinking = false; } } }
public void StartSequencePart(MonoBehaviour behaviour, Transform target, Action onFinish) { b = behaviour; Action callBack = null; if (moveToInTime > rotateInTime) { callBack = onFinish; } e = SmoothVectorTransformation.GetStoppable ( () => new Vector3[] { target.position }, (v) => target.position = v, endHere.position, moveToInTime, callBack ); behaviour.StartCoroutine(e); if (rotateInTime != 0) { if (moveToInTime <= rotateInTime) { callBack = onFinish; } else { callBack = null; } t = SmoothTransformation <Vector3> .SmoothRotateAngleEuler( target.localEulerAngles, objectRotation, rotateInTime, v => target.localEulerAngles = v, callBack); behaviour.StartCoroutine(t); } }