void Update()
{
if (Application.isLoadingLevel == false && loading)
{
loading = false;
LoadContent();
}
if (start)
{
if (_state == GameState.InGame)
{
//After countdown..
_gameMode.Update();
}
start = false;
}
if (_state == GameState.InGame)
{
//After countdown..
if (!_gameMode.GameEnd())
{
int displayMinutes = (int)(GameManager._gameMode.GetTimer() / 60.0f);
int displaySeconds = (int)(GameManager._gameMode.GetTimer() % 60.0f);
_timerUI.GetComponentInChildren <Text>().text = string.Format("{0}:{1:00}", displayMinutes, displaySeconds);
_gameMode.Update();
}
else
{
GameObject _obj = (GameObject)Instantiate(FindObjectOfType <MenuManager>().WinBanner, Vector3.zero, Quaternion.identity);
if (_gameMode.winnerActor != null)
{
_obj.GetComponentInChildren <Text>().text = _gameMode.winnerActor.actorName + " wins!";
}
else
{
_obj.GetComponentInChildren <Text>().text = "Tie!";
}
_state = GameState.Win;
}
}
if (_state == GameState.Win)
{
if (GamepadInput.GamePad.GetButtonDown(GamepadInput.GamePad.Button.Start, GamepadInput.GamePad.Index.Any))
{
OnMenuScene();
Application.LoadLevel(0);
}
}
}