예제 #1
0
    void Update()
    {
        if (IsOver)
        {
            return;
        }

        if (_score.Value <= 0)
        {
            GameOver(false);
            _score.Value = 0;
        }
        else if (_score.Value >= Data.Settings[Data.SettingsIndex].FinalScore)
        {
            GameOver(true);
            _score.Value = Data.Settings[Data.SettingsIndex].FinalScore;
        }
        else if (ScoreText.text != _score.Value.ToString())
        {
            GameObject obj = TPObjectPool.GetFreeObjOf(Data.Settings[Data.SettingsIndex].ParticlesPrefab, true);
            TPObjectPool.ActiveObj(obj, playerBaseTrans.position);
            StartCoroutine(TPObjectPool.DeactiveObj(obj, 1));
        }

        ScoreText.text = _score.Value.ToString();
    }
예제 #2
0
    void Cache()
    {
        result          = GetComponent <Result>();
        Player          = GameObject.FindGameObjectWithTag("Player");
        PlayerBase      = Player.transform.parent.gameObject;
        playerBaseTrans = PlayerBase.transform;
        Score           = new NativeCustom <int>(1, Allocator.Persistent);
        ScoreText.text  = Score.Value.ToString();

        TPObjectPool.AddToPool(Data.Settings[Data.SettingsIndex].ParticlesPrefab, 4);
    }
예제 #3
0
 void OnDisable()
 {
     Instance = null;
     Score.Dispose();
     TPObjectPool.Dispose();
 }