Esempio n. 1
0
    public static GameplayConfig GetGameplayConfig()
    {
        if (_gameplayConfig != null)
        {
            return(_gameplayConfig);
        }

        _gameplayConfig = Resources.Load <GameplayConfig>($"Configs/GameplayConfig");

        if (_gameplayConfig == null)
        {
            Debug.LogError("GameplayConfig is not found");
        }

        return(_gameplayConfig);
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        // PlayerPrefs.SetInt(LevelReached_PPK, 1);
        GPC = (GameplayConfig)gamePlayConfig;
        if (GPC == null)
        {
            Debug.LogError("Please check GamePlayConfig object in Manager because is null!!!!!!");
        }
        //Debug.Log ("GameManager Start");
        Application.targetFrameRate = 60;

        //Add another actions here
        DeadPieceMaterial   = deadPieceMaterial;
        NormalPieceMaterial = normalPieceMaterial;
        BrokenPieceMaterial = brokenPieceMaterial;

        PassedCountForBreakHelix = GPC.helixPassedCountForBreak;
        ReviveWaitTime           = GPC.reviveWaitTime;
        ThreeStarTime            = GPC.threeStarPercentTime;
        TwoStarTime    = GPC.twoStarPercentTime;
        OneStarTime    = GPC.oneStarPercentTime;
        IsRevived      = false;
        Time.timeScale = 1f; //Reset time if there was some error when making slow motion...

        //Set current level
        if (!PlayerPrefs.HasKey(LevelReached_PPK))
        {
            PlayerPrefs.SetInt(LevelReached_PPK, 1);
            CurrentLevel = 1;
        }

        if (!IsRestart)
        {
            CurrentLevel = PlayerPrefs.GetInt(LevelReached_PPK);
        }

        if (testingLevel != 0)
        {
            CurrentLevel = testingLevel;
        }

        //Show level on UI
        UIManager.Instance.SetLevelTxt(CurrentLevel);
        //Create background

        foreach (ParticlesConfig ps in GPC.particles)
        {
            if (CurrentLevel >= ps.MinLevel && CurrentLevel <= ps.MaxLevel)
            {
                CreateParticles(ps);
            }
        }

        foreach (BackgroundConfig b in GPC.backgroundColors)
        {
            if (CurrentLevel >= b.MinLevel && CurrentLevel <= b.MaxLevel)
            {
                CreateBackground(GPC.backgroundMaterial, b);
                break;
            }
        }

        //Create level
        foreach (GameLevelData o in GPC.gameLevels)
        {
            if (CurrentLevel >= o.MinLevel && CurrentLevel <= o.MaxLevel)
            {
                CreateLevel(o);
                break;
            }
        }

        StartCoroutine(ResetIsFinishedFadingValue());
        UIManager.Instance.FadeOutPanel(GPC.uIFadingTime);
        if (IsRestart)
        {
            PlayingGame();
        }
    }