Exemplo n.º 1
0
    IEnumerator StayInWrongZoneTimer(int timeInWrongZone)
    {
        coroutineFreeStarted = true;
        yield return(new WaitForSeconds(1f));

        if (!inGoodZone)
        {
            if (timeInWrongZone == fish.fishData.timeToBeFree - 1)
            {
                Debug.Log("Il s'est libéré !");
                Player.instance.SetStateAction(new PlayerFishing(Player.instance));
                fish.BeFree();
                GameManager.instance.SetBarCircleActive(false);
            }
            else
            {
                StartCoroutine(StayInWrongZoneTimer(timeInWrongZone + 1));
            }
        }
        else
        {
            coroutineFreeStarted = false;
        }
    }