Example #1
0
 public void CheckState()
 {
     // make sure the note is in front of the player
     zDistanceFromPlayer = transform.position.z - m_dancer.transform.position.z;
     zDistanceFromCamera = transform.position.z - m_zLimit;
     if(zDistanceFromPlayer > m_zDancerDistanceThreshold) {
         m_myState = NoteStates.UnReady;
         m_mat.enabled = false;
     } else if (zDistanceFromCamera > m_firstBounds) {
         m_myState = NoteStates.UnReady;
         m_mat.enabled = true;
         m_mat.material.SetColor("_Color", m_unReadyColor);
         m_mat.material.SetColor("_Emission", m_unReadyColor);
         m_mat.material.SetColor("_SpecColor", m_unReadyColor);
     } else if (zDistanceFromCamera <= m_firstBounds && zDistanceFromCamera > m_secondBounds) {
         m_mat.material.SetColor("_Color", m_lowScoreColor);
         m_mat.material.SetColor("_Emission", m_lowScoreColor);
         m_mat.material.SetColor("_SpecColor", m_lowScoreColor);
         m_myState = NoteStates.LowScore;
     } else if (zDistanceFromCamera <= m_secondBounds && zDistanceFromCamera > m_thirdBounds) {
         m_mat.material.SetColor("_Color", m_midScoreColor);
         m_mat.material.SetColor("_Emission", m_midScoreColor);
         m_mat.material.SetColor("_SpecColor", m_midScoreColor);
         m_myState = NoteStates.MidScore;
     } else if (zDistanceFromCamera > m_dieBounds && zDistanceFromCamera <= m_thirdBounds) {
         m_mat.material.SetColor("_Color", m_highScoreColor);
         m_mat.material.SetColor("_Emission", m_highScoreColor);
         m_mat.material.SetColor("_SpecColor", m_highScoreColor);
         m_myState = NoteStates.HighScore;
     } else {
         // if passes the camera this is a missed note
         gameObject.SetActive(false);
         DanceGameController.Instance.NoteWasMissed ();
     }
 }
Example #2
0
 public void CheckState()
 {
     zDistanceFromCamera = m_zLimit - transform.position.z;
     //if (isNormal)
     {
         if (zDistanceFromCamera > m_firstBounds) {
             m_myState = NoteStates.UnReady;
             m_mat.sharedMaterial.SetColor("_Color", m_unReadyColor);
             m_mat.sharedMaterial.SetColor("_Emission", m_unReadyColor);
             m_mat.sharedMaterial.SetColor("_SpecColor", m_unReadyColor);
         } else if (zDistanceFromCamera <= m_firstBounds && zDistanceFromCamera > m_secondBounds) {
             m_mat.sharedMaterial.SetColor("_Color", m_lowScoreColor);
             m_mat.sharedMaterial.SetColor("_Emission", m_lowScoreColor);
             m_mat.sharedMaterial.SetColor("_SpecColor", m_lowScoreColor);
             m_myState = NoteStates.LowScore;
         } else if (zDistanceFromCamera <= m_secondBounds && zDistanceFromCamera > m_thirdBounds) {
             m_mat.sharedMaterial.SetColor("_Color", m_midScoreColor);
             m_mat.sharedMaterial.SetColor("_Emission", m_midScoreColor);
             m_mat.sharedMaterial.SetColor("_SpecColor", m_midScoreColor);
             m_myState = NoteStates.MidScore;
         } else if (zDistanceFromCamera > m_thirdBounds && zDistanceFromCamera > m_dieBounds) {
             m_mat.sharedMaterial.SetColor("_Color", m_highScoreColor);
             m_mat.sharedMaterial.SetColor("_Emission", m_highScoreColor);
             m_mat.sharedMaterial.SetColor("_SpecColor", m_highScoreColor);
             m_myState = NoteStates.HighScore;
         } else {
             // if passes the camera this is a missed note
             gameObject.SetActive(false);
             DanceGameController.Instance.NoteWasMissed ();
         }
         m_myState = NoteStates.HighScore;
     }
 }
Example #3
0
        // KB
        void Start()
        {
            m_myState = NoteStates.UnReady;
            // Note must move from transform.position to camera position
            m_mainCamera = GameObject.FindGameObjectWithTag ("MainCamera");
            m_zLimit = m_mainCamera.transform.position.z;
            NotificationCenter.DefaultCenter.AddObserver(this,"OnStateRunFixedUpdate");
            NotificationCenter.DefaultCenter.AddObserver(this,"OnStateRunUpdate");
            NotificationCenter.DefaultCenter.AddObserver(this,"OnStateLostSongEnter");

            // The CharacterModel contains the tag "CharacterController"
            m_dancer = GameObject.FindGameObjectWithTag ("CharacterController");
            m_zDancerDistanceThreshold = -0.35f;

            // to provide some variety, flip half the notes
            if (Random.value > 0.5) {
                transform.localRotation = transform.localRotation * Quaternion.Euler(0, 180, 0);
                m_direction = Vector3.forward;
            } else {
                m_direction = Vector3.forward * -1.0f;
            }
            // Send notes off in slightly random directions but toward the camera
            //float x = Random.Range(-0.125f, 0.125f);
            //float y = Random.Range(-0.125f, 0.125f);
            float x = Random.Range(-0.25f, 0.25f);
            float y = Random.Range(-0.15f, 0.15f);
            m_direction = new Vector3(m_direction.x + x, m_direction.y + y, m_direction.z);
        }
Example #4
0
        void Start()
        {
            m_myState = NoteStates.UnReady;
            // Note must move from transform.position to camera position
            //m_mainCamera = GameObject.FindGameObjectWithTag ("MainCamera");
            m_mainCamera = GameObject.FindGameObjectWithTag ("GameController");
            m_zLimit = m_mainCamera.transform.position.z;
            NotificationCenter.DefaultCenter.AddObserver(this,"OnStateRunFixedUpdate");
            NotificationCenter.DefaultCenter.AddObserver(this,"OnStateRunUpdate");
            NotificationCenter.DefaultCenter.AddObserver(this,"OnStateLostSongEnter");

            // to provide some variety, flip half the notes
            if (Random.value > 0.5) {
                isNormal = false;
                transform.localRotation = transform.localRotation * Quaternion.Euler(0, 180, 0);
                m_direction = Vector3.forward;
                // Send notes off in slightly random directions but toward the camera
                float x = Random.Range(-0.125f, 0.125f);
                float y = Random.Range(-0.125f, 0.125f);
                m_direction = new Vector3(m_direction.x - 10*x, m_direction.y - 10*y, -30*m_direction.z);
            } else {
                isNormal = true;
                transform.localRotation = transform.localRotation * Quaternion.Euler(0, 0, 180);
                m_direction = new Vector3(1.0f,1.0f,1.0f);
                // Send notes off in slightly random directions but toward the camera
                float x = Random.Range(-0.125f, 0.125f);
                float y = Random.Range(-0.125f, 0.125f);
                m_direction = new Vector3(m_direction.x + 10*x, m_direction.y - 10*y , 30*m_direction.z);
            }
        }