Ejemplo n.º 1
0
    // Update is called once per frame

    public void FixedUpdate()
    {
        BasicTime++;
        Timer++;

        if (Timer > 1000 && exp == 0)    // 사망
        {
            transform.Find("die_msg").gameObject.SetActive(true);
            item_manager.tiger_die   = true;
            item_manager.tiger_level = 0;
            Destroy(transform.gameObject, 2.0f);
        }
        if (exp == valueMax)  //성장 완료
        {
            GameObject.Find("Canvas").transform.GetChild(0).gameObject.SetActive(true);
            GetCoin cc = GameObject.FindWithTag("expmax_panel").transform.GetChild(2).GetComponent <GetCoin>();
            cc.tagname = "tiger";
            item_manager.tiger_grow = true;
            //gameObject.SetActive(false);
            Destroy(transform.gameObject);
        }

        if (Timer % 40 == 0)
        {
            //시간에 따라 계속 속성 값 감소
            if (hungry - 1 < 0)
            {
                hungry = 0;
            }
            else
            {
                hungry--;
            }

            if (poop - 1 < 0)
            {
                poop = 0;
            }
            else
            {
                poop--;
            }

            if (play - 1 < 0)
            {
                play = 0;
            }
            else
            {
                play--;
            }

            //똥 안치우면 poop속성값 더 많이 감소
            if (poop - countPoop * 5 < 0)
            {
                poop = 0;
            }
            else
            {
                poop -= countPoop * 5;
            }

            //속성값 0인 항목이 있는 경우 경험치 감소
            if (hungry > 0 && poop > 0 && play > 0)
            {
                if (exp + 1 > valueMax)
                {
                    exp = valueMax;
                }
                else
                {
                    exp += 1;
                }
            }
            else
            if (exp - 30 < 0)
            {
                exp = 0;
            }
            else
            {
                exp -= 30;
            }
        }

        //공격 레벨 설정
        if (exp > exp_check && exp_check < valueMax)
        {
            item_manager.tiger_level++; //공격 레벨 증가
            exp_check += 100;           //임계점 상향
        }
    }
Ejemplo n.º 2
0
 public static void RemoveAll()
 {
     coin     = null;
     gameOver = null;
 }