Exemplo n.º 1
0
    private void OnGenerateLevelRequested(GenerateLevelRequestEvent obj)
    {
        CheckError();
        if (currentLevel != null)
        {
            Destroy(currentLevel);
        }

        if (obj.retry)
        {
            if (progress >= levels.Length)
            {
                OnRandomGenerateLevelRequested(new RandomLevelRequest(new Vector2(8, 8), 3, 1, 3, 5, 1400));
                return;
            }
            currentLevel = Instantiate(levels[progress].gameObject);
            currentLevel.GetComponent <Grid>().DetectGrid();
        }
        else if (!obj.retry && !obj.random)
        {
            progress++;
            if (progress >= levels.Length)
            {
                OnRandomGenerateLevelRequested(new RandomLevelRequest(new Vector2(8, 8), 3, 1, 3, 5, 1400));
            }
            else
            {
                currentLevel = Instantiate(levels[progress].gameObject);
                currentLevel.GetComponent <Grid>().DetectGrid();
            }
        }
        else if (random)
        {
            OnRandomGenerateLevelRequested(randomRequest);
        }
    }
Exemplo n.º 2
0
 private void OnLevelGenerateRequested(GenerateLevelRequestEvent obj)
 {
     currentLevel = levels[obj.generateAlreadySelected ? selectedLevel : obj.levelIndex];
     CodeControl.Message.Send(new GenerateTilesRequestEvent(currentLevel));
 }
Exemplo n.º 3
0
 private void OnGenerateLevelRequest(GenerateLevelRequestEvent obj)
 {
     retryButton.gameObject.SetActive(true);
     regenerateButton.gameObject.SetActive(false);
     randomLevel = false;
 }