Exemple #1
0
 //private static int printScore;
 public static void FinishLevel()
 {
     if (SceneManagerTest.GetCurrentScene() != GameManager.victoryScene)
     {
         SceneManagerTest.LoadNextScene(GameManager.victoryScene);
     }
     //printScore = ScoreManager.instance.CalculateFinalScore();
 }
Exemple #2
0
    public IEnumerator DisapearFeedbackText()
    {
        yield return(new WaitForSecondsRealtime(3));

        if (SceneManagerTest.GetCurrentScene() == GameManager.tutorialScene || SceneManagerTest.GetCurrentScene() == GameManager.gameScene)
        {
            FeedBackText.enabled = false;
        }
    }
Exemple #3
0
    IEnumerator DisapearCheckOrCross()
    {
        //Debug.Log("TENGO QUE APAGAR EL CHECK");
        yield return(new WaitForSecondsRealtime(2));

        if (SceneManagerTest.GetCurrentScene() == GameManager.tutorialScene || SceneManagerTest.GetCurrentScene() == GameManager.gameScene)
        {
            checkAndCrossImg.enabled = false;
            player.Input.StopBrake();
        }
    }
Exemple #4
0
 private void Update()
 {
     if (SceneManagerTest.GetCurrentScene() == GameManager.gameScene || SceneManagerTest.GetCurrentScene() == GameManager.tutorialScene)
     {
         if (Time.timeScale != 0)
         {
             lifeTime -= Time.deltaTime;
             print("Lifetime Scoremanager: " + lifeTime);
         }
         if (lifeTime <= 0)
         {
             lifeTime = 0;
             if (SceneManagerTest.GetCurrentScene() == GameManager.gameScene)
             {
                 StartCoroutine(FinishLevelCR());
             }
         }
     }
 }
Exemple #5
0
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);
    }
Exemple #6
0
    private void playBtnClicked()
    {
        int timestutorialfinished = GameManager.GetTutorialPref();

        //PASO AL TUTORIAL//
        if (timestutorialfinished > 0)
        {
            SceneManagerTest.LoadGame(GameManager.gameScene);
            Debug.LogError("Hundi play y vamos al juego");
        }
        else if (timestutorialfinished == 0)
        {
            SceneManagerTest.LoadGame(GameManager.tutorialScene);
            Debug.LogError("Hundi play y vamos al tutorial");
        }

        //METODO DE LLAMADO BASICO//

        /*SceneManagerTest.LoadNextScene("TestScene 2");
        *  Debug.LogError("Hundi play y vamos al juego");*/
    }
Exemple #7
0
    private void Update()
    {
        //Debug.LogError("Pause canvas esta activado? " + pausePanel.activeInHierarchy);
        if (SceneManagerTest.GetCurrentScene() == GameManager.tutorialScene || SceneManagerTest.GetCurrentScene() == GameManager.gameScene)
        {
            if (player)
            {
                fillPercent = (player.GetMovableComponent.GetCurrentSpeed / player.GetMovableComponent.GetMaxSpeed);
                //Debug.Log("Fill Percent: "  + fillPercent);
                speedImage.fillAmount = fillPercent;
                var lifeTimeInt = Mathf.RoundToInt(ScoreManager.lifeTime);
                print("Lifetime: " + lifeTimeInt);
                timeLeftText.text = lifeTimeInt.ToString();
            }
        }

        /*if (SceneManagerTest.GetCurrentScene() == "VictoryScreenScene")
         * {
         *  //PONER A QUE BUSQUE EL BOTON CUANDO SEA LA ESCENA DE VICTORIA Y ASIGNARLE EL METODO QUE TIENE QUE LLAMAR POR CODIGO//
         *  botonVolver = GameObject.Find("BotonVolver").GetComponent<Button>();
         * }*/
    }
Exemple #8
0
    public void FillTextArray()
    {
        //Llenar el array de textos para poder hacer un ciclo para llenar los textos con los scores con el countto//
        if (SceneManagerTest.GetCurrentScene() == GameManager.victoryScene)
        {
            textsForScores[0] = GameObject.Find("TiempoCounter").GetComponent <Text>();
            textsForScores[1] = GameObject.Find("RespuestasCorrectasCounter").GetComponent <Text>();
            textsForScores[2] = GameObject.Find("ReportesCorrectosCounter").GetComponent <Text>();
            textsForScores[3] = GameObject.Find("InfraccionesCounter").GetComponent <Text>();
            textsForScores[4] = GameObject.Find("ReportesIncorrectosCounter").GetComponent <Text>();
            textsForScores[5] = GameObject.Find("RespuestasIncorrectasCounter").GetComponent <Text>();
            textsForScores[6] = GameObject.Find("TotalCounter").GetComponent <Text>();

            //FILL SCORES ARRAY FROM SCORE MANAGER FOR COUNTER//
            scoresToCountTo[0] = ScoreManager.timeScore;
            scoresToCountTo[1] = ScoreManager.correctAnswerScore;
            scoresToCountTo[2] = ScoreManager.correctReportScore;
            scoresToCountTo[3] = ScoreManager.InfractionScore;
            scoresToCountTo[4] = ScoreManager.wrongReportScore;
            scoresToCountTo[5] = ScoreManager.wrongAnswerScore;
            scoresToCountTo[6] = ScoreManager.finalScore;
        }
    }
Exemple #9
0
 IEnumerator CrashCR()
 {
     yield return CanvasManager._instance.DisapearFeedbackText();
     SceneManagerTest.LoadNextScene(GameManager.victoryScene);
     Time.timeScale = 1;
 }
Exemple #10
0
 public void BackToMenuBtnClicked()
 {
     SceneManagerTest.LoadNextScene(GameManager.menuScene);
     Debug.LogError("Hundi quit desde la pausa");
 }
Exemple #11
0
 private void tutorialBtnClicked()
 {
     SceneManagerTest.LoadNextScene("Tutorial");
 }