Esempio n. 1
0
    private static IEnumerator AddBloodCoroutine(BodyPart bodyPart, float seconds, int goldCost, int blood)
    {
        Clock clock = MonoBehaviour.FindObjectOfType <Clock>();

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

        buttonActions.UpdateMenuButtonsInteractivity(false);

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

        if (!clock.actionCancelFlag)
        {
            bodyPart.GetComponent <BodyPart>().blood += blood;
            MonoBehaviour.FindObjectOfType <ActionTracker>().blood_injected += blood;
            GameObject.FindObjectOfType <GoldTracker>().goldSpent           += goldCost;
            buttonActions.SelectBloodAction();
        }
        else
        {
            clock.actionCancelFlag = false;
        }
    }