Exemple #1
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);
        }
    }
Exemple #2
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));
    }
Exemple #3
0
 public void RunExercise(bool isInInstruction)
 {
     behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb);
     behaviour.Run(isInInstruction);
     RewindExercise();
     behaviour.RepetitionEnd         -= behaviour_RepetitionEnd;
     behaviour.RepetitionEnd         += behaviour_RepetitionEnd;
     behaviour.RepetitionReallyStart -= behaviour_RepetitionReallyStart;
     behaviour.RepetitionReallyStart += behaviour_RepetitionReallyStart;
 }
Exemple #4
0
    public void StopExercise()
    {
        behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb);

        if (behaviour == null)
        {
            return;
        }

        behaviour.Stop();

        behaviour.RepetitionEnd         -= behaviour_RepetitionEnd;
        behaviour.RepetitionEnd         -= behaviour_PrepareEnd;
        behaviour.RepetitionEnd         -= behaviour_PrepareEndWeb;
        behaviour.RepetitionReallyStart -= behaviour_RepetitionReallyStart;
    }
Exemple #5
0
    public void PrepareExerciseWeb(string s)
    {
        RaiseEvent(OnPrepareExerciseStart, PrepareStatus.Preparing);
        PrepareExerciseWebParams pwp = JsonConvert.DeserializeObject <PrepareExerciseWebParams>(s);
        Exercise e = (pwp.Exercise) as Exercise;

        this.prepareCaller = (Caller)(pwp.Caller);
        //Exercise e = JsonConvert.DeserializeObject<Exercise>(s);

        behaviour = AnimationBehaviour.GetBehaviour(e.Movement, e.Limb);
        if (behaviour == null)
        {
            DebugLifeware.LogAllDevelopers("Importante: Behaviour no encontrado");
            RaiseEvent(OnPrepareExerciseEnd, PrepareStatus.NotFound);
            return;
        }
        behaviour.RepetitionEnd += behaviour_PrepareEndWeb;
        timeSinceStartPrepareWeb = Time.time;
        behaviour.PrepareWeb();
        CurrentExercise = e;
    }
Exemple #6
0
 public void RunExerciseWebWithoutParams()
 {
     behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb);
     behaviour.Stop();
     StartCoroutine(RunWebInSeconds(0.4f));
 }
Exemple #7
0
 public void ResumeExercise()
 {
     behaviour = AnimationBehaviour.GetBehaviour(CurrentExercise.Movement, CurrentExercise.Limb);
     behaviour.ResumeAnimation();
 }