Esempio n. 1
0
    //배경스크롤
    void Update()
    {
        if (!stopMoving)
        {
            for (int i = 0; i < layer.Count; i++)
            {
                layer[i].transform.Translate(Vector3.right * (userSpeed - layer_speed[i]) * Time.deltaTime);
            }
        }


        //야옹충돌 이벤트 이후
        if (user.GetComponent <User>().catCollision)
        {
            Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity);
            if (hit && hit.collider.gameObject.name.Equals("catArea"))
            {
                CatObject catObj = hit.collider.GetComponent <CatObject>();
                Utils.difficulty = catObj.difficulty;

                if (catObj.quizType == CatObject.QuizType.Initial)
                {
                    quizStart("Quiz_initial");
                }
                else if (catObj.quizType == CatObject.QuizType.Choice)
                {
                    quizStart("Quiz_choice");
                }
            }
        }
    }
    private void Start()
    {
        SoundManager.Instance.ChangeTheTrack(_song);
        SoundManager.Instance.PlayMusic();

        _p1Cat = _cats[PlayerPrefs.GetInt("P1Cat")];
        _p2Cat = _cats[PlayerPrefs.GetInt("P2Cat")];

        _p1EndWeight = PlayerPrefs.GetFloat("P1Weight");
        _p2EndWeight = PlayerPrefs.GetFloat("P2Weight");

        _p1GoalDiff = _p1Cat.idealWeight - _p1EndWeight;
        _p2GoalDiff = _p2Cat.idealWeight - _p2EndWeight;

        if (_p1GoalDiff == _p2GoalDiff)
        {
            _result = Result.Tie;
        }

        else if (_p1GoalDiff < _p2GoalDiff)
        {
            _result = Result.Player1;
        }

        else if (_p2GoalDiff < _p1GoalDiff)
        {
            _result = Result.Player2;
        }

        SetUI();
    }
Esempio n. 3
0
        public IActionResult CreateOne(string name, string breed, int age)
        {
            CatObject newCat = new CatObject(name, breed, age);

            catList.Add(newCat);
            ViewData["catList"] = catList;
            return(View("ViewAll"));
        }
Esempio n. 4
0
        public IActionResult ViewOne(string catName)
        {
            CatObject foundCat = catList.FirstOrDefault(cat => cat.name == catName);

            if (foundCat.name != null)
            {
                ViewData["name"]  = foundCat.name;
                ViewData["age"]   = foundCat.age;
                ViewData["breed"] = foundCat.breed;
                return(View());
            }
            else
            {
                return(View("PetNotFound"));
            }
        }