Пример #1
0
    public IEnumerator StartGame(int gamemodeIndex)
    {
        gamemodeCurrent = gamemodes[gamemodeIndex];
        level           = 1;
        gamemodeCurrent.SetLevel(level);

        InitializeBoard();

        yield return(StartCoroutine(SpawnNewTiles(gamemodeCurrent.tileCountInitial, true)));

        InitializeTileCrunch();
        GetNewGoal();

        isStarted = true;
    }
Пример #2
0
    private IEnumerator SolutionSuccessful(int value, List <Tile> tilePath)
    {
        level++;
        text_LevelTop.text    = level.ToString();
        text_LevelBottom.text = level.ToString();
        gamemodeCurrent.SetLevel(level);

        // End Timer Tick Coroutine
        timerCurrent = timerMax;
        if (timerTickCoroutine != null)
        {
            StopCoroutine(timerTickCoroutine);
        }

        // Lock board
        isLocked = true;
        text_GoalTop.gameObject.SetActive(false);
        text_GoalBottom.gameObject.SetActive(false);

        // Add Screenshake
        cameraController.AddScreenshake(tilePath[tilePath.Count - 2].tileConnections.Single(tc => tc.tile == tilePath[tilePath.Count - 1]).direction * 10, GetTilePathSpin(tilePath));
        DestroyTiles(tilePath);

        // Spawn goalSuccessText
        GoalSuccessText goalSuccessText = Instantiate(prefab_goalSuccessText, text_GoalTop.transform.position, Quaternion.identity).GetComponent <GoalSuccessText>();

        goalSuccessText.SetText(text_GoalTop.text);

        // Create TileCrunch
        CreateTileCrunch(tilePath, ShowMath(tilePath));

        yield return(new WaitForSeconds(0.5f));

        yield return(StartCoroutine(SpawnNewTiles(tilePath.Count, false)));

        // Unlock board
        isLocked = false;
        text_GoalTop.gameObject.SetActive(true);
        text_GoalBottom.gameObject.SetActive(true);
        GetNewGoal();
    }