void Awake() { m_trans = transform; //my Transform shot = EShotLength.LongShot; //Take a reference value. startTimerValue = transitionTimer; mySource = gameObject.GetComponent<AudioSource>(); minimap = GameObject.Find("Minimap"); if (minimap == null) { Debug.Log("Couldn't find object named 'Minimap'!"); } else { // Disable the minimap for the cinematic minimap.SetActive(false); } //Start the sound immediately? //mySource.Play(); //pitch = 1f; }
void Update() { //How long should the delay last Before the Trumpet Sounds delayTimer -= Time.deltaTime; if (delayTimer < 0) { if (delay) { mySource.Play(); pitch = 1.0f; } delay = false; } //Count down timer if (mySource.clip == null) { transitionTimer -= Time.deltaTime; } if (transitionTimer < 0) { //Go to the next state if (shot != EShotLength.CloseUp) { shot += 1; } //Reset the timer transitionTimer = startTimerValue; } // Rotate in local space //m_trans.Rotate(Vector3.up, twirlSpeed * Time.deltaTime, Space.Self); //NOOO!! Rotate in World space m_trans.Rotate(Vector3.up, twirlSpeed * Time.deltaTime, Space.World); if (shot == EShotLength.LongShot) { cinematicCam.transform.localPosition = new Vector3(0, 0, -(Mathf.Abs (longDistance))); twirlSpeed = Mathf.Abs(twirlSpeed); //positive direction //Next _ if the trumpet if (delay==false) { if (!mySource.isPlaying) { shot = EShotLength.MidShot; mySource.Play (); pitch = 1.15f; } } } else if (shot == EShotLength.MidShot) { cinematicCam.transform.localPosition = new Vector3(0, 0, -(Mathf.Abs(midDistance))); //twirlSpeed = -Mathf.Abs(twirlSpeed); //netative direction ?? Maybe a good effect twirlSpeed = Mathf.Abs(twirlSpeed); //positive direction //Next if (!mySource.isPlaying) { shot = EShotLength.CloseUp; mySource.Play (); pitch = 1.25f; } } else if (shot == EShotLength.CloseUp) { cinematicCam.transform.localPosition = new Vector3(0, 0, -(Mathf.Abs(closeDistance))); twirlSpeed = Mathf.Abs(twirlSpeed); //positive direction //Fade in text textAlpha = Mathf.Lerp(textAlpha, 1, Time.deltaTime * 0.3f); //Skip the scene Invoke("Skipping", 0.5f); } //Optional look target if (optionalLookTarget != null) { cinematicCam.transform.LookAt(optionalLookTarget.transform.position); } else if (optionalLookTarget == null) { cinematicCam.transform.LookAt(gameObject.transform.position); } //text - fade up if (startText != null) { Color myAlpha = startText.color; myAlpha.a = textAlpha; startText.color = myAlpha; } //set audio pitch mySource.pitch = pitch; // Skip ahead if (InputManager.GetAnyButtonDown ("Player1_") || InputManager.GetAnyButtonDown ("Player2_") || InputManager.GetAnyButtonDown ("Player3_") || InputManager.GetAnyButtonDown ("Player4_")) { if (shot == EShotLength.CloseUp) { if (!skip) { gameObject.SetActive(false); // Re-enable minimap minimap.SetActive(true); } } else if (shot != EShotLength.CloseUp) { if (!skip) { shot = EShotLength.CloseUp; skip = true; } } } }