Exemple #1
0
    private void saveData()
    {
        GameObject tre = GameObject.Find("TherapySession");

        if (tre != null)
        {
            TherapySessionObject objTherapy = tre.GetComponent <TherapySessionObject> ();

            if (objTherapy != null)
            {
                objTherapy.fillLastSession(score_script.score_obtain, score_script.score_max, (int)0, "1");
                objTherapy.saveLastGameSession();

                objTherapy.savePerformance((int)HoldParametersGreatJourney.best_angle_left, "14");
            }
        }



//		TherapySessionObject objTherapy = GameObject.Find ("TherapySession").GetComponent<TherapySessionObject> ();
//		objTherapy.fillLastSession(score, currentReps, (int)totalTime, level.ToString());
//		objTherapy.saveLastGameSession ();
//
//		objTherapy.savePerformance((int)bestTotalLeftShoulderAngle, "4");
//		objTherapy.savePerformance((int)bestTotalRightShoulderAngle, "5");
    }
Exemple #2
0
    public void LoadLevelSelected()
    {
        TherapySessionObject objTherapy = GameObject.Find("TherapySession").GetComponent <TherapySessionObject> ();

        objTherapy.restartLastSession();
        UnityEngine.SceneManagement.SceneManager.LoadScene(levelToLoad);
    }
Exemple #3
0
    public void guardarDatos()
    {
        string movimiento;

        if (rodilla == true && pie == true)
        {
            movimiento = "rodilla y pie";
        }
        else if (rodilla == true)
        {
            movimiento = "rodilla";
        }
        else
        {
            movimiento = "pie";
        }
        GameObject tre = GameObject.Find("TherapySession");

        if (tre != null)
        {
            TherapySessionObject objTherapy = tre.GetComponent <TherapySessionObject>();

            if (objTherapy != null)
            {
                objTherapy.fillLastSession(puntos, repeticionesTotales, (int)valorPlay, "1");
                objTherapy.saveLastGameSession();



                objTherapy.savePerformance((int)anguloMin, movimiento);
            }
        }
    }
    void Start()
    {
        if (tso != null)
        {
            tso = gameObject.GetComponent <TherapySessionObject>();
        }

        gameSessionList = new List <GameSession>();
        therapyId       = "";
    }
    public void SaveAndShowResults()
    {
        TherapySessionObject objTherapy = TherapySessionObject.tso;

        //if (objTherapy != null)
        //{
        //    objTherapy.fillLastSession(score, totalRepetitions, (int)totalTime, level.ToString());
        //    objTherapy.saveLastGameSession();
        //}

        int finalScore;

        if (totalRepetitions == 0)
        {
            finalScore = 0;
        }
        else
        {
            finalScore = (int)(((float)score / totalRepetitions) * 100.0f);
        }
        resultsScoreText.text = "Desempeño: " + finalScore + "%";

        if (objTherapy != null)
        {
            resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%";
        }

        if (finalScore <= 60)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!";
            star1.sprite = starOn;
            star2.sprite = starOff;
            star3.sprite = starOff;
        }
        else if (finalScore <= 90)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOff;
        }
        else if (finalScore <= 100)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOn;
        }

        resultsPanel.SetActive(true);
    }
Exemple #6
0
    void EndGame()
    {
        // game is over


        // repurpose the timer to display a message to the player



        // reduce the pitch of the background music, if it is set
        //if (musicAudioSource)
        //	musicAudioSource.pitch = 0.5f; // slow down the music


        GameObject.Find("Canvas").SetActive(false);

        TherapySessionObject objTherapy = GameObject.Find("TherapySession").GetComponent <TherapySessionObject> ();

        objTherapy.fillLastSession(score, currentReps, (int)totalTime, level.ToString());
        objTherapy.saveLastGameSession();

        objTherapy.savePerformance((int)bestTotalLeftShoulderAngle, "4");
        objTherapy.savePerformance((int)bestTotalRightShoulderAngle, "5");

        int finalScore = (int)(((double)score / currentReps) * 100.0f);

        canvasScoreText.GetComponentInChildren <TextMesh>().text      = finalScore + "%";
        canvasBestScoreText.GetComponentInChildren <TextMesh> ().text = objTherapy.getGameRecord() + "%";


        if (finalScore <= 60)
        {
            resultMessage.GetComponent <TextMesh>().text = "¡Muy bien!";
            bronzeTrophy.SetActive(true);
        }
        else if (finalScore <= 90)
        {
            resultMessage.GetComponent <TextMesh>().text = "¡Grandioso!";
            bronzeTrophy.SetActive(false);
            silverTrophy.SetActive(true);
        }
        else if (finalScore <= 100)
        {
            resultMessage.GetComponent <TextMesh>().text = "¡Increíble!";
            bronzeTrophy.SetActive(false);
            goldTrophy.SetActive(true);
        }

        canvasResults.SetActive(true);
    }
    private void saveData()
    {
        GameObject tre = GameObject.Find("TherapySession");

        if (tre != null)
        {
            TherapySessionObject objTherapy = tre.GetComponent <TherapySessionObject>();

            if (objTherapy != null)
            {
                objTherapy.fillLastSession(score_script.score_obtain, score_script.score_max, (int)0, "1");
                objTherapy.saveLastGameSession();

                objTherapy.savePerformance((int)HoldParametersVecinosInvasores.best_score, "33");
            }
        }
    }
Exemple #8
0
        public void SaveAndShowResults()
        {
            TherapySessionObject objTherapy = TherapySessionObject.tso;

            //if (objTherapy != null)
            //{
            //    objTherapy.fillLastSession(score, totalRepetitions, (int)totalTime, level.ToString());
            //    objTherapy.saveLastGameSession();
            //}
            string         idMinigame = "10";
            GameSessionDAO gameDao    = new GameSessionDAO();

            int finalScore;

            if (totalRepetitions == 0)
            {
                finalScore = 0;
            }
            else
            {
                finalScore = (int)(((float)score / totalRepetitions) * 100.0f);
            }
            resultsScoreText.text = "Desempeño: " + finalScore + "%";
            if (this.withTime == true)
            {
                GameSessionController gameCtrl = new GameSessionController();
                gameCtrl.addGameSession(finalScore, 0, this.totalTime, score, idMinigame);
            }
            else
            {
                GameSessionController gameCtrl = new GameSessionController();
                gameCtrl.addGameSession(finalScore, this.totalRepetitions, 0, score, idMinigame);
            }
            if (objTherapy != null)
            {
                resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%";
            }
            else
            {
                resultsBestScoreText.text = "Mejor: " + gameDao.GetScore(idMinigame) + "%";
            }

            if (finalScore <= 60)
            {
                //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!";
                star1.sprite = starOn;
                star2.sprite = starOff;
                star3.sprite = starOff;
            }
            else if (finalScore <= 90)
            {
                //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!";
                star1.sprite = starOn;
                star2.sprite = starOn;
                star3.sprite = starOff;
            }
            else if (finalScore <= 100)
            {
                //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!";
                star1.sprite = starOn;
                star2.sprite = starOn;
                star3.sprite = starOn;
            }

            resultsPanel.SetActive(true);


            SendPerformance();

            if (PlaylistManager.pm != null && PlaylistManager.pm.active)
            {
                PlaylistManager.pm.NextGame();
            }
        }
    public void EndGame()
    {
        player.SetActive(false);
        mainPanel.SetActive(false);
        string idMiniGame = "7";

        TherapySessionObject objTherapy = TherapySessionObject.tso;

        if (objTherapy != null)
        {
            //objTherapy.fillLastSession(score, fullScore, (int)totalTime, "0");
            //objTherapy.saveLastGameSession();

            //objTherapy.savePerformance((int)kickScript.BestLeftHipFrontAngle, "4");
            //objTherapy.savePerformance((int)kickScript.BestRightHipFrontAngle, "5");
        }
        GameSessionDAO gameDao = new GameSessionDAO();
        int            finalScore;

        if (fullScore > 0)
        {
            finalScore = (int)(((float)score / fullScore) * 100.0f);
        }
        else
        {
            finalScore = 0;
        }
        resultsScoreText.text = "Desempeño: " + finalScore + "%";

        //int angle = (int)_angleLeft;
        GameSessionController gameCtrl        = new GameSessionController();
        PerformanceController performanceCtrl = new PerformanceController();

        if (this.withTime == true)
        {
            if (JogBool == true && CrouchBool == true && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == false && CrouchBool == true && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame);
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == false && CrouchBool == false && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame);
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == false && CrouchBool == true && JumpBool == false)
            {
                gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame);
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
            }
            if (JogBool == true && CrouchBool == false && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == true && CrouchBool == true && JumpBool == false)
            {
                gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
            }
            if (JogBool == true && CrouchBool == false && JumpBool == false)
            {
                gameCtrl.addGameSession(finalScore, 0, totalTime, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
            }
        }
        if (this.withTime == false)
        {
            if (JogBool == true && CrouchBool == true && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == false && CrouchBool == true && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame);
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == false && CrouchBool == false && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame);
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == false && CrouchBool == true && JumpBool == false)
            {
                gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame);
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
            }
            if (JogBool == true && CrouchBool == false && JumpBool == true)
            {
                gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
                performanceCtrl.addPerformance((int)JumpThreshold, "7");
            }
            if (JogBool == true && CrouchBool == true && JumpBool == false)
            {
                gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
                performanceCtrl.addPerformance((int)CrouchThreshold, "8");
            }
            if (JogBool == true && CrouchBool == false && JumpBool == false)
            {
                gameCtrl.addGameSession(finalScore, 0, totalRepetitions, score, idMiniGame);
                performanceCtrl.addPerformance((int)JogThreshold, "16");
            }
        }

        if (objTherapy != null)
        {
            resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%";
        }
        else
        {
            resultsBestScoreText.text = "Mejor:" + gameDao.GetScore(idMiniGame) + "%";
        }

        if (finalScore <= 60)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!";
            star1.sprite = starOn;
            star2.sprite = starOff;
            star3.sprite = starOff;
        }
        else if (finalScore <= 90)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOff;
        }
        else if (finalScore <= 100)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOn;
        }

        StartCoroutine(DelayedFinalAnimation());
        //resultsPanel.SetActive(true);
    }
    public void SaveAndShowResults()
    {
        TherapySessionObject objTherapy = TherapySessionObject.tso;

        if (objTherapy != null)
        {
            objTherapy.fillLastSession(score, totalRepetitions, (int)totalTime, level.ToString());
            objTherapy.saveLastGameSession();

            objTherapy.savePerformance((int)kickScript.BestLeftHipFrontAngle, "4");
            objTherapy.savePerformance((int)kickScript.BestRightHipFrontAngle, "5");
        }
        string         idMinigame = "5";
        GameSessionDAO gameDao    = new GameSessionDAO();
        int            finalScore;

        if (totalRepetitions > 0)
        {
            finalScore = (int)(((float)score / totalRepetitions) * 100.0f);
        }
        else
        {
            finalScore = 0;
        }
        resultsScoreText.text = "Desempeño: " + finalScore + "%";

        float totalRepFloat = (float)totalRepetitions;
        ParametersScreenManagerTiroLibre pmTiroLibre = new ParametersScreenManagerTiroLibre();

        pmTiroLibre.SendGame(finalScore, totalRepFloat, totalTime, score, idMinigame);
        if (useFrontPlane == true)
        {
            PerformanceController performanceCtrl = new PerformanceController();
            performanceCtrl.addPerformance((int)this.FrontAngle1, "36");
            performanceCtrl.addPerformance((int)this.FrontAngle2, "37");
            performanceCtrl.addPerformance((int)this.FrontAngle3, "38");
        }
        if (useBackPlane == true)
        {
            PerformanceController performanceCtrl = new PerformanceController();
            performanceCtrl.addPerformance((int)this.BackAngle1, "33");
            performanceCtrl.addPerformance((int)this.BackAngle2, "34");
            performanceCtrl.addPerformance((int)this.BackAngle3, "35");
        }

        if (objTherapy != null)
        {
            resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%";
        }
        else
        {
            resultsBestScoreText.text = "Mejor:" + gameDao.GetScore(idMinigame) + "%";
        }

        if (finalScore <= 60)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!";
            star1.sprite = starOn;
            star2.sprite = starOff;
            star3.sprite = starOff;
        }
        else if (finalScore <= 90)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOff;
        }
        else if (finalScore <= 100)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOn;
        }

        resultsPanel.SetActive(true);


        //playlist block
        if (PlaylistManager.pm != null && PlaylistManager.pm.active)
        {
            PlaylistManager.pm.NextGame();
        }
    }
Exemple #11
0
    private void EndGame()
    {
        mainPanel.SetActive(false);

        TherapySessionObject objTherapy = TherapySessionObject.tso;

        if (objTherapy != null)
        {
            //objTherapy.fillLastSession(score, fullScore, (int)totalTime, "0");
            //objTherapy.saveLastGameSession();

            //objTherapy.savePerformance((int)kickScript.BestLeftHipFrontAngle, "4");
            //objTherapy.savePerformance((int)kickScript.BestRightHipFrontAngle, "5");
        }
        string idMinigame = "11";

        int            finalScore;
        GameSessionDAO gameDao = new GameSessionDAO();

        if (fullScore > 0)
        {
            finalScore = (int)(((float)score / fullScore) * 100.0f);
        }
        else
        {
            finalScore = 0;
        }
        resultsScoreText.text = "Desempeño: " + finalScore + "%";

        GameSessionController gameCtrl = new GameSessionController();

        int scoreBD = finalScore;

        if (withTime == true)
        {
            gameCtrl.addGameSession(score, 0, totalTime, scoreBD, idMinigame);
        }
        if (withTime == false)
        {
            gameCtrl.addGameSession(score, totalRepetitions, 0, scoreBD, idMinigame);
        }

        if (this.useFlexion == true)
        {
            sendPerformanceTouch();
        }
        else
        {
            sendPerformancePinch();
        }

        if (objTherapy != null)
        {
            resultsBestScoreText.text = "Mejor: " + objTherapy.getGameRecord() + "%";
        }
        else
        {
            resultsBestScoreText.text = "Mejor:" + gameDao.GetScore(idMinigame) + "%";
        }

        if (finalScore <= 60)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Muy bien!";
            star1.sprite = starOn;
            star2.sprite = starOff;
            star3.sprite = starOff;
        }
        else if (finalScore <= 90)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Grandioso!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOff;
        }
        else if (finalScore <= 100)
        {
            //resultMessage.GetComponent<TextMesh>().text = "¡Increíble!";
            star1.sprite = starOn;
            star2.sprite = starOn;
            star3.sprite = starOn;
        }



        StartCoroutine(FinalAnimation());
    }