void U_OnEnterAnimation() { if (!OnEnterAnimation) { return; } //Animation setup if (enterAnimationState == EnterEndAnimationStates.NONE) { SetAudioFound(); ChildTransform.localScale = initialScale; if (!ChildTransform.gameObject.activeInHierarchy) { ChildTransform.gameObject.SetActive(true); } enterAnimatorMaxTimer = animTrackFind.keys[animTrackFind.length - 1].time; enterAnimationTimer = 0; float scale = animTrackFind.keys[0].value; ChildTransform.localScale = new Vector3(scale, scale, scale); enterAnimationState = EnterEndAnimationStates.ANIMATING; } else if (enterAnimationState == EnterEndAnimationStates.ANIMATING) { enterAnimationTimer += Time.deltaTime; if (enterAnimationTimer >= enterAnimatorMaxTimer) { enterAnimationState = EnterEndAnimationStates.END; } else { ChildTransform.localScale = initialScale * animTrackFind.Evaluate(enterAnimationTimer); } } else if (enterAnimationState == EnterEndAnimationStates.END) { SetAudioFound(false); ChildTransform.localScale = initialScale; OnEnterAnimation = false; enterAnimationState = EnterEndAnimationStates.NONE; ARCameraManager.TargetFound(this); } }
void U_OnEndAnimation() { if (!OnEndAnimation) { return; } //Animation setup if (endAnimationState == EnterEndAnimationStates.NONE) { SetAudioLost(); ChildTransform.localScale = initialScale; enterAnimatorMaxTimer = animTrackLost.keys[animTrackLost.length - 1].time; enterAnimationTimer = 0; endAnimationState = EnterEndAnimationStates.ANIMATING; } else if (endAnimationState == EnterEndAnimationStates.ANIMATING) { enterAnimationTimer += Time.deltaTime; if (enterAnimationTimer >= enterAnimatorMaxTimer) { endAnimationState = EnterEndAnimationStates.END; } else { ChildTransform.localScale = initialScale * animTrackLost.Evaluate(enterAnimationTimer); } } else if (endAnimationState == EnterEndAnimationStates.END) { SetAudioLost(false); SetComponents(false); ChildTransform.localScale = initialScale; OnEndAnimation = false; endAnimationState = EnterEndAnimationStates.NONE; ChildTransform.gameObject.SetActive(false); } }