Coroutines not working (?)
void LoadSplashScreen()
{
// Load the splash screen first
SceneManager.LoadScene("SplashScreen");
Debug.Log("load SplashScreen");
StartCoroutine(LoadTargetSceneWithDelay());
}
IEnumerator LoadTargetSceneWithDelay()
{
yield return new WaitForSeconds(3f);
Debug.Log("Delayed");
int index = CalculateSceneIndex();
Debug.Log("Calculate index" + index);
SceneManager.LoadScene(index);
Debug.Log("Loading index" + index);
}
public int CalculateSceneIndex()
{
float rot = transform.eulerAngles.z;
if (rot > 0 && rot <= 45) return 3;
else if (rot > 45 && rot <= 90) return 1;
else if (rot > 90 && rot <= 135) return 4;
else if (rot > 135 && rot <= 180) return 2;
else if (rot > 180 && rot <= 225) return 3;
else if (rot > 225 && rot <= 270) return Random.Range(2, 4);
else if (rot > 270 && rot <= 315) return 4;
else if (rot > 315 && rot <= 360) return 2;
else return 0;
}