Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Check())
        {
            Debug.Log("dead" + m_nowStay);
            m_deadTime += Time.deltaTime;
            anim.SetBool("Die", true);
            if (m_deadTime > 5)
            {
                Player_life = 0;
            }

            if (Player_life == 0)
            {
                DeadRoot();
                Application.LoadLevel("Result");
            }
            return;
        }

        if (m_nowStay != "null")
        {
            m_stayTime += Time.deltaTime;
            anim.SetBool("Wait", true);

            if (m_disaster.mIsEnd() || Input.GetKeyDown(KeyCode.Escape))
            {
                anim.SetBool("Wait", false);
                m_nowStay  = "null";
                m_stayTime = 0.0f;
            }
            return;
        }

        Move(tempo);

        if (Input.GetKey("left"))
        {
            anim.SetBool("Walk", true);
        }
        else if (Input.GetKey("right"))
        {
            anim.SetBool("Walk", true);
        }
        else if (Input.GetKey("up"))
        {
            anim.SetBool("Walk", true);
        }
        else if (Input.GetKey("down"))
        {
            anim.SetBool("Walk", true);
        }
        else
        {
            anim.SetBool("Walk", false);
        }
    }
Ejemplo n.º 2
0
    void mRun()
    {
        if (m_state != eState.eRun)
        {
            return;
        }
        if (!m_isSet && m_disaster.mIsEnd())
        {
            m_disasterTimeCount += Time.deltaTime;
        }

        //
        if (!m_isDisasterStart && !m_isSet && m_disasterTimeCount > m_disasterTime && m_disaster.mIsEnd())
        {
            m_time = m_telopTime.mGetRandam();

            int randam = UnityEngine.Random.Range(0, 4);

            m_nextType = mGetDisaster(randam);

            m_telop.mSetProperty(mGetDisaterTypeToString(m_nextType), m_time.ToString());
            m_telop.mAccident();
            m_isDisasterStart = true;
        }

        //
        if (m_telop.IsEnd && m_isDisasterStart)
        {
            m_timeCount += Time.deltaTime;
        }

        //
        if (!m_isSet && m_timeCount > (m_time / 2))
        {
            m_disaster.mNextSet(m_nextType, m_disasterTimeHash[m_nextType]);
            m_isSet = true;
        }

        //
        if (m_isDisasterStart && m_timeCount > m_time)
        {
            m_disaster.mNextStart();
            m_timeCount         = 0;
            m_isDisasterStart   = false;
            m_isSet             = false;
            m_disasterTimeCount = 0.0f;
            m_disasterTime      = UnityEngine.Random.Range(StartRangeMin, StartRangeMax);
        }
    }