コード例 #1
0
    private IEnumerator OnTickCoroutine()
    {
        if (player.IsAlive)
        {
            player.InputActive      = false;
            player.OnPlayerAdvance -= OnTick;

            //player.OnPlayerAddHazard += OnAddHazard;
            float delay = player.OnTickUpdate();
            gom.OnTickUpdate(GridObjectManager.GamePhase.Player);
            yield return(new WaitForSeconds(delay));

            if (CheckWinCondition())
            {
                currentLevel++;
                gom.NextLevel();
                gm.ReceiveLevelData(levelData.LevelTable[LevelDataIndex]);
                gm.NextLevel();   // Don't adjust index
                gom.ArrivePlayer();
                player.NextLevel(levelData.LevelTable[LevelDataIndex].jumpFuelAmount);
            }
            player.OnPlayerAddHazard -= OnAddHazard;
        }
        else
        {
            EndGame();
        }

        if (player.IsAlive)
        {
            float hazardDelay = gom.OnTickUpdate(GridObjectManager.GamePhase.Manager);
            yield return(new WaitForSeconds(hazardDelay));

            CurrentTick += 1;

            player.InputActive      = true;
            player.OnPlayerAdvance += OnTick;
        }
        else
        {
            EndGame();
        }

        // Debug Options
        if (VerboseConsole)
        {
            debugHUD.IncrementTickValue(CurrentTick);
        }
        yield return(null);
    }