private void LandingScreenFadeIn() { Debug.Log("LandingScreenFadeIn"); _landingScreenAudio.volume += _landingScreenFadeSpeed * Time.deltaTime; // Increase volume by fade speed _landingScreenFadeValue += _landingScreenFadeSpeed * Time.deltaTime; // Increase fade value by the fade speed // To make sure we get the precise value of 1 if (_landingScreenFadeValue > 1) // If fade value is greater than 1 { _landingScreenFadeValue = 1; // Then set fade value to one } if (_landingScreenFadeValue == 1) // If fade value equals one { _landingScreenController = LandingScreen.LandingScreenController.LandingScreenFadeOut; // Set splash screen controller to equal landing screen fade out } }
// Start is called before the first frame update void Start() { // Only usable with a gamepad Cursor.visible = false; // Set cursor visible state to false Cursor.lockState = CursorLockMode.Locked; // Lock the cursor // Landing Screen Music _landingScreenAudio = GetComponent <AudioSource>(); // Landing Screen audio equals the audio source _landingScreenAudio.volume = 0; // Audio volume equals zero on startup _landingScreenAudio.clip = _landingScreenMusic; // Audio clip equals the splash screen music _landingScreenAudio.loop = true; // Set audio to loop _landingScreenAudio.Play(); // Play audio _landingScreenController = LandingScreen.LandingScreenController.LandingScreenFadeIn; // Fade in on startup StartCoroutine("LandingScreenManager"); // Start LandingScreenManager function }