Esempio n. 1
0
    public void NewAttempt(bool displayText)
    {
        //saveSessionData.SaveData(); //save data before changing the state
        if (sessionStarted)
        {
            if (!attemptsAllowed)
            {
                if (displayText)
                {
                    uiManager.OpenDialogBox("Retour au départ pas autorisé.");
                }
            }
            if (sessionStarted && !sessionEnded && attemptsAllowed)
            {
                if (!sequenceManager.attemptsLimited || (sequenceManager.attemptsLimited && attemptCount <= sequenceManager.activeScenario.maxAttempts)) //Attempts are not limited OR are attempts left
                {
                    if (attemptCount == sequenceManager.activeScenario.maxAttempts)                                                                      //Last possible attempt
                    {
                        Debug.Log("This is your last attempt");
                        if (displayText)
                        {
                            uiManager.OpenDialogBox("Dernière tentative.");
                        }
                    }
                    else //More than 1 attempt left
                    {
                        Debug.Log("new atempts" + attemptCount + " /" + sequenceManager.activeScenario.maxAttempts);
                        if (displayText)
                        {
                            uiManager.OpenDialogBox("Nouvelle tentative.");
                        }
                    }
                    //TODO: Dialog box display
                    //saveSessionData.SaveData();
                    if (intersectionManager.onIntersection && intersectionManager.sessionRoute.Count == 1)    // in an intersection AND one coordinate only AND that is the first one
                    {
                        Debug.Log("test");
                        ResetRoute();
                        intersectionManager.OnIntersectionEnter(intersectionManager.lastIntersectionCollider);
                        //intersectionManager.sessionRoute.Add(intersectionManager.lastIntersectionCollider.GetComponent<Intersection>().coordString);
                    }

                    else
                    {
                        ResetRoute();
                    }
                }
                else if (sequenceManager.attemptsLimited && attemptCount > sequenceManager.activeScenario.maxAttempts) //Attempts are limited and player is out of attempts
                {
                    Debug.Log("Out of attempts: " + attemptCount + " /" + sequenceManager.activeScenario.maxAttempts);
                    //TODO: Dialog box text + close
                    if (displayText)
                    {
                        uiManager.OpenDialogBox("Il ne reste plus de tentative.");
                    }
                }
            }
        }
    }
Esempio n. 2
0
 // WHEN PLAYER ENTERS AN INTERSECTION OR WALKS ON HOTSPOT
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Intersection")
     {
         intersectionManager.OnIntersectionEnter(other);
     }
     else if (other.tag == "Checkpoint")
     {
         checkpointManager.OnCheckpointEnter(other);
     }
     else if (other.tag == "Hotspot")
     {
         hotspotManager.OnHotspotEnter(other);
     }
     //Debug.Log(other.tag + " IN ()");
 }