Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (PlayerPrefs.GetInt("SISpeedTutorial") == 1)
        {
            tutorialReady = true;
        }

        if (tutorialReady)
        {
            if (!tutorialOver)
            {
                elapsedTime += Time.deltaTime;

                if (elapsedTime > tutorialDelay)
                {
                    showTutorial = true;
                }
            }

            if (zymeScript.getButtonPressed() && showTutorial)
            {
                showTutorial = false;
                zymeScript.setDraw(false);
                tutorialOver = true;
                PlayerPrefs.SetInt("SISpeedTutorial", 0);
                //PlayerPrefs.SetInt("SIFatsTutorial", 1);
                PlayerPrefs.Save();
                Time.timeScale = 1;
            }
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (PlayerPrefs.GetInt("SINutrientsTutorial") == 0)
        {
            return;
        }

        if (!tutorialOver && PlayerPrefs.GetInt("SIStats_towersPlaced") > 1)
        {
            elapsedTime += Time.deltaTime;

            if (elapsedTime > tutorialDelay)
            {
                if (!chooseHandLocation)
                {
                    getHandLocation();
                }
                showTutorial = true;
            }
        }

        if ((PlayerPrefs.GetInt("SIGlowTutorial") == 1) && showTutorial)
        {
            showTutorial = false;
            zymeScript.setDraw(false);
            tutorialOver   = true;
            Time.timeScale = 1;
        }

        if (tutorialOver)
        {
            PlayerPrefs.SetInt("SISpeedTutorial", 1);
            PlayerPrefs.Save();
        }
    }
 // Update is called once per frame
 void Update()
 {
     // check if the button was pressed to cancel the tutorial
     if (zymeScript.getButtonPressed())
     {
         showTutorial = false;
         zymeScript.setDraw(false);
         Time.timeScale = 1.0f;
     }
 }
Exemple #4
0
    /*
     * Function that checks current towers for an instantiated tower
     * of the desired color.
     */
    private bool checkForTowerOfColor(Color color)
    {
        GameObject[] towers;

        // get all towers on the game board
        towers = GameObject.FindGameObjectsWithTag("tower");

        // iterate through the towers, looking for ones that are actually instantiated and of
        // the desired color
        for (int i = 0; i < towers.Length; i++)
        {
            if (towers[i].GetComponent <Tower>().enabled == true &&
                towers[i].GetComponent <Tower>().getColor() == color)
            {
                // if we find a fat1 tower
                if (color == Fats1Color)
                {
                    // reset the variables for the fat1 tower placement
                    // and set the variables to indicate we are now
                    // looking for a white tower
                    zymeScript.setDraw(false);
                    Time.timeScale    = 1;
                    showTutorialPart1 = false;
                    showTutorialPart2 = true;
                    part1Done         = true;
                    return(true);
                }
                // if we find a white tower
                else if (color == Color.white)
                {
                    // reset the variables for white tower placement
                    // set the variables to move on to the next portion of
                    // the tutorial (if any)
                    zymeScript.setDraw(false);
                    Time.timeScale = 1;
                    PlayerPrefs.SetInt("SIFatsTutorial", 0);
                    PlayerPrefs.Save();
                    showTutorialPart2 = false;
                    part2Done         = true;
                    return(true);
                }
            }
        }

        return(false);
    }
Exemple #5
0
    void OnGUI()
    {
        if (PlayerPrefs.GetInt("SITowerPlaceTutorial") == 1)
        {
            if (PlayerPrefs.GetInt("SIStats_towersPlaced") == 0)
            {
                GUI.DrawTexture(new Rect(.25f * Screen.width, .1f * Screen.height, .3f * Screen.width, .85f * Screen.height), arrow);
            }

            if (stopForZyme)
            {
                zymeScript.setDraw(true);
                zymeScript.setImage(zymePopupImage1);
                Time.timeScale = .01f;
            }

            if (stopForZyme && !startSecondTimer && PlayerPrefs.GetInt("SIStats_towersPlaced") == 1)
            {
                stopForZyme      = false;
                actualArrowTime  = 0f;
                startSecondTimer = true;
                zymeScript.setDraw(false);
            }

            if (PlayerPrefs.GetInt("SIStats_towersPlaced") == 1)
            {
                GUI.DrawTexture(new Rect(.3f * Screen.width, .62f * Screen.height, .25f * Screen.width, .30f * Screen.height), arrow);
            }

            if (stopForZyme && startSecondTimer && actualArrowTime > maxArrowTime)
            {
                zymeScript.setDraw(true);
                zymeScript.setImage(zymePopupImage2);
                Time.timeScale = .01f;
            }

            if (stopForZyme && PlayerPrefs.GetInt("SIStats_towersPlaced") == 2)
            {
                stopForZyme = false;
                zymeScript.setDraw(false);
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        // if we are done just exit this function
        if (powerUpgraded || PlayerPrefs.GetInt("SIUpdateTutorial") == 0)
        {
            return;
        }

        // don't start counting the upgrade time until they have placed 2 towers
        if (PlayerPrefs.GetInt("SIStats_towersPlaced") > 1 && !(PlayerPrefs.GetInt("SIStats_towersUpgraded") > 0) &&
            !drawArrow)
        {
            elapsedTime += Time.deltaTime;
        }

        // if the time has passed spawn an indicator spotlight on the tower to upgrade
        if (elapsedTime > maxUpgradeTimeSpeed && !drawArrow)
        {
            //give nutrients to upgrade and tell to upgrade
            intestineGameManager.nutrients += 50;
            spawnArrowOnTower();
            showZymeSpeed = true;
            elapsedTime   = 0f;
        }

        // set message to explain tower menu once it's activated
        if (showZymeSpeed && intestineGameManager.getTowerMenuUp())
        {
            if (mirrorImage)
            {
                zymeScript.setImage(zymePopupImageSpeedMirrored);
            }
            else
            {
                zymeScript.setImage(zymePopupImageSpeedNorm);
            }
        }

        // destroy the light once the tower is upgraded and count to next upgrade
        if (PlayerPrefs.GetInt("SIStats_towersUpgraded") == 1 && !speedUpgraded)
        {
            speedUpgraded = true;
            drawArrow     = false;
            showZymeSpeed = false;
            zymeScript.setDraw(false);
            zymeScript.setDrawZymeRight();
        }

        // count time until next event
        if (elapsedTime < maxUpgradeTimePower && speedUpgraded)
        {
            elapsedTime += Time.deltaTime;
        }

        // if the time has passed spawn an indicator spotlight on the tower to upgrade
        if (elapsedTime > maxUpgradeTimePower && !drawArrow && speedUpgraded)
        {
            //give nutrients to upgrade and tell to upgrade
            intestineGameManager.nutrients += 50;
            spawnArrowOnTower();
            showZymePower = true;
            elapsedTime   = 0f;
        }

        // set message to explain tower menu once it's activated
        if (showZymePower && intestineGameManager.getTowerMenuUp())
        {
            if (mirrorImage)
            {
                zymeScript.setImage(zymePopupImagePowerMirrored);
            }
            else
            {
                zymeScript.setImage(zymePopupImagePowerNorm);
            }
        }

        // destroy the light once the tower is upgraded and count to next upgrade
        if (PlayerPrefs.GetInt("SIStats_towersUpgraded") == 2)
        {
            drawArrow     = false;
            powerUpgraded = true;
            showZymePower = false;
            zymeScript.setDraw(false);
        }
    }