Esempio n. 1
0
    public static IEnumerator InjectPotionCoroutine(BodyPart bodyPart, string type, float amount, 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)
        {
            InjectPotionProcess(bodyPart.GetComponent <BodyPart>(), type, amount);
            GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost;
            buttonActions.SelectMedicineAction();
        }
        else
        {
            clock.actionCancelFlag = false;
        }
    }