public virtual void ResumeAnimation() { IsResumen = true; if (IsRepetitionEnd == true) { Debug.Log("Resume Animation xxx"); if (this.CentralNode != null) { this.originalABS = this.CentralNode.originalABS; this.CentralNode.endRepTime = DateTime.Now; } else { this.endRepTime = DateTime.Now; } if (this.IsInterleaved && this.limb == Limb.Left) { animator.SetTrigger("ChangeLimb"); this._Opposite.SetBehaviourState(originalABS); } this._BehaviourState = originalABS; if (this.IsInterleaved) { this._Opposite.endRepTime = this.endRepTime; } IsResumen = false; } IsRepetitionEnd = false; //Debug.Log("ResumeAnimation: " + IsRepetitionEnd + " _isResumen: " + IsResumen); }
override public void RunWeb(BehaviourParams bp) { if (this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS) { animator.speed = this.CentralNode._RealParams.ForwardSpeed; this.CentralNode._StayInPoseState = StayInPoseState.GoingTo; animator.Play(animator.GetCurrentAnimatorStateInfo(0).fullPathHash, 0, 0); clockBehaviour.stopExecutionTimer(); clockBehaviour.stopTimeBetweenRepetitionsTimer(); this.CentralNode.actualRandomAnimationIndex = 0; IsRewinding = true; BehaviourParams p = (BehaviourParams)bp; this.CentralNode.endRepTime = null; this.CentralNode._RealParams = p; this.initializeRandomAnimations(bp.Variations); } else { this.CentralNode._StayInPoseState = StayInPoseState.GoingTo; BehaviourParams p = (BehaviourParams)bp; this.CentralNode.endRepTime = null; this.CentralNode._RealParams = p; this.initializeRandomAnimations(bp.Variations); this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS; this.CentralNode.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.CentralNode.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; } }
override public void RunWeb(BehaviourParams bp) { BehaviourParams lerpParams = (BehaviourParams)bp; endRepTime = null; this._RealParams = lerpParams; this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS; this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; }
override public void Prepare(BehaviourParams bp) { BehaviourParams lp = (BehaviourParams)bp; this._RealParams = lp; this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS; timeSinceCapture = 0; if (IsInterleaved) this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd; }
override public void RunWeb(BehaviourParams bp) { BehaviourParams p = (BehaviourParams)bp; this.CentralNode.endRepTime = null; this.CentralNode._RealParams = p; this.initializeRandomAnimations(bp.Variations); this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS; this.CentralNode.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.CentralNode.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; }
override public void Run() { endRepTime = null; if (this.IsInterleaved) { this._Opposite.SetBehaviourState(AnimationBehaviourState.RUNNING_WITH_PARAMS); } this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS; this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; }
override public void Prepare(BehaviourParams bp) { BehaviourParams lp = (BehaviourParams)bp; this._RealParams = lp; this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS; timeSinceCapture = 0; if (IsInterleaved) { this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd; } }
override public void RunWeb() { this.CentralNode.endRepTime = null; if (this.IsInterleaved) { this._Opposite.SetBehaviourState(AnimationBehaviourState.RUNNING_DEFAULT); } this._BehaviourState = AnimationBehaviourState.RUNNING_DEFAULT; this.initializeRandomAnimations(); this.CentralNode.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.CentralNode.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; }
/// <summary> /// Detiene la interpolación que actualmente se está ejecutando /// </summary> override public void Stop() {/* * this._BehaviourState = AnimationBehaviourState.STOPPED; * if ((_Opposite as FiniteBehaviour)._BehaviourState != AnimationBehaviourState.STOPPED) * _Opposite.Stop(); * * this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd;*/ //this._BehaviourState = AnimationBehaviourState.STOPPED; Debug.Log("CALLED: stop"); animator.SetInteger(AnimatorParams.Movement, (int)Movement.Iddle); _BehaviourState = AnimationBehaviourState.STOPPED; animator.speed = 1; }
override public void Prepare(BehaviourParams bp) { BehaviourParams lp = (BehaviourParams)bp; this.CentralNode._RealParams = lp; this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS; this.initializeRandomAnimations(this.GetRandomAnimations(bp.Variations)); int i = 0; foreach (Movement x in this.CentralNode.randomAnimations) { Debug.Log(i++ + " " + x); } }
override public void Run() { Debug.Log("Run : " + (int)this.CentralNode.actualRandomAnimationIndex % this.CentralNode.randomAnimations.Count + " " + this.CentralNode.randomAnimations[(int)this.CentralNode.actualRandomAnimationIndex % this.CentralNode.randomAnimations.Count]); AnimatorScript.instance.CurrentExercise.Movement = this.CentralNode.randomAnimations[(int)this.CentralNode.actualRandomAnimationIndex % this.CentralNode.randomAnimations.Count]; this.CentralNode.endRepTime = null; if (this.IsInterleaved) { this._Opposite.SetBehaviourState(AnimationBehaviourState.RUNNING_WITH_PARAMS); } this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS; this.animator.speed = this.CentralNode._RealParams.ForwardSpeed; this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; }
/// <summary> /// Detiene la interpolación que actualmente se está ejecutando /// </summary> override public void Stop() {/* * this._BehaviourState = AnimationBehaviourState.STOPPED; * if ((_Opposite as FiniteBehaviour)._BehaviourState != AnimationBehaviourState.STOPPED) * _Opposite.Stop(); * * this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd;*/ //this._BehaviourState = AnimationBehaviourState.STOPPED; this.CentralNode.endRepTime = null; IsResumen = false; animator.SetInteger(AnimatorParams.Movement, (int)Movement.Iddle); this.CentralNode._BehaviourState = AnimationBehaviourState.STOPPED; //Debug.Log("2Cambiando a " + this._BehaviourState + " " + this.IsCentralNode + " " + this.GetInstanceID()); animator.speed = 1; }
override public void Prepare(BehaviourParams bp) { this._RealParams = bp; this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS; timeSinceCapture = 0; this.initializeRandomAnimations(this.GetRandomAnimations(bp.Variations)); if (IsInterleaved) { this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd; } int i = 0; foreach (Movement x in this.CentralNode.randomAnimations) { Debug.Log(i++ + " " + x); } }
public virtual void PauseAnimation() { originalABS = this._BehaviourState; if (this.CentralNode != null) { this.CentralNode.originalABS = this._BehaviourState; } this._BehaviourState = AnimationBehaviourState.STOPPED; animator.speed = 0; if (IsInterleaved) { if (this.limb == Limb.Right) { this._Opposite.PauseAnimation(); } } }
override protected void PrepareWebInternal() { this._BehaviourState = AnimationBehaviourState.PREPARING_WEB; }
/// <summary> /// Detiene la interpolación que actualmente se está ejecutando /// </summary> override public void Stop() {/* this._BehaviourState = AnimationBehaviourState.STOPPED; if ((_Opposite as FiniteBehaviour)._BehaviourState != AnimationBehaviourState.STOPPED) _Opposite.Stop(); this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd;*/ //this._BehaviourState = AnimationBehaviourState.STOPPED; Debug.Log("CALLED: stop"); animator.SetInteger(AnimatorParams.Movement, (int)Movement.Iddle); _BehaviourState = AnimationBehaviourState.STOPPED; animator.speed = 1; }
public void SetBehaviourState(AnimationBehaviourState lbs) { this._behaviourState = lbs; }
override protected void PrepareWebInternal() { this.CentralNode._RealParams = new BehaviourParams(); this._BehaviourState = AnimationBehaviourState.PREPARING_WEB; }
public virtual void PauseAnimation(){ originalABS = this._BehaviourState; if (this.CentralNode != null) { this.CentralNode.originalABS = this._BehaviourState; } this._BehaviourState = AnimationBehaviourState.STOPPED; animator.speed = 0; if (IsInterleaved) { if (this.limb == Limb.Right) this._Opposite.PauseAnimation(); } }
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { clockBehaviour.Update(); if (_BehaviourState == AnimationBehaviourState.INITIAL_POSE) { if (!animator.IsInTransition(0)) animator.speed = 0; return; } float DELTA = 0.05f; DateTime temp = DateTime.Now; if (this._BehaviourState != AnimationBehaviourState.STOPPED && !IsCentralNode) { if (!BeginRep && (!IsInterleaved || (IsInterleaved && limb == Limb.Left)) && this._BehaviourState != AnimationBehaviourState.PREPARING_WEB && this._BehaviourState != AnimationBehaviourState.PREPARING_WITH_PARAMS && this._BehaviourState != AnimationBehaviourState.PREPARING_DEFAULT) { OnRepetitionReallyStart(); BeginRep = true; } if (this.CentralNode._StayInPoseState == StayInPoseState.GoingTo && stateInfo.normalizedTime - DELTA >= 1) { animator.speed = 0; startHoldTime = Time.time; clockBehaviour.executeRepetitionTime(this.CentralNode._RealParams.SecondsInPose); this.CentralNode._StayInPoseState = StayInPoseState.HoldingOn; } //Si ya pasó el tiempo en el ángulo máximo else if(this.CentralNode._StayInPoseState == StayInPoseState.HoldingOn && this.CentralNode.holdingPose) { this.CentralNode.holdingPose = false; animator.StartRecording(0); animator.speed = -this.CentralNode._RealParams.BackwardSpeed; animator.StopRecording(); this.CentralNode._StayInPoseState = StayInPoseState.Leaving; } else if (this.CentralNode._StayInPoseState == StayInPoseState.Leaving && stateInfo.normalizedTime - DELTA <= 0) { BeginRep = false; animator.speed = this.CentralNode._RealParams.ForwardSpeed; this.CentralNode._StayInPoseState = StayInPoseState.GoingTo; startRestTime = Time.time; animator.SetInteger("Movement", -1); if (IsInterleaved && this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS) { animator.SetTrigger("ChangeLimb"); } if (_BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS) _BehaviourState = AnimationBehaviourState.STOPPED; //OnRepetitionEnd(); } } }
override public void RunWeb(BehaviourParams bp) { if(this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS) { animator.speed = this.CentralNode._RealParams.ForwardSpeed; this.CentralNode._StayInPoseState = StayInPoseState.GoingTo; animator.Play(animator.GetCurrentAnimatorStateInfo(0).fullPathHash, 0, 0); clockBehaviour.stopExecutionTimer(); clockBehaviour.stopTimeBetweenRepetitionsTimer(); this.CentralNode.actualRandomAnimationIndex = 0; IsRewinding = true; BehaviourParams p = (BehaviourParams)bp; this.CentralNode.endRepTime = null; this.CentralNode._RealParams = p; this.initializeRandomAnimations(bp.Variations); } else { this.CentralNode._StayInPoseState = StayInPoseState.GoingTo; BehaviourParams p = (BehaviourParams)bp; this.CentralNode.endRepTime = null; this.CentralNode._RealParams = p; this.initializeRandomAnimations(bp.Variations); this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS; this.CentralNode.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.CentralNode.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; } }
override public void Prepare(BehaviourParams bp) { BehaviourParams lp = (BehaviourParams)bp; this.CentralNode._RealParams = lp; this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS; this.initializeRandomAnimations(this.GetRandomAnimations(bp.Variations)); int i = 0; foreach (Movement x in this.CentralNode.randomAnimations) Debug.Log(i++ + " " + x); }
/// <summary> /// Detiene la interpolación que actualmente se está ejecutando /// </summary> override public void Stop() {/* this._BehaviourState = AnimationBehaviourState.STOPPED; if ((_Opposite as FiniteBehaviour)._BehaviourState != AnimationBehaviourState.STOPPED) _Opposite.Stop(); this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd;*/ //this._BehaviourState = AnimationBehaviourState.STOPPED; this.CentralNode.endRepTime = null; IsResumen = false; animator.SetInteger(AnimatorParams.Movement, (int)Movement.Iddle); this.CentralNode._BehaviourState = AnimationBehaviourState.STOPPED; //Debug.Log("2Cambiando a " + this._BehaviourState + " " + this.IsCentralNode + " " + this.GetInstanceID()); animator.speed = 1; }
override public void Prepare(BehaviourParams bp) { this._RealParams = bp; this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS; timeSinceCapture = 0; this.initializeRandomAnimations(this.GetRandomAnimations(bp.Variations)); if (IsInterleaved) this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd; int i = 0; foreach (Movement x in this.CentralNode.randomAnimations) Debug.Log(i++ + " " + x); }
public virtual void ResumeAnimation() { IsResumen = true; if (IsRepetitionEnd == true) { Debug.Log("Resume Animation xxx"); if (this.CentralNode != null) { this.originalABS = this.CentralNode.originalABS; this.CentralNode.endRepTime = DateTime.Now; } else this.endRepTime = DateTime.Now; if (this.IsInterleaved && this.limb == Limb.Left) { animator.SetTrigger("ChangeLimb"); this._Opposite.SetBehaviourState(originalABS); } this._BehaviourState = originalABS; if (this.IsInterleaved) this._Opposite.endRepTime = this.endRepTime; IsResumen = false; } IsRepetitionEnd = false; //Debug.Log("ResumeAnimation: " + IsRepetitionEnd + " _isResumen: " + IsResumen); }
public void SetLerpBehaviourState(AnimationBehaviourState lbs) { this._BehaviourState = lbs; }
override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { clockBehaviour.Update(); if (_BehaviourState == AnimationBehaviourState.INITIAL_POSE) { if (!animator.IsInTransition(0)) { animator.speed = 0; } return; } float DELTA = 0.05f; DateTime temp = DateTime.Now; if (this._BehaviourState != AnimationBehaviourState.STOPPED && !IsCentralNode) { if (!BeginRep && (!IsInterleaved || (IsInterleaved && limb == Limb.Left)) && this._BehaviourState != AnimationBehaviourState.PREPARING_WEB && this._BehaviourState != AnimationBehaviourState.PREPARING_WITH_PARAMS && this._BehaviourState != AnimationBehaviourState.PREPARING_DEFAULT) { OnRepetitionReallyStart(); BeginRep = true; } if (this.CentralNode._StayInPoseState == StayInPoseState.GoingTo && stateInfo.normalizedTime - DELTA >= 1) { animator.speed = 0; startHoldTime = Time.time; clockBehaviour.executeRepetitionTime(this.CentralNode._RealParams.SecondsInPose); this.CentralNode._StayInPoseState = StayInPoseState.HoldingOn; } //Si ya pasó el tiempo en el ángulo máximo else if (this.CentralNode._StayInPoseState == StayInPoseState.HoldingOn && this.CentralNode.holdingPose) { this.CentralNode.holdingPose = false; animator.StartRecording(0); animator.speed = -this.CentralNode._RealParams.BackwardSpeed; animator.StopRecording(); this.CentralNode._StayInPoseState = StayInPoseState.Leaving; } else if (this.CentralNode._StayInPoseState == StayInPoseState.Leaving && stateInfo.normalizedTime - DELTA <= 0) { BeginRep = false; animator.speed = this.CentralNode._RealParams.ForwardSpeed; this.CentralNode._StayInPoseState = StayInPoseState.GoingTo; startRestTime = Time.time; animator.SetInteger("Movement", -1); if (IsInterleaved && this._BehaviourState == AnimationBehaviourState.RUNNING_WITH_PARAMS) { animator.SetTrigger("ChangeLimb"); } if (_BehaviourState == AnimationBehaviourState.PREPARING_WITH_PARAMS) { _BehaviourState = AnimationBehaviourState.STOPPED; } //OnRepetitionEnd(); } } }
override public void RunWeb() { endRepTime = null; if (this.IsInterleaved) { this._Opposite.SetBehaviourState(AnimationBehaviourState.RUNNING_DEFAULT); } this._BehaviourState = AnimationBehaviourState.RUNNING_DEFAULT; this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd; this.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd; }