예제 #1
0
    public void work(Dojoachi buddy)
    {
        Random rand = new Random();

        buddy.meals  += rand.Next(1, 3);
        buddy.energy -= 5;
    }
예제 #2
0
 //Problem is in passing object of class Dojoachi type. Intent is to pass object as parameter and use
 //appropriate class methods to manipulate object. Ultimately the object attribute will be displayed in the
 //index method. ViewBag is currently being used to store object value.
 public IActionResult feed(Dojoachi buddy)
 {
     buddy.feed();
     ViewBag.Fullness = buddy.fullness();
     ViewBag.Meals    = buddy.meals();
     return(RedirectToAction("Index"));
 }
예제 #3
0
        public static void Main(string[] args)
        {
            Dojoachi buddy = new Dojoachi();

            var host = new WebHostBuilder()
                       .UseKestrel()
                       .UseContentRoot(Directory.GetCurrentDirectory())
                       .UseIISIntegration()
                       .UseStartup <Startup>()
                       .Build();

            host.Run();
        }
예제 #4
0
    public void play(Dojoachi buddy)
    {
        Random rand       = new Random();
        Random twentyFive = new Random();
        var    didntLike  = twentyFive.Next(1, 4);

        if (didntLike != 1)
        {
            buddy.happiness += rand.Next(5, 10);
            buddy.energy    -= 5;
        }
        buddy.energy -= 5;
    }
예제 #5
0
// Every time you play with or feed your dojodachi there should
// be a 25% chance that it won't like it. Energy or meals will still decrease,
// but happiness and fullness won't change.

    public void feed(Dojoachi buddy)
    {
        Random rand       = new Random();
        Random twentyFive = new Random();
        var    didntLike  = twentyFive.Next(1, 4);

        if (didntLike != 1)
        {
            buddy.fullness += rand.Next(5, 10);
            buddy.meals    -= 1;
        }
        buddy.meals -= 1;
    }
예제 #6
0
        public JsonResult Thing(string action)
        {
            Dojoachi danielAchiLOL = HttpContext.Session.GetObjectFromJson <Dojoachi>("achi");
            var      someObject    = new {
                achiFullness  = danielAchiLOL.fullness,
                achiHappiness = danielAchiLOL.happiness,
                achiMeals     = danielAchiLOL.meals,
                achiEnergy    = danielAchiLOL.energy,
                achiStatus    = ":D",
                loopStatus    = "Losing",
                ownerStatus   = "NOOB"
            };

            return(Json(someObject));
        }
예제 #7
0
        public IActionResult GoAchi(string activity)
        {
            switch (activity)
            {
            case "sleep":
                Dojoachi.Sleep();
                break;

            case "feed":
                Dojoachi.Feed();
                break;

            case "play":
                Dojoachi.Play();
                break;

            case "work":
                Dojoachi.Work();
                break;
            }
            return(RedirectToAction("Index"));
        }
예제 #8
0
 public void sleep(Dojoachi buddy)
 {
     buddy.energy    += 15;
     buddy.fullness  -= 5;
     buddy.happiness -= 5;
 }