Question by 
               ninjixfatality · Apr 06, 2018 at 07:02 AM · 
                unity 5ienumeratorminutes  
              
 
              Translating Ienumerator from seconds into minutes?
Hello everyone im fairly new to C# and unsure how to translate this into my script. I have a bird script that hovers over the player. I have everything set in float seconds but I want that my FadeIn() function and Ienumerator GameReset() use 1minute instead. This will help because I want players to have some time to shoot down the bird without having the issue of the game automatically resetting in a matter of seconds.The point of my game is that if players take too long the bird will attack them causing a reset window to appear
 public float waitTime = 10.0f;
 public float fadeTime = 3.0f;
 public float betweenFadesTime = 2.0f;
 // Flag to determine whether or not the player may respond.
 public bool canRespond = false;
 // Flag to determine if the player has responded within the wait time.
 public bool hasResponded = false;
 public GameObject enemy;
 void Start()
 { StartCoroutine(EnemyFadeIn(fadeTime, betweenFadesTime, waitTime)); }
 void Update() {
     if ((Input.GetKeyDown(KeyCode.S)) && (canRespond))
     { hasResponded = true; }
 }
 IEnumerator EnemyFadeIn(float timeToFade, float timeBetweenFades, float timeToWait) {
     Debug.Log("An Enemy Is Fading In");
     // Simulating Fade In Time.
     yield return new WaitForSeconds(timeToFade);
     // Fade in
      iTween.FadeTo(enemy, 1, 1);
      Invoke("SetMaterialOpaque", 1f);
     Debug.Log("An Enemy Has Appeared");
     yield return ListenForInput(timeToFade, timeBetweenFades, timeToWait);
 }
 IEnumerator EnemyFadeOut(float timeToFade, float timeBetweenFades, float timeToWait) {
     Debug.Log("An Enemy Is Fading Away");
     // Simulating Fade Out Time.
     yield return new WaitForSeconds(timeToFade);
     // Fade out
      SetMaterialTransparent();
      iTween.FadeTo(enemy, 0, 1);
     Debug.Log("An Enemy Has Departed");
     // Simulating Time Between Fades.
     yield return new WaitForSeconds(timeBetweenFades);
     yield return EnemyFadeIn(timeToFade, timeBetweenFades, timeToWait);
 }
 // Responsible for reacting to the 'S' key input.
 IEnumerator ListenForInput(float timeToFade, float timeBetweenFades, float timeToWait) {
     canRespond = true;
     Debug.Log("Press the 'S' Key to Destroy the Enemy!");
     float startTime = Time.time;
     // Check every 0.25 seconds to see if the S key was pressed.
     while (Time.time < (startTime + timeToWait)) {
         if (hasResponded) {
             Debug.Log("The 'S' Key was Pressed!");
             hasResponded = false;
             canRespond = false;
             yield return EnemyFadeOut(timeToFade, timeBetweenFades, timeToWait);
         }
         yield return new WaitForSeconds(0.25f);
     }
     Debug.Log("The 'S' Key was not Pressed!");
     canRespond = false;
     yield return ResetGame();
 }
 IEnumerator ResetGame() {
     Debug.Log("Game is Performing a Reset");
     Simulating Game Reset Time.
     yield return new WaitForSeconds(30);
     Debug.Log("Game has Restarted. End of Coroutine!");
 }
 
               }
               Comment
              
 
               
              Your answer