Esempio n. 1
0
 override public void Prepare(BehaviourParams sp)
 {
     this._RealParams = sp;
     this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS;
     if (IsInterleaved)
         this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd;
 }
 protected override void Init(BehaviourParams param)
 {
     for (int i = 0; i < m_ChildList.Count; i++)
     {
         m_ChildList[i].Reset();
     }
 }
Esempio n. 3
0
    /// <summary>
    /// Nota: Si hay errores de Quaternion to Matrix comprobar que los parametros enviados son validos para el ejercicio indicado
    /// </summary>
    /// <param name="e"></param>
    /// <param name="param"></param>
    public void PrepareExercise(Exercise e, BehaviourParams param)
    {
        param.Angle = AngleFixer.FixAngle(param.Angle, e.Movement);
        if (param.Variations == null || param.Variations.Count == 0)
        {
            behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb);
        }
        else
        {
            behaviour = AnimationBehaviour.GetCentralBehaviour(e.Movement, e.Limb);
        }

        if (behaviour == null)
        {
            Debug.LogError("No se encontró la máquina de estado. (Ejercicio = " + e.Movement + " "
                           + (int)e.Movement + ") (Limb = " + e.Limb + ")" +
                           "). Posiblemente se deba a una mala combinación de esos parámetros o el MonitoAnimatorController se bugeó");
            return;
        }

        behaviour.Prepare(param);
        behaviour.RepetitionEnd += behaviour_PrepareEnd;

        if (param.Variations == null || param.Variations.Count == 0)
        {
            CurrentExercise = e;
        }
        else
        {
            CurrentExercise = new Exercise(behaviour.randomAnimations[0], e.Limb);
        }
    }
Esempio n. 4
0
    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;
        }
    }
    protected override Flow Process(BehaviourParams param)
    {
        Flow result = m_Child.Update(param);

        if(result == Flow.Running)
        {
            return Flow.Running;
        }

        Debug.Assert(m_Count > 0 || m_Count == RepeatForever);
        if(m_Count > 0)
        {
            m_Count--;
            if (m_Count == 0)
            {
                // Finished (ignore errors)
                return Flow.Success;
            }
        }
        else if(m_Count == RepeatForever)
        {
            m_Child.Reset();
        }

        return Flow.Running;
    }
    void Update()
    {
        BehaviourParams param = new BehaviourParams();
        param.m_Actor = gameObject;
        param.m_DeltaTime = Time.deltaTime;

        m_Tree.Update(param);
    }
Esempio n. 7
0
 override public void Prepare(BehaviourParams sp)
 {
     this._RealParams     = sp;
     this._BehaviourState = AnimationBehaviourState.PREPARING_WITH_PARAMS;
     if (IsInterleaved)
     {
         this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd;
     }
 }
Esempio n. 8
0
    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;
    }
Esempio n. 9
0
    public Flow Update(BehaviourParams param)
    {
        if(m_IsInitialised == false)
        {
            Init(param);
            m_IsInitialised = true;
        }

        return Process(param);
    }
Esempio n. 10
0
    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;

    }
Esempio n. 11
0
    public void RunExerciseWeb(string s)
    {
        BehaviourParams p = JsonConvert.DeserializeObject <BehaviourParams>(s);

        behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb);

        behaviour.Stop();
        p.Angle = AngleFixer.FixAngle(p.Angle, CurrentExercise.Movement);
        StartCoroutine(RunWebInSeconds(0.4f, p));
    }
Esempio n. 12
0
    public void testRun()
    {
        float forwardSpeed  = (float)Convert.ToDouble(GameObject.Find("VEL IDA/Text").GetComponent <Text>().text);
        float backwardSpeed = (float)Convert.ToDouble(GameObject.Find("VEL VUELTA/Text").GetComponent <Text>().text);
        int   secondsBE     = Convert.ToInt32(GameObject.Find("PAUSA EXE/Text").GetComponent <Text>().text);
        int   secondsBR     = Convert.ToInt32(GameObject.Find("PAUSA REPS/Text").GetComponent <Text>().text);
        float rom           = (float)Convert.ToDouble(GameObject.Find("ROM/Text").GetComponent <Text>().text);

        BehaviourParams param = new BehaviourParams(rom, forwardSpeed, backwardSpeed, secondsBE, secondsBR);

        //RunExerciseWeb(Newtonsoft.Json.JsonConvert.SerializeObject(param));

        //Para correr en juego (True con instruccion - false sin instruccion)***
        RunExercise(false);
        //**********************************************************************

        //Para correr web con parametros****************************************
        //BehaviourParams p = new BehaviourParams(3, 2);
        //string s = Newtonsoft.Json.JsonConvert.SerializeObject(p);
        //RunExerciseWeb(s);
        //**********************************************************************

        //Para correr web con parametros mpx************************************
        //BehaviourParams p = new BehaviourParams(new List<Movement>() {
        //    { Movement.MantenerPosiciónExtrema_EtapaAvanzada_BrazosDiagonal},
        //    { Movement.MantenerPosiciónExtrema_EtapaAvanzada_Encestar},
        //    { Movement.MantenerPosiciónExtrema_EtapaAvanzada_MusloArribaBrazosAdelanteYAtrás},
        //}, 1, 1f, 0);
        //string s = Newtonsoft.Json.JsonConvert.SerializeObject(p);
        //RunExerciseWeb(s);
        //**********************************************************************

        //Para correr web con parametros mp con variacion***********************

        /*BehaviourParams p = new BehaviourParams(new List<Movement>() {
         *  {Movement.RecogiendoYGuardandoConUnaMano_BrazoAbajoDerecha},
         * }, 1, 3, 2);
         * string s = Newtonsoft.Json.JsonConvert.SerializeObject(p);
         * RunExerciseWeb(s);*/
        //**********************************************************************
        //Para correr web sin parametros ***************************************
        //RunExerciseWebWithoutParams();
        //**********************************************************************

        //Para correr en juego (True con instruccion - false sin instruccion)***
        //RunExercise(true);
        //**********************************************************************



        //PrepareExercise(new Exercise(Movement.ElevaciónResistidaDeHombroEnPlanoEscapular_Unilateral, Laterality.Single, Limb.Left), new BehaviourParams(60, 1.5f, 1.5f, 3, 3));

        /*BehaviourParams p = new BehaviourParams(2, 2);
         * RunExerciseWeb(Newtonsoft.Json.JsonConvert.SerializeObject(p));*/
    }
    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;
    }
Esempio n. 14
0
    override public void Prepare(BehaviourParams bp)
    {
        BehaviourParams lp = (BehaviourParams)bp;

        this._RealParams     = lp;
        this._BehaviourState = AnimationBehaviourState.PREPARING_DEFAULT;
        if (IsInterleaved)
        {
            this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd;
        }
    }
Esempio n. 15
0
    protected override Flow Process(BehaviourParams param)
	{
        m_TimeOut -= param.m_DeltaTime; // todo. pass as param
        if (m_TimeOut < 0)
        {
            return Flow.Success;
        }

        param.m_Actor.GetComponent<MovementVectorAI>().SetMode(MovementVectorAI.Mode.Pursue);
        return Flow.Running;
	}
Esempio n. 16
0
    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;
        }
    }
    protected override Flow Process(BehaviourParams param)
	{
		for(int i = 0; i < m_ChildList.Count; i++)
        {
            Flow result = m_ChildList[i].Update(param);
            if(result != Flow.Success)
            {
                return result; // failure and running will return
            }
        }

        return Flow.Success;
    }
Esempio n. 18
0
    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);
        }
    }
Esempio n. 19
0
    private IEnumerator RunWebInSeconds(float time, BehaviourParams p)
    {
        yield return(new WaitForSeconds(time));

        behaviour.RunWeb(p);

        if (p.Variations == null)
        {
            RewindExercise();
        }
        else
        {
            CurrentExercise = new Exercise(behaviour.randomAnimations[0], CurrentExercise.Limb);
        }
    }
    override public void RunWeb(BehaviourParams stayInParams)
    {
        endRepTime = null;

        //Debug.Log("Tirando RunWebWithParams");
        if (this.IsInterleaved)
        {
            this._Opposite.SetBehaviourState(AnimationBehaviourState.RUNNING_WITH_PARAMS);
        }

        this._behaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS;


        this._RealParams    = stayInParams;
        this.animator.speed = this._RealParams.ForwardSpeed;
    }
Esempio n. 21
0
    override public void RunWeb(BehaviourParams stayInParams)
    {
        animator.Play(animator.GetCurrentAnimatorStateInfo(0).fullPathHash, 0, 0);
        endRepTime = null;

        Debug.Log("Tirando RunWebWithParams");
        if (this.IsInterleaved)
        {
            this._Opposite.SetBehaviourState(AnimationBehaviourState.RUNNING_WITH_PARAMS);
        }

        this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS;


        this._RealParams    = stayInParams;
        stayInPoseState     = StayInPoseState.GoingTo;
        this.animator.speed = this._RealParams.ForwardSpeed;
    }
    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);
        }
    }
Esempio n. 23
0
    override public void RunWeb(BehaviourParams stayInParams)
    {
        animator.Play(animator.GetCurrentAnimatorStateInfo(0).fullPathHash, 0, 0);
        endRepTime = null;

        Debug.Log("Tirando RunWebWithParams");
        if (this.IsInterleaved)
        {
            this._Opposite.SetBehaviourState(AnimationBehaviourState.RUNNING_WITH_PARAMS);
        }

        this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS;
	

        this._RealParams = stayInParams;
        stayInPoseState = StayInPoseState.GoingTo;
        this.animator.speed = this._RealParams.ForwardSpeed;
    }
    public override void RunWeb(BehaviourParams lerpParams)
    {
        if (_BehaviourState == AnimationBehaviourState.RUNNING_DEFAULT)
        {
            animator.Play(animator.GetCurrentAnimatorStateInfo(0).fullPathHash, 0, 0);
            clockBehaviour.stopExecutionTimer();
            clockBehaviour.stopTimeBetweenRepetitionsTimer();
            isRewinding = true;
            this.CentralNode.actualRandomAnimationIndex = 0;
            startNewExecution();
        }
        else
        {
            this.CentralNode._RealParams = lerpParams;

            this.initializeRandomAnimations();
            this._BehaviourState = AnimationBehaviourState.RUNNING_DEFAULT;
        }

        this.animator.speed = this.CentralNode._RealParams.ForwardSpeed;
    }
Esempio n. 25
0
    // OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
    //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}

    // OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
    //override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}


    /// <summary>
    /// Comienza la interpolación entre 0 y el tiempo donde está el ángulo requerido (LerpTime), aplicando las velocidades concéntras y excéntricas indicadas
    /// </summary>
    /// <param name="_lerpTime">Tiempo donde se encuentra el ángulo al que se quiere llegar</param>
    /// <param name="_forwardSpeed">Velocidad concéntrica</param>
    /// <param name="_backwardSpeed">Velocidad excéntrica</param>
    public void StartLerp()
    {
        _currentLerpState = LerpState.Forward;

        if (_BehaviourState == AnimationBehaviourState.PREPARING_DEFAULT || _BehaviourState == AnimationBehaviourState.PREPARING_WEB || _BehaviourState == AnimationBehaviourState.RUNNING_DEFAULT)
        {
            _currentParams      = new BehaviourParams(defaultAnimationLength, 1, 1, 0, 3);
            timeTakenDuringLerp = (float)Math.Floor(defaultAnimationLength * 10) / 10;
            Debug.Log("1timeTakenDuringLerp " + timeTakenDuringLerp);
        }
        else
        {
            _currentParams      = _RealParams;
            timeTakenDuringLerp = (float)Math.Floor(GetAnimationInfo(_currentParams.Angle, _timeAndAngles).time * 10) / 10;
            Debug.Log("2timeTakenDuringLerp " + timeTakenDuringLerp);
        }
        //Normalizo el tiempo que tardo en parar
        timeTakenDuringForwardLerp  = timeTakenDuringLerp / _currentParams.ForwardSpeed;
        timeTakenDuringBackwardLerp = timeTakenDuringLerp / _currentParams.BackwardSpeed;
        forwardSpeed  = _currentParams.ForwardSpeed;
        backwardSpeed = _currentParams.BackwardSpeed;
        BeginLerp(0, forwardSpeed, true);
    }
Esempio n. 26
0
 protected override Flow Process(BehaviourParams param)
 {
     return m_Root.Update(param);
 }
	public override void RunWeb (BehaviourParams lerpParams)
	{
        

        if (_BehaviourState == AnimationBehaviourState.RUNNING_DEFAULT)
        {
            animator.Play(animator.GetCurrentAnimatorStateInfo(0).fullPathHash, 0, 0);
            clockBehaviour.stopExecutionTimer();
            clockBehaviour.stopTimeBetweenRepetitionsTimer();
            isRewinding = true;
            this.CentralNode.actualRandomAnimationIndex = 0;
            startNewExecution();
        }
        else
        {
            this.CentralNode._RealParams = lerpParams;
            
            this.initializeRandomAnimations();
            this._BehaviourState = AnimationBehaviourState.RUNNING_DEFAULT;
        }

        this.animator.speed = this.CentralNode._RealParams.ForwardSpeed;




    }
 protected override void Init(BehaviourParams param)
 {
     m_Count = m_RepeatCount;
 }
Esempio n. 29
0
    private IEnumerator RunWebInSeconds(float time, BehaviourParams p)
    {
        yield return new WaitForSeconds(time);
        behaviour.RunWeb(p);

        if (p.Variations == null)
            RewindExercise();
        else
            CurrentExercise = new Exercise(behaviour.randomAnimations[0], CurrentExercise.Limb);
    }
Esempio n. 30
0
 protected virtual void Init(BehaviourParams param) { }
Esempio n. 31
0
	// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
	//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}

	// OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here.
	//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
	//
	//}


    /// <summary>
    /// Comienza la interpolación entre 0 y el tiempo donde está el ángulo requerido (LerpTime), aplicando las velocidades concéntras y excéntricas indicadas
    /// </summary>
    /// <param name="_lerpTime">Tiempo donde se encuentra el ángulo al que se quiere llegar</param>
    /// <param name="_forwardSpeed">Velocidad concéntrica</param>
    /// <param name="_backwardSpeed">Velocidad excéntrica</param>
    public void StartLerp()
    {
        _currentLerpState = LerpState.Forward;

        if (_BehaviourState == AnimationBehaviourState.PREPARING_DEFAULT || _BehaviourState == AnimationBehaviourState.PREPARING_WEB || _BehaviourState == AnimationBehaviourState.RUNNING_DEFAULT)
        {
            _currentParams = new BehaviourParams(defaultAnimationLength, 1, 1, 0, 3);
            timeTakenDuringLerp = (float)Math.Floor(defaultAnimationLength * 10) / 10;
            Debug.Log("1timeTakenDuringLerp " + timeTakenDuringLerp);
        }
        else
        {
            _currentParams = _RealParams;
            timeTakenDuringLerp = (float)Math.Floor(GetAnimationInfo(_currentParams.Angle, _timeAndAngles).time * 10) / 10;
            Debug.Log("2timeTakenDuringLerp " + timeTakenDuringLerp);
        }
        //Normalizo el tiempo que tardo en parar
        timeTakenDuringForwardLerp = timeTakenDuringLerp / _currentParams.ForwardSpeed;
        timeTakenDuringBackwardLerp = timeTakenDuringLerp / _currentParams.BackwardSpeed;
        forwardSpeed = _currentParams.ForwardSpeed;
        backwardSpeed = _currentParams.BackwardSpeed;
        BeginLerp(0, forwardSpeed, true);
    }
Esempio n. 32
0
 override public void Prepare(BehaviourParams bp)
 {
     BehaviourParams lp = (BehaviourParams)bp;
     this._RealParams = lp;
     this._BehaviourState = AnimationBehaviourState.PREPARING_DEFAULT;
     if (IsInterleaved)
         this._Opposite.RepetitionEnd += _Opposite_RepetitionEnd;
 }
Esempio n. 33
0
 abstract public void Prepare(BehaviourParams lp);
Esempio n. 34
0
	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)
    {
        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);
    }
    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;
    }
Esempio n. 37
0
 abstract public void RunWeb(BehaviourParams lerpParams);
Esempio n. 38
0
 protected abstract Flow Process(BehaviourParams param);
Esempio n. 39
0
 protected override void Init(BehaviourParams param)
 {
     m_TimeOut = m_TestTimeOut;
     DebugLog.Add("Start Pursue");
 }
Esempio n. 40
0
 abstract public void RunWeb(BehaviourParams lerpParams);
Esempio n. 41
0
    public void testRun()
    {
        float forwardSpeed = (float)Convert.ToDouble(GameObject.Find("VEL IDA/Text").GetComponent<Text>().text);
        float backwardSpeed = (float)Convert.ToDouble(GameObject.Find("VEL VUELTA/Text").GetComponent<Text>().text);
        int secondsBE = Convert.ToInt32(GameObject.Find("PAUSA EXE/Text").GetComponent<Text>().text);
        int secondsBR = Convert.ToInt32(GameObject.Find("PAUSA REPS/Text").GetComponent<Text>().text);
        float rom = (float)Convert.ToDouble(GameObject.Find("ROM/Text").GetComponent<Text>().text);
        
        BehaviourParams param = new BehaviourParams(rom, forwardSpeed, backwardSpeed, secondsBE, secondsBR);

        //RunExerciseWeb(Newtonsoft.Json.JsonConvert.SerializeObject(param));
        
        //Para correr en juego (True con instruccion - false sin instruccion)***
        RunExercise(false);
        //**********************************************************************

        //Para correr web con parametros****************************************
        //BehaviourParams p = new BehaviourParams(3, 2);
        //string s = Newtonsoft.Json.JsonConvert.SerializeObject(p);
        //RunExerciseWeb(s);
        //**********************************************************************

        //Para correr web con parametros mpx************************************
        //BehaviourParams p = new BehaviourParams(new List<Movement>() {
        //    { Movement.MantenerPosiciónExtrema_EtapaAvanzada_BrazosDiagonal},
        //    { Movement.MantenerPosiciónExtrema_EtapaAvanzada_Encestar},
        //    { Movement.MantenerPosiciónExtrema_EtapaAvanzada_MusloArribaBrazosAdelanteYAtrás},
        //}, 1, 1f, 0);
        //string s = Newtonsoft.Json.JsonConvert.SerializeObject(p);
        //RunExerciseWeb(s);
        //**********************************************************************

        //Para correr web con parametros mp con variacion***********************
        /*BehaviourParams p = new BehaviourParams(new List<Movement>() {
            {Movement.RecogiendoYGuardandoConUnaMano_BrazoAbajoDerecha},
        }, 1, 3, 2);
        string s = Newtonsoft.Json.JsonConvert.SerializeObject(p);
        RunExerciseWeb(s);*/
        //**********************************************************************
        //Para correr web sin parametros ***************************************
        //RunExerciseWebWithoutParams();
        //**********************************************************************

        //Para correr en juego (True con instruccion - false sin instruccion)***
        //RunExercise(true);
        //**********************************************************************



        //PrepareExercise(new Exercise(Movement.ElevaciónResistidaDeHombroEnPlanoEscapular_Unilateral, Laterality.Single, Limb.Left), new BehaviourParams(60, 1.5f, 1.5f, 3, 3));
        /*BehaviourParams p = new BehaviourParams(2, 2);
        RunExerciseWeb(Newtonsoft.Json.JsonConvert.SerializeObject(p));*/

    }
Esempio n. 42
0
    override public void RunWeb(BehaviourParams bp)
    {
        BehaviourParams lerpParams = (BehaviourParams)bp;
        endRepTime = null;
        
        
        isLerping = false;
        ReadyToLerp = false;
	

        this._RealParams = lerpParams;
        this._BehaviourState = AnimationBehaviourState.RUNNING_WITH_PARAMS;
        this.LerpRoundTripEnd -= LerpBehaviour_LerpRoundTripEnd;
        this.LerpRoundTripEnd += LerpBehaviour_LerpRoundTripEnd;
    }
Esempio n. 43
0
    /// <summary>
    /// Nota: Si hay errores de Quaternion to Matrix comprobar que los parametros enviados son validos para el ejercicio indicado
    /// </summary>
    /// <param name="e"></param>
    /// <param name="param"></param>
    public void PrepareExercise(Exercise e, BehaviourParams param)
    {

        param.Angle = AngleFixer.FixAngle(param.Angle, e.Movement);
        if (param.Variations == null || param.Variations.Count == 0)
            behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb);
        else
            behaviour = AnimationBehaviour.GetCentralBehaviour(e.Movement, e.Limb);

        if (behaviour == null)
        {
            Debug.LogError("No se encontró la máquina de estado. (Ejercicio = " + e.Movement + " "
                + (int)e.Movement + ") (Limb = " + e.Limb + ")" +
                "). Posiblemente se deba a una mala combinación de esos parámetros o el MonitoAnimatorController se bugeó");
            return;
        }

        behaviour.Prepare(param);
        behaviour.RepetitionEnd += behaviour_PrepareEnd;

        if (param.Variations == null || param.Variations.Count == 0)
            CurrentExercise = e;
        else
            CurrentExercise = new Exercise(behaviour.randomAnimations[0], e.Limb);
    }
Esempio n. 44
0
    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);
	}	
Esempio n. 45
0
 abstract public void Prepare(BehaviourParams lp);