Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        switch (ResourceInfoController.GetDifficulty())
        {
        case 1:
            button.sprite = buttons[0];
            break;

        case 2:
            button.sprite = buttons[1];
            break;

        case 3:
            button.sprite = buttons[2];
            break;

        default:
            button.sprite = buttons[0];
            break;
        }
        float val = EffectivenessBarController.barDisplay;

        if (val < 0.25)
        {
            blurb.text = "Oh no! You failed to protect the coast. Try again?";
        }
        else if (val < 0.5)
        {
            blurb.text = "Looks like your plan was no match for the storm surge. Better luck next time.";
        }
        else if (val < 0.75)
        {
            blurb.text = "Your solutions kept most of the storm surge at bay. Think you can do better?";
        }
        else if (val < 0.9)
        {
            blurb.text = "Strong work! You are an amazing Coastal Defender!";
        }
        else if (val < 2)
        {
            blurb.text = "Whoa! You are the ultimate Coastal Defender!";
        }
        else
        {
            blurb.text = "Try again!";
        }
    }
 // Use this for initialization
 void Start()
 {
     if (ResourceInfoController.GetDifficulty() == 1)
     {
         hurricaneName.text = "Hurricane Matthew";
         date.text          = "October 8, 2016";
         blurb.text         = "During Hurricane Matthew, river flood levels were the highest recorded in 20 years and caused millions of dollars of damage and multiple deaths across the eastern third of North Carolina.";
         catButton.sprite   = buttons[0];
         wind.text          = "94 mph";
         surge.text         = "5.8 ft";
         property.text      = "$1.6 billion";
         lives.text         = "26";
         image.sprite       = images[0];
     }
     else if (ResourceInfoController.GetDifficulty() == 2)
     {
         hurricaneName.text = "Hurricane Floyd";
         date.text          = "September 16, 1999";
         blurb.text         = "The rains produced from Hurricane Dennis and then Floyd triggered the fourth largest evacuation in US history.";
         catButton.sprite   = buttons[1];
         wind.text          = "90 mph";
         surge.text         = "10 ft";
         property.text      = "$6.5 billion";
         lives.text         = "51";
         image.sprite       = images[1];
     }
     else if (ResourceInfoController.GetDifficulty() == 3)
     {
         hurricaneName.text = "Hurricane Fran";
         date.text          = "September 5, 1996";
         blurb.text         = "As of 2018, Fran is the most recent major hurricane to make landfall in North Carolina. At the time, Fran was one of the ten costliest hurricanes to strike the United States.";
         catButton.sprite   = buttons[2];
         wind.text          = "137 mph";
         surge.text         = "10 ft";
         property.text      = "$2.4 billion";
         lives.text         = "13";
         image.sprite       = images[2];
     }
 }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        KeyboardController.slideDisable = true;
        Debug.Log("DIFFICULTY");
        Debug.Log(ResourceInfoController.GetDifficulty());
        points       = null; // GameObject.FindGameObjectWithTag("Points").GetComponent<PointsController>();
        solutionList = this.gameObject.GetComponentsInChildren <SolutionController>();
        switch (ResourceInfoController.GetDifficulty())
        {
        case 1:
            points.pointsCount = 230;
            break;

        case 2:
            points.pointsCount = 210;
            break;

        case 3:
            points.pointsCount = 190;
            break;

        default:
            // points.pointsCount = 230;
            break;
        }

        /*
         * solutionList[0].count = Random.Range(0, 3);
         * solutionList[1].count = Random.Range(0, 3);
         * solutionList[2].count = Random.Range(0, 2);
         * solutionList[3].count = Random.Range(0, 2);
         * solutionList[4].count = Random.Range(1, 3);
         * solutionList[0].startcount = solutionList[0].count;
         * solutionList[1].startcount = solutionList[1].count;
         * solutionList[2].startcount = solutionList[2].count;
         * solutionList[3].startcount = solutionList[3].count;
         * solutionList[4].startcount = solutionList[4].count;
         */
    }
    void Start()
    {
        difficulty             = ResourceInfoController.GetDifficulty();
        currentResourceNumbers = new int[5];
        maxResourceNumbers     = new int[5] {
            4, 4, 2, 1, 3
        };
        resourceCosts = new int[5] {
            20, 30, 50, 100, 25
        };
        switch (difficulty)
        {
        case 1:
            coins = 230;
            break;

        case 2:
            coins = 200;
            break;

        case 3:
            coins = 170;
            break;

        default:
            coins = 200;
            break;
        }
        coinDisplay.text = coins.ToString();
        currentPhase     = 1;

        // Get ready to play the introduction video

        // Confirm that the introduction video has finished, start swapping things into the main game
        // Call on the difficulty to make sure we're loading things in properly for coins and maps
        firstChange = true;

        Debug.Log("Printing some stuff after the main timer to see if multithreading is active");
    }
Ejemplo n.º 5
0
    IEnumerator playVideo()
    {
        Debug.Log("VIDEO HERE");
        if (EffectivenessBarController.barDisplay < 0.3)
        {
            videoPlayer.clip = videoClips[0];
        }
        else if (EffectivenessBarController.barDisplay < 0.7)
        {
            videoPlayer.clip = videoClips[1];
        }
        else if (EffectivenessBarController.barDisplay < 2)
        {
            videoPlayer.clip = videoClips[2];
        }


        switch (ResourceInfoController.GetDifficulty())
        {
        case 1:
            hurricanePlayer.clip = hurricanePath[0];
            break;

        case 2:
            hurricanePlayer.clip = hurricanePath[1];
            break;

        case 3:
            hurricanePlayer.clip = hurricanePath[2];
            break;
        }
        videoPlayer.Prepare();
        hurricanePlayer.Prepare();
        //Disable Play on Awake for both Video and Audio
        //videoPlayer.playOnAwake = false;

        //Wait until video is prepared
        while (!videoPlayer.isPrepared || !hurricanePlayer.isPrepared)
        {
            yield return(null);
        }

        Debug.Log("Done Preparing Video");

        //Assign the Texture from Video to RawImage to be displayed
        hurricaneImage.texture = hurricanePlayer.texture;
        image.texture          = videoPlayer.texture;
        hurricaneImage.color   = Color.white;



        //Play Video
        hurricanePlayer.Play();
        videoPlayer.Play();


        //image.color = new Color(255.0f, 255.0f, 255.0f, 1f);

        Debug.Log("Playing Video");
        while (videoPlayer.isPlaying || hurricanePlayer.isPlaying)
        {
            //Debug.LogWarning("Video Time: " + Mathf.FloorToInt((float)videoPlayer.time));
            yield return(null);
        }


        Debug.Log("Done Playing Video");
        backdrop.color = initCol;
        SceneManager.LoadScene("endgame");
    }
    // Use this for initialization
    void Awake()
    {
        netLandScore   = Mathf.RoundToInt(620f * Mathf.Log10(PlayerPrefs.GetFloat("netLand") + 1));
        netAnimalScore = Mathf.RoundToInt(620 * Mathf.Log10(PlayerPrefs.GetFloat("netAnimal") + 1));
        netHumanScore  = Mathf.RoundToInt(620f * Mathf.Log10(PlayerPrefs.GetFloat("netHuman") + 1));
        netScore       = netLandScore + netHumanScore + netAnimalScore;
        PlayerPrefs.SetFloat("netScore", netScore);
        netScoreText.text = Mathf.RoundToInt(netScore).ToString();
        float humanpercent  = 0;
        float landpercent   = 0;
        float animalpercent = 0;

        if (ResourceInfoController.GetDifficulty() == 1)
        {
            humanpercent           = (PlayerPrefs.GetFloat("netHuman") / 20);
            landpercent            = (PlayerPrefs.GetFloat("netLand") / 20);
            animalpercent          = (PlayerPrefs.GetFloat("netAnimal") / 20);
            humanPBar.offsetMax    = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netHuman") / 20))), humanPBar.offsetMax.y);
            propertyPBar.offsetMax = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netLand") / 20))), propertyPBar.offsetMax.y);
            ecoPBar.offsetMax      = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netAnimal") / 20))), ecoPBar.offsetMax.y);
        }
        else if (ResourceInfoController.GetDifficulty() == 2)
        {
            humanpercent           = (PlayerPrefs.GetFloat("netHuman") / 30);
            landpercent            = (PlayerPrefs.GetFloat("netLand") / 25);
            animalpercent          = (PlayerPrefs.GetFloat("netAnimal") / 25);
            humanPBar.offsetMax    = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netHuman") / 30))), humanPBar.offsetMax.y);
            propertyPBar.offsetMax = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netLand") / 25))), propertyPBar.offsetMax.y);
            ecoPBar.offsetMax      = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netAnimal") / 25))), ecoPBar.offsetMax.y);
        }
        else if (ResourceInfoController.GetDifficulty() == 3)
        {
            humanpercent           = (PlayerPrefs.GetFloat("netHuman") / 15);
            landpercent            = (PlayerPrefs.GetFloat("netLand") / 35);
            animalpercent          = (PlayerPrefs.GetFloat("netAnimal") / 25);
            humanPBar.offsetMax    = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netHuman") / 15))), humanPBar.offsetMax.y);
            propertyPBar.offsetMax = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netLand") / 35))), propertyPBar.offsetMax.y);
            ecoPBar.offsetMax      = new Vector2((float)(-(207.5 - 315 * (PlayerPrefs.GetFloat("netAnimal") / 25))), ecoPBar.offsetMax.y);
        }

        if (humanpercent < 0.3)
        {
            humanBar.color = Color.red;
        }
        else if (humanpercent < 0.7)
        {
            humanBar.color = Color.yellow;
        }
        else
        {
            humanBar.color = Color.green;
        }
        if (landpercent < 0.3)
        {
            propertyBar.color = Color.red;
        }
        else if (landpercent < 0.7)
        {
            propertyBar.color = Color.yellow;
        }
        else
        {
            propertyBar.color = Color.green;
        }
        if (animalpercent < 0.3)
        {
            ecosystemBar.color = Color.red;
        }
        else if (animalpercent < 0.7)
        {
            ecosystemBar.color = Color.yellow;
        }
        else
        {
            ecosystemBar.color = Color.green;
        }

        if (-humanPBar.offsetMax.x < -107.5)
        {
            humanPBar.offsetMax = new Vector2((float)-(-107.5), humanPBar.offsetMax.y);
        }
        if (-propertyPBar.offsetMax.x < -107.5)
        {
            propertyPBar.offsetMax = new Vector2((float)-(-107.5), propertyPBar.offsetMax.y);
        }
        if (-ecoPBar.offsetMax.x < -107.5)
        {
            ecoPBar.offsetMax = new Vector2((float)-(-107.5), ecoPBar.offsetMax.y);
        }

        Debug.Log("VALUES");
        Debug.Log((PlayerPrefs.GetFloat("netHuman")));
        Debug.Log((PlayerPrefs.GetFloat("netLand")));
        Debug.Log((PlayerPrefs.GetFloat("netAnimal")));
        Debug.Log(humanPBar.offsetMax);
        Debug.Log(propertyPBar.offsetMax);
        Debug.Log(ecoPBar.offsetMax);

        //humanBar.
    }