public ActionResult Sleep()
        {
            Tama.CycleSleepTamas();
            List <Tama> allTamas = Tama.GetAll();

            return(View("Game", allTamas));
        }
        public ActionResult Remove(int id)
        {
            Tama.RemoveByIdAndReassignIds(id);
            List <Tama> allTamas = Tama.GetAll();

            return(View("Game", allTamas));
        }
        public ActionResult Wait()
        {
            Tama.CycleWaitTamas();
            List <Tama> allTamas = Tama.GetAll();

            return(View("Game", allTamas));
        }
        public ActionResult CreateSleep(int id)
        {
            Tama tamagotchi = Tama.Find(id);

            tamagotchi.MakeSleep();
            return(View("Details", tamagotchi));
        }
        public ActionResult Create()
        {
            Tama        newTama = new Tama(Request.Form["name"]);
            List <Tama> allTama = Tama.GetAll();

            return(View("Index", allTama));
        }
        public ActionResult CreateAttention(int id)
        {
            Tama tamagotchi = Tama.Find(id);

            tamagotchi.Play();
            return(View("Details", tamagotchi));
        }
        public ActionResult Create()
        {
            Tama newTama = new Tama(Request.Form["tamaName"]);

            newTama.Save();
            return(View(newTama));
        }
Beispiel #8
0
        public ActionResult Delete()
        {
            Tama.ClearAll();
            List <Tama> allTama = Tama.GetAll();

            return(View("Index", allTama));
        }
Beispiel #9
0
        public ActionResult AddTime()
        {
            Tama.Time();
            Tama.CheckForDead();
            List <Tama> allTama = Tama.GetAll();

            return(View("Index", allTama));
        }
Beispiel #10
0
        public ActionResult CreateAttention(int id)
        {
            Tama        tamagotchi = Tama.Find(id);
            List <Tama> allTama    = Tama.GetAll();

            tamagotchi.Play();
            Tama.CheckForDead();
            return(tamagotchi.IsDead() ? RedirectToAction("Index", allTama) : RedirectToAction("Details", tamagotchi));
        }
Beispiel #11
0
        public ActionResult Details(int categoryId, int id)
        {
            Tama item = Tama.Find(id);
            Dictionary <string, object> model = new Dictionary <string, object>();
            Category category = Category.Find(categoryId);

            model.Add("item", item);
            model.Add("category", category);
            return(View(item));
        }
Beispiel #12
0
        public IActionResult PostPlay(int id)
        {
            Tama tama = Tama.Find(id);

            tama.SetFun(tama.GetFun() + 20);
            if (tama.GetHunger() > 80)
            {
                // TAMA DIES
            }
            else
            {
                tama.SetHunger(tama.GetHunger() - 20);
            }
            return(View("Play", tama));
        }
Beispiel #13
0
        public IActionResult PostSleep(int id)
        {
            Tama tama = Tama.Find(id);

            tama.SetRest(tama.GetRest() + 20);
            if (tama.GetFun() < 20)
            {
                // TAMA DIES
            }
            else
            {
                tama.SetFun(tama.GetFun() - 20);
            }
            return(View("Sleep", tama));
        }
Beispiel #14
0
        public IActionResult PostFood(int id)
        {
            var tempTama = Request.Form["tamaId"];

            WriteLine(tempTama);
            Tama tama = Tama.Find(id);

            tama.SetHunger(tama.GetHunger() - 20);
            if (tama.GetRest() < 20)
            {
                // TAMA DIES
            }
            else
            {
                tama.SetRest(tama.GetRest() - 20);
            }
            return(View("Food", tama));
        }
Beispiel #15
0
    static void Main(string[] args)
    {
        Console.WriteLine(" _                                    _       _     _");
        Console.WriteLine("| |                                  | |     | |   (_)");
        Console.WriteLine("| |_ __ _ _ __ ___   __ _  __ _  ___ | |_ ___| |__  _ ");
        Console.WriteLine("| __/ _` | '_ ` _'\\/ _` |/ _` |/ _ \\| __/ __| '_ \\| |");
        Console.WriteLine("| || (_| | | | | | | (_| | (_| | (_) | || (__| | | | |");
        Console.WriteLine(" \\__\\__,_|_| |_| |_|\\__,_\\__, |\\___/ \\__\\___|_| |_|_|");
        Console.WriteLine("                           __/ |  ");
        Console.WriteLine("                          |___/");

        Tama tama      = new Tama(10, 10, new SadLifeStrategy());
        int  choixMenu = 1;
        var  rand      = new Random();
        int  randNumber;

        do
        {
            randNumber = rand.Next(101);
            tama.SetLifeStrategy(randNumber);
            Console.WriteLine(tama.ToString());
            Console.WriteLine("===== MENU =====");
            Console.WriteLine("1 - Jouer");
            Console.WriteLine("2 - Lui donner à manger");
            Console.WriteLine("3 - Revenir plus tard");
            choixMenu = Convert.ToInt16(Console.ReadLine());

            switch (choixMenu)
            {
            case 1:
                tama.play();
                break;

            case 2:
                tama.eat();
                break;
            }
        } while(choixMenu != 3);
    }
Beispiel #16
0
    void ShootWithMouse()
    {
        if (endOfAiming && Time.time - lastShotTime > TAMA_RATE)
        {
            Vector3 mousePosition3d   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            Vector3 shootingDirection = new Vector3(mousePosition3d.x - transform.position.x, 0.0f, mousePosition3d.z - transform.position.z);
            shootingDirection.Normalize();

            GameObject tama = Instantiate(tamaPrefab, transform.position, Quaternion.Euler(90, 0, Mathf.Atan2(shootingDirection.z, shootingDirection.x) * Mathf.Rad2Deg));
            //tama.GetComponent<Rigidbody>().velocity = shootingDirection * TAMA_BASE_SPEED;
            Tama tamaScript = tama.GetComponent <Tama>();
            tamaScript.player   = gameObject;
            tamaScript.velocity = shootingDirection * TAMA_BASE_SPEED;
            lastShotTime        = Time.time;
            Destroy(tama, 3.0f);

            audioSource.PlayOneShot(attacking, attackingVolume);

            hp -= TAMA_COST;
            StateSetup();
        }
    }
Beispiel #17
0
    public void ShootWithGamepad(float x, float y)
    {
        if (Time.time - lastShotTime > TAMA_RATE)
        {
            Vector3 shootingDirection = new Vector3(x, 0.0f, y);
            shootingDirection.Normalize();

            GameObject tama = Instantiate(tamaPrefab, transform.position, Quaternion.Euler(90, 0, Mathf.Atan2(shootingDirection.z, shootingDirection.x) * Mathf.Rad2Deg));

            Tama tamaScript = tama.GetComponent <Tama>();
            tamaScript.player   = gameObject;
            tamaScript.velocity = shootingDirection * TAMA_BASE_SPEED;
            lastShotTime        = Time.time;
            Destroy(tama, 3.0f);

            audioSource.PlayOneShot(attacking, attackingVolume);

            ds4.Vibrate(0, 1, 0.1f);
            ds4.Vibrate(1, 1, 0.1f);

            hp -= TAMA_COST;
            StateSetup();
        }
    }
Beispiel #18
0
        public IActionResult Status()
        {
            Tama tama = new Tama(Request.Form["tama-name"], 50);

            return(View("Status", tama));
        }
Beispiel #19
0
        public IActionResult Home()
        {
            List <Tama> tamaList = Tama.GetAll();

            return(View("Home", tamaList));
        }
Beispiel #20
0
        public ActionResult Details(int id)
        {
            Tama tamagotchi = Tama.Find(id);

            return(View(tamagotchi));
        }
Beispiel #21
0
        public ActionResult Index()
        {
            List <Tama> allTama = Tama.GetAll();

            return(View(allTama));
        }
Beispiel #22
0
        public IActionResult PostStatus(int id)
        {
            Tama tama = Tama.Find(id);

            return(View("Status", tama));
        }
Beispiel #23
0
        public IActionResult Death(int id)
        {
            Tama tama = Tama.Find(id);

            return(View("Death", tama));
        }
Beispiel #24
0
        public IActionResult Food(int id)
        {
            Tama tama = Tama.Find(id);

            return(View("Food", tama));
        }
Beispiel #25
0
 /// <summary>
 /// 弾を発射
 /// settamapos:弾の初期位置
 /// settamaspeed:弾の初速度
 /// tamanum:弾の見ため
 /// tamaugoki:弾の軌道番号
 /// </summary>
 /// <param name="settamapos"></param>
 /// <param name="settamaspeed"></param>
 /// <param name="tamanum"></param>
 /// <param name="tamaList"></param>
 /// <param name="tamaTextureList"></param>
 /// <param name="tamaugoki"></param>
 public void makeTama(Vector2 settamapos, Vector2 settamaspeed, int tamatexturei, List<Tama> tamaList, List<Texture2D> tamaTextureList, int tamaugoki, int tamaZokusei, Color color)
 {
     Tama tm = new Tama(settamapos, tamaTextureList[tamatexturei], color, new Vector2(tamaTextureList[tamatexturei].Width, tamaTextureList[tamatexturei].Height), 1, settamaspeed, tamaugoki, tamaZokusei);
     TamaList.Add(tm);
 }
 public ActionResult Clear()
 {
     Tama.ClearAll();
     return(View("Index"));
 }
Beispiel #27
0
        public IActionResult Play(int id)
        {
            Tama tama = Tama.Find(id);

            return(View("Play", tama));
        }
        public ActionResult Game()
        {
            List <Tama> allTamas = Tama.GetAll();

            return(View(allTamas));
        }
Beispiel #29
0
        public IActionResult Sleep(int id)
        {
            Tama tama = Tama.Find(id);

            return(View("Sleep", tama));
        }