Ejemplo n.º 1
0
    public static IEnumerator ApplyPetrificationCharmCoroutine(BodyPart bodyPart, float seconds, int goldCost)
    {
        Clock clock = MonoBehaviour.FindObjectOfType <Clock>();

        clock.StartClockUntil(seconds);
        ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>();

        buttonActions.ActionInProgress();
        while (clock.isTimePassing)
        {
            yield return(null);
        }
        buttonActions.ActionFinished();

        if (!clock.actionCancelFlag)
        {
            ApplyPetrificationCharmProcess(bodyPart);
            GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost;
            buttonActions.SelectCharmAction();
        }
        else
        {
            clock.actionCancelFlag = false;
        }
    }