public void StartSequence(int sequence) { EventSystem.SetSelectedGameObject(null); if (sequence <= 0) { _currentSequence = 0; } if (sequence >= AllSequenceInfos.SequenceInfos.Count) { _currentSequence = AllSequenceInfos.SequenceInfos.Count - 1; return; } Debug.Log("StartSequence " + _currentSequence); AnimateNextButton(false); SequencePage.text = (_currentSequence + 1) + "/" + AllSequenceInfos.SequenceInfos.Count; CleanARContainerObjects(); _currentSequenceInfo = AllSequenceInfos.GetSequenceInfo(_currentSequence); ExplanationText.text = MainController.Instance.GetText(_currentSequenceInfo.LanguageTag); AnimationsInfo animations = _currentSequenceInfo.Animations; List <GameObject> objectsToAnimate = animations.ActionObjects; List <GameObject> staticObjects = animations.StaticObjects; for (int i = 0; i < objectsToAnimate.Count; i++) { GameObject objectToAnimate = Instantiate(objectsToAnimate[i], ARContainer.transform); string animationName = animations.AnimationName; if (i == 0) { AnimatorAnnouncer animatorAnnouncer = objectToAnimate.AddComponent <AnimatorAnnouncer>(); animatorAnnouncer.SetActionController(this); } Animator animation = objectToAnimate.transform.GetComponentInChildren <Animator>(); _currentAnimators.Add(animation); Debug.Log(objectToAnimate.name + " animationName " + animationName); animation.Play(animationName); if (!_trackingActive) { EnableDisableRenderer(objectToAnimate, _trackingActive); } } for (int i = 0; i < staticObjects.Count; i++) { GameObject objectToAnimate = Instantiate(staticObjects[i], ARContainer.transform); } EnableDisableAnimators(_trackingActive); }
// OnStateEnter is called before OnStateEnter is called on any state inside this state machine override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { animatorAnnouncer = animator.gameObject.transform.GetComponent <AnimatorAnnouncer>(); animatorAnnouncer.AnnounceStart(); }