Exemple #1
0
    public void cycle(string season)
    {
        int chance = Random.Range(0, 101);

        switch (season)
        {
        case "SPRING":
            if (weather == WEATHER.SUNNY)
            {
                if (chance < 10)
                {
                    weather    = WEATHER.CLOUDY;  //10% chance of Cloudy
                    cloudCover = CLOUDCOVER.HEAVY;
                }
                else
                {
                    cloudCover = CLOUDCOVER.LIGHT;
                }
            }

            else if (weather == WEATHER.CLOUDY)
            {
                if (chance < 25)     //25% chance of Rainy
                {
                    weather    = WEATHER.RAINY;
                    cloudCover = CLOUDCOVER.OVERCAST;
                }
                else if (chance < 75)     //50% chance of Sunny
                {
                    weather    = WEATHER.SUNNY;
                    cloudCover = CLOUDCOVER.LIGHT;
                }
                //25% chance REMAINS Cloudy
            }

            else if (weather == WEATHER.RAINY)
            {
                if (chance < 50)     //50% chance of Cloudy
                {
                    weather    = WEATHER.CLOUDY;
                    cloudCover = CLOUDCOVER.HEAVY;
                }
                else if (chance < 70)     //20% chance of IMMEDIATELY Sunny
                {
                    weather    = WEATHER.SUNNY;
                    cloudCover = CLOUDCOVER.LIGHT;
                }
                //30% chance REMAINS Cloudy
            }

            else if (weather == WEATHER.SNOWY)     //IMMEDIATELY Sunny if still Snowy at the end of Winter
            {
                weather    = WEATHER.SUNNY;
                cloudCover = CLOUDCOVER.LIGHT;
            }

            break;

        case "SUMMER":
            if (weather == WEATHER.SUNNY)
            {
                if (chance < 10)     //10% chance of CLOUDY
                {
                    weather    = WEATHER.CLOUDY;
                    cloudCover = CLOUDCOVER.HEAVY;
                }
                else
                {
                    cloudCover = CLOUDCOVER.NONE;
                }
                //Otherwise REMAINS Sunny
            }

            else if (weather == WEATHER.CLOUDY)
            {
                if (chance < 40)     //40$ chance of Sunny
                {
                    weather    = WEATHER.SUNNY;
                    cloudCover = CLOUDCOVER.NONE;
                }
                //otherwise REAMINS Cloudy
            }

            else if (weather == WEATHER.RAINY)     //Always return to Cloudy
            {
                weather    = WEATHER.CLOUDY;
                cloudCover = CLOUDCOVER.HEAVY;
            }
            break;

        case "AUTUMN":
            if (weather == WEATHER.SUNNY)
            {
                if (chance < 60)     //60% chance of Cloudy
                {
                    weather    = WEATHER.CLOUDY;
                    cloudCover = CLOUDCOVER.HEAVY;
                }
                else if (chance < 80)     //20% chance of IMMEDIATE Rainy
                {
                    weather    = WEATHER.RAINY;
                    cloudCover = CLOUDCOVER.OVERCAST;
                    spawnCloud(); spawnCloud();
                }
                //Otherwise REMAINS Sunny
            }

            else if (weather == WEATHER.CLOUDY)
            {
                if (chance < 70)     //70% chance of Rainy
                {
                    weather    = WEATHER.RAINY;
                    cloudCover = CLOUDCOVER.OVERCAST;
                }
                else if (chance < 85)     //10% chance of Sunny
                {
                    weather    = WEATHER.SUNNY;
                    cloudCover = CLOUDCOVER.LIGHT;
                }
            }

            else if (weather == WEATHER.RAINY)
            {
                if (chance < 30)     //30% chance of Cloudy
                {
                    cloudCover = CLOUDCOVER.HEAVY;
                }
                //Otherwise REMAINS Rainy
            }
            break;

        case "WINTER":
            if (weather == WEATHER.SUNNY)
            {
                if (chance < 80)     //80% chance of Cloudy
                {
                    weather    = WEATHER.CLOUDY;
                    cloudCover = CLOUDCOVER.HEAVY;
                }
                else if (chance < 90)     //10% chance of IMMEDIATE Snowy
                {
                    weather    = WEATHER.SNOWY;
                    cloudCover = CLOUDCOVER.OVERCAST;
                    spawnCloud(); spawnCloud();
                }
                //Otherwise REMAINS Sunny
            }

            else if (weather == WEATHER.CLOUDY)
            {
                if (chance < 90)     //90% chance of Snowy
                {
                    weather    = WEATHER.SNOWY;
                    cloudCover = CLOUDCOVER.OVERCAST;
                }
                else if (chance < 95)     //5% chance of Sunny
                {
                    weather    = WEATHER.SUNNY;
                    cloudCover = CLOUDCOVER.PARTIAL;
                }
                //Otherwise REMAINS Cloudy
            }

            else if (weather == WEATHER.SNOWY)
            {
                if (chance < 30)     //30% chance of Cloudy
                {
                    weather    = WEATHER.CLOUDY;
                    cloudCover = CLOUDCOVER.HEAVY;
                }
                else if (chance < 35)     //5% chance of IMMEDIATE Sunny
                {
                    weather    = WEATHER.SUNNY;
                    cloudCover = CLOUDCOVER.PARTIAL;
                }
                //Otherwise REMAINS Snowy
            }

            else if (weather == WEATHER.RAINY)
            {
                weather    = WEATHER.SNOWY;
                cloudCover = CLOUDCOVER.OVERCAST;
            }

            break;
        }

        changeWeather();
    }
Exemple #2
0
    public void secondLoad(string season)
    {
        switch (season)
        {
        case "SPRING":
            if (weather == WEATHER.SUNNY)
            {
                cloudCover = CLOUDCOVER.LIGHT;
            }
            else if (weather == WEATHER.CLOUDY)
            {
                cloudCover = CLOUDCOVER.HEAVY;
            }
            else if (weather == WEATHER.RAINY)
            {
                cloudCover = CLOUDCOVER.OVERCAST;
            }
            else if (weather == WEATHER.SNOWY)     //IMMEDIATELY Sunny if still Snowy at the end of Winter
            {
                weather    = WEATHER.SUNNY;
                cloudCover = CLOUDCOVER.LIGHT;
            }
            break;

        case "SUMMER":
            if (weather == WEATHER.SUNNY)
            {
                cloudCover = CLOUDCOVER.NONE;
            }
            else if (weather == WEATHER.CLOUDY)
            {
                cloudCover = CLOUDCOVER.HEAVY;
            }
            else if (weather == WEATHER.RAINY)     //Always return to Cloudy
            {
                weather    = WEATHER.CLOUDY;
                cloudCover = CLOUDCOVER.HEAVY;
            }
            break;

        case "AUTUMN":
            if (weather == WEATHER.SUNNY)
            {
                cloudCover = CLOUDCOVER.PARTIAL;
            }
            else if (weather == WEATHER.CLOUDY)
            {
                cloudCover = CLOUDCOVER.HEAVY;
            }
            else if (weather == WEATHER.RAINY)
            {
                cloudCover = CLOUDCOVER.OVERCAST;
            }
            break;

        case "WINTER":
            if (weather == WEATHER.SUNNY)
            {
                cloudCover = CLOUDCOVER.PARTIAL;
            }
            else if (weather == WEATHER.CLOUDY)
            {
                cloudCover = CLOUDCOVER.HEAVY;
            }
            else if (weather == WEATHER.SNOWY)
            {
                cloudCover = CLOUDCOVER.OVERCAST;
            }
            else if (weather == WEATHER.RAINY)
            {
                weather    = WEATHER.SNOWY;
                cloudCover = CLOUDCOVER.OVERCAST;
            }
            break;
        }
    }