예제 #1
0
    public void FindRabbit()
    {
        Vector2 startPos = new Vector2(4, 0);

        m_CurrentRabbit = GameObject.FindGameObjectWithTag("Rabbit");
        m_CurrentRabbit.transform.localPosition = startPos;
        m_RabbitScript = m_CurrentRabbit.GetComponentInChildren <RabbitScript>();
    }
예제 #2
0
    void Update()
    {
        //TODO To also check if the music is playing too?
        if (m_Rabbit == null && !m_IsGameOver && m_MusicManager.AudioPlaying())
        {
            m_Rabbit       = GameObject.FindGameObjectWithTag("Rabbit");
            m_RabbitScript = m_Rabbit.GetComponent <RabbitScript>();
        }
        m_MusicTime = m_MusicManager.GetCurrentMusicTime();

        CheckNumberPoors();
        //TODO: Code here is to play game with keyboard space bar input only, like debug mode
        if (Input.GetKeyDown(KeyCode.Space))
        {
            //for debug purposes, when we hit space, disable the miss detected code
            CheckMusicAgainstTiming();

            /*
             * //print(dictionary.Key);
             * //between certain range = excellent
             * if (CheckMusicAgainstTiming() > m_MusicTime - EXCELLENT_MIN_MAX && CheckMusicAgainstTiming() < m_MusicTime + EXCELLENT_MIN_MAX)
             * {
             *      print(CheckMusicAgainstTiming() + " MusicMarker");
             *      print(m_MusicTime + "Exc");
             *      //For each excellent, increase combo by 1
             *      m_Combo++;
             *      //Increase m_NumExcellents by 1
             *      m_NumExcellents++;
             *      //Instantiate text alert
             *      m_TextResult = m_Excellent.gameObject;
             *      InstantiateTextGameObject();
             *      return;
             * }
             * //between certain range = good
             * else if (CheckMusicAgainstTiming() > (m_MusicTime + EXCELLENT_MIN_MAX) && CheckMusicAgainstTiming() < (m_MusicTime + GOOD_MIN_MAX) ||
             *      CheckMusicAgainstTiming() < (m_MusicTime - EXCELLENT_MIN_MAX) && CheckMusicAgainstTiming() > (m_MusicTime - GOOD_MIN_MAX))
             * {
             *      print(CheckMusicAgainstTiming() + " MusicMarker");
             *      print(m_MusicTime + "Goo");
             *      //Reset combo to 0
             *      m_Combo = 0;
             *      //Increase m_NumGoods by 1
             *      m_NumGoods++;
             *      //Instantiate text alert
             *      m_TextResult = m_Good.gameObject;
             *      InstantiateTextGameObject();
             *      return;
             * }
             * //Otherwise
             * {
             *      print(CheckMusicAgainstTiming() + " MusicMarker");
             *      print(m_MusicTime + "poo");
             *      //TODO - Poor is being called regardless of touch...
             *      //lol, foreach goes through ALL arrays
             *      //Reset combo to 0
             *      m_Combo = 0;
             *      //Increase m_NumPoors by 1
             *      m_NumPoors++;
             *      //Instantiate text alert
             *      m_TextResult = m_Poor.gameObject;
             *      InstantiateTextGameObject();
             * }
             */
        }

        //TODO: code here is for touch input to play with mobile
        //Comment out for time being.

        /*
         * if (Input.touchCount > 0)
         * {
         *      //create an instance of the touch input, first touch
         *      Touch myTouch = Input.GetTouch(0);
         *
         *      switch(myTouch.phase)
         *      {
         *              case TouchPhase.Began:
         *                      if (!m_IsPressed)
         *                      {
         *                              //TODO It doesn't matter when the player touches the screen to tap to the music.
         *                              //If the player taps within a certain distance of ANY of the times in the array, indicate the result
         *                              //We are doing this instead of individual arrays because if you miss one, the code automatically
         *                              //sets the next timed array as the one you need to hit, which can become inaccurate.
         *                              //Probably need to use a foreach loop
         *                              //The current arrayValue, give or take 0.15f seconds away from that is excellent
         *                              //Give or take more than 0.15f - 0.4f second from that is good
         *                              //more than 0.4f second from that is poor
         *                              //DICTIONARY? instead?
         *                              //if any of the arrays contains a value that is close to our touch time, call something.
         *
         *                              //print(dictionary.Key);
         *                              //between certain range = excellent
         *                              if (m_MusicMarker > m_MusicTime - EXCELLENT_MIN_MAX && m_MusicMarker < m_MusicTime + EXCELLENT_MIN_MAX)
         *                              {
         *                                      print(m_MusicMarker + " MusicMarker");
         *                                      print(m_MusicTime + "Exc");
         *                                      //For each excellent, increase combo by 1
         *                                      m_Combo++;
         *                                      //Increase m_NumExcellents by 1
         *                                      m_NumExcellents++;
         *                                      //Instantiate text alert
         *                                      m_TextResult = m_Excellent.gameObject;
         *                                      InstantiateTextGameObject();
         *                                      return;
         *                              }
         *                              //between certain range = good
         *                              else if (m_MusicMarker > (m_MusicTime + EXCELLENT_MIN_MAX) && m_MusicMarker < (m_MusicTime + GOOD_MIN_MAX) ||
         *                                      m_MusicMarker < (m_MusicTime - EXCELLENT_MIN_MAX) && m_MusicMarker > (m_MusicTime - GOOD_MIN_MAX))
         *                              {
         *                                      print(m_MusicMarker + " MusicMarker");
         *                                      print(m_MusicTime + "Goo");
         *                                      //Reset combo to 0
         *                                      m_Combo = 0;
         *                                      //Increase m_NumGoods by 1
         *                                      m_NumGoods++;
         *                                      //Instantiate text alert
         *                                      m_TextResult = m_Good.gameObject;
         *                                      InstantiateTextGameObject();
         *                                      return;
         *                              }
         *                              //Otherwise
         *                              {
         *                                      print(m_MusicMarker + " MusicMarker");
         *                                      print(m_MusicTime + "poo");
         *                                      //TODO - Poor is being called regardless of touch...
         *                                      //lol, foreach goes through ALL arrays
         *                                      //Reset combo to 0
         *                                      m_Combo = 0;
         *                                      //Increase m_NumPoors by 1
         *                                      m_NumPoors++;
         *                                      //Instantiate text alert
         *                                      m_TextResult = m_Poor.gameObject;
         *                                      InstantiateTextGameObject();
         *                              }
         *                              m_IsPressed = true;
         *                      }
         *                      break;
         *              case TouchPhase.Ended:
         *              case TouchPhase.Canceled:
         *                      m_IsPressed = false;
         *                      break;
         *      } */
    }