コード例 #1
0
    private void Update()
    {
        if (PetKeeper.pet.isDead)
        {
            anim.SetInteger("State", 4);
            transform.localRotation = Quaternion.Euler(0, 235, 0);
            transform.localPosition = new Vector3(5f, 5f, 0);

            transform.GetChild(0).gameObject.SetActive(true);
            transform.GetChild(1).gameObject.SetActive(false);

            petFactory.setDeadEyes();
            return;
        }

        if (PetKeeper.pet.isDungeoneering)
        {
            transform.GetChild(0).gameObject.SetActive(false);
            transform.GetChild(1).gameObject.SetActive(true);

            long finishedTimeStamp = PetKeeper.pet.dungeonStartTimestamp + (PetKeeper.pet.activeDungeon.time * TimeSpan.TicksPerSecond);

            TimeSpan diff = new TimeSpan(DateTime.Now.Ticks - finishedTimeStamp);
            timeLeft = diff.Duration();

            T_TimerLabel.gameObject.SetActive(true);

            if (DateTime.Now.Ticks > finishedTimeStamp)
            {
                timeLeft = TimeSpan.Zero;
            }

            setLabel();
            return;
        }

        transform.GetChild(0).gameObject.SetActive(true);
        transform.GetChild(1).gameObject.SetActive(false);

        transform.localRotation = Quaternion.Euler(0, 0, 0);
        transform.localPosition = new Vector3(0, 0.83f, 0);

        animTimer -= Time.deltaTime;
        if (animTimer <= 0 && PetKeeper.pet.happiness > 75)
        {
            anim.SetInteger("State", -1);
        }
        else if (animTimer <= 0 && PetKeeper.pet.happiness > 25)
        {
            anim.SetInteger("State", 0);
        }
        else if (animTimer <= 0 && PetKeeper.pet.happiness > 0)
        {
            anim.SetInteger("State", -2);
        }
    }