IEnumerator SlowTime()
    {
        Debug.Log("In slow time");
        coins.coinsColected -= 3;
        inSlowTimePower      = true;

        HaltAllPowerUps();
        displayCoins.text = $"{coins.coinsColected}";

        var dialCreated = Instantiate(dial, canvas.transform, false);

        dialCreated.GetComponent <Dial>().timeLeft   = slowTime;
        dialCreated.GetComponent <Dial>().totalTime  = slowTime;
        dialCreated.GetComponent <Dial>().startTimer = true;

        Debug.Log("Slowing time down");

        gameTimeManager.SlowTimeDown(slowness);

        yield return(new WaitForSecondsRealtime(slowTime));

        Debug.Log("Done Slowing time down");

        UpdateDisplayCoins();               // Check new status of power ups and their validation state.

        CheckPowers();

        Destroy(dialCreated, 0.1f);
        inSlowTimePower = false;
        gameTimeManager.NormalTimeRestore();  // FIX when player is within in and out then dont restore normal time!

        yield break;
    }
Exemple #2
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.CompareTag("Player") && coinManager.inSlowTimePower == false)
        {
            gameTimeManager.SlowTimeDown(0.2f);

            GetComponent <BoxCollider>().enabled = false;

            StartCoroutine(shooter.Shoot());
        }
    }