Esempio n. 1
0
    void Configure_Environment()
    {
        Lightening.SetActive(true);
        StartCoroutine(doLight());
        float darkpercentage = (float)((float)wrongeOnes / (float)TotalDecisions);

        Darker.vignette.intensity = 1.5f * darkpercentage;

        float lightpercentage = (float)((float)correctOnes / (float)TotalDecisions);

        Lighter.settings.intensity = 0.25f * lightpercentage;

        if (DecisionCounter >= TotalDecisions)
        {
            character.Interacting = true;
            if (correctOnes >= 10)
            {
                winScreen.SetActive(true);
                // Win..
                print("win..");
            }
            else
            {
                LoseScreen.SetActive(true);
                print("lose..");
                // Lose..
            }


            StartCoroutine(LoadDelayedScene());
        }
    }
Esempio n. 2
0
    public void AddHealth(float amount)
    {
        healthPoints += amount;

        if (gameObject.name.Contains("Enemy"))
        {
            healthBar.fillAmount = healthPoints / startHealth;
        }

        if (gameObject.name.Contains("Player"))
        {
            PlayerHealthOverlay.SetActive(true);
        }

        // Die
        if (healthPoints <= 0)
        {
            if (gameObject.name.Contains("Enemy"))
            {
                Destroy(gameObject);
                WinScreen.SetActive(true);
                Time.timeScale = 0.0f;
            }

            if (gameObject.name.Contains("Player"))
            {
                Destroy(gameObject);
                LoseScreen.SetActive(true);
                Time.timeScale = 0.0f;
            }
        }
    }
Esempio n. 3
0
    void StartGame()
    {
        GameIsStarted = true;

        WinScreen.SetActive(false);
        LoseScreen.SetActive(false);

        StartCoroutine(SpawnBottles());
    }
 public void GameOver()
 {
     foreach (BalloonController balloon in AIBalloons)
     {
         balloon.active = false;
     }
     FinalProfit.text = score.ToString();
     GameUI.SetActive(false);
     LoseScreen.SetActive(true);
 }
Esempio n. 5
0
 void Update()
 {
     if (isLose)
     {
         LoseScreen.SetActive(true);
         playertouch.enabled = false;
         generator.enabled   = false;
         timer += 0.02f;
         loseScoreText.text = Mathf.RoundToInt(Mathf.Lerp(0, PlayerTouch.score, timer)).ToString();
     }
 }
Esempio n. 6
0
 public void Lose()
 {
     Debug.Log("Lose");
     Save_Prefs();
     Time.timeScale  = 0f;
     finalScore.text = coinCount.ToString();
     Menu.enabled    = false;
     LoseScreen.SetActive(true);
     if (i == 1)
     {
         soundEffector.PlayLoseSound();
     }
     i = 0;
 }
Esempio n. 7
0
    // Update is called once per frame
    void Update()
    {
        if (target == null)                                                     // if their is no target
        {
            for (int i = 0; i < AIList.Count; i++)                              // find all AI
            {
                countDown = AIList[i].pawn.DoIdle(AIList[i].speed, countDown);  // change look direction after count down
                if (countDown < 0)                                              // if countdown is less than 0
                {
                    countDown = startPoint;                                     // reset countdown
                }
            }
        }

        if (target != null)                                         // if their is a target
        {
            if (target.GetComponent <AIController>() != null)       // make sure the target has an AI component
            {
                FSM();                                              // run Finite State Mahcine
            }
        }

        if (playerHealth.value <= 0 && gameIsRuning)        // if the player's health reaches 0 and game is running
        {
            lose = true;                                    // Game is over and player lost
        }

        if (win || lose)                    // if lose or win condition is meet
        {
            Time.timeScale = 0;             // freeze motion
            gameIsRuning   = false;         // game is not runnign

            if (win)                        // if win
            {
                winScreen.SetActive(true);  // show win screen
                win = false;                // Reset win to false
            }
            else                            // otherwise if lose
            {
                LoseScreen.SetActive(true); // show lose screen
                lose = false;               // Reset lose to false
            }
        }
    }