예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            WEATHER wEATHER = db.WEATHERs.Find(id);

            db.WEATHERs.Remove(wEATHER);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "WeatherId,PlacePlaceId,Jan,Feb,Mar,Apr,May,June,July,Aug,Sep,Oct,Nov,Dcm,WeatherDesc,WeatherAvg")] WEATHER wEATHER)
 {
     if (ModelState.IsValid)
     {
         db.Entry(wEATHER).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PlacePlaceId = new SelectList(db.PLACEs, "PlaceId", "PlaceName", wEATHER.PlacePlaceId);
     return(View(wEATHER));
 }
예제 #3
0
        // GET: WEATHERs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WEATHER wEATHER = db.WEATHERs.Find(id);

            if (wEATHER == null)
            {
                return(HttpNotFound());
            }
            return(View(wEATHER));
        }
예제 #4
0
        // GET: WEATHERs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WEATHER wEATHER = db.WEATHERs.Find(id);

            if (wEATHER == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PlacePlaceId = new SelectList(db.PLACEs, "PlaceId", "PlaceName", wEATHER.PlacePlaceId);
            return(View(wEATHER));
        }
예제 #5
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();
    }
예제 #6
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;
        }
    }
예제 #7
0
    //LOAD
    public void loadWeather(string w)
    {
        switch (w)
        {
        case "SUNNY": background.sprite = none; filter.color = new Color(0, 0, 0, 0); weather = WEATHER.SUNNY; break;

        case "CLOUDY": background.sprite = none; filter.color = new Color(0, 0, 0, .2f); weather = WEATHER.CLOUDY; break;

        case "RAINY": background.sprite = rain1; filter.color = new Color(0, 0, 0, .3f); weather = WEATHER.RAINY; break;

        case "SNOWY": background.sprite = rain2; filter.color = new Color(0, 0, 0, .3f); weather = WEATHER.SNOWY; break;
        }
    }