コード例 #1
0
 public void ResetSprites()
 {
     m_timeSprite.ResetPeices();
     m_progressSprite.ResetPeices();
     // Resets the ui to be how it should be on activate.
     foreach (GameObject sptire in m_timeSprite.m_orderedSpriteList)
     {
         m_timeSprite.Increment();
     }
     foreach (GameObject sprite in m_progressSprite.m_orderedSpriteList)
     {
         m_progressSprite.Deactivate();
     }
 }
コード例 #2
0
    void LateUpdate()
    {
        this.transform.LookAt(Camera.main.transform); // Currently shows back of sprite rather then front
        this.transform.Rotate(0, 180, 0);             // Look at seems to look exactley away. Could be a problem with the prefab.
        //if (Input.GetKeyDown(KeyCode.A))
        //{
        //    m_timeSprite.Decrement();
        //}
        //if (Input.GetKeyDown(KeyCode.D))
        //{
        //    m_timeSprite.Increment();
        //}

        float number  = (Timer.TimeGet() - m_problemToSpawnOver.GetTime()) / (m_startTime - m_problemToSpawnOver.GetTime());
        float number2 = ((float)m_timeSprite.GetActiveSprites() / (float)m_timeSprite.m_orderedSpriteList.Count); // I've done this due to having some issues with data loss. It can be done in the line below but.

        if (m_timeSprite.GetActiveSprites() != 0)
        {
            if (number2 > number) // I was having a loss of data issue. They all need to be floats otherwise loss of data
            {
                m_timeSprite.Decrement();
            }
        }
        if (m_progressSprite.GetActiveSprites() != 0) // So you don't divide by 0;
        {
            number  = (float)m_problemToSpawnOver.GetButtonPressCount() / (float)m_problemToSpawnOver.GetButtonPressesMax();
            number2 = (float)m_progressSprite.GetActiveSprites() / (float)m_progressSprite.m_orderedSpriteList.Count;
            if (number > number2)
            {
                m_progressSprite.Increment();
            }
        }
        else if (m_problemToSpawnOver.GetButtonPressCount() != 0) // Since start is 0 need a special case.
        {
            m_progressSprite.Increment();
        }
    }