public static IEnumerator DeleteBodyPartCoroutine(BodyPart bodyPart, float seconds, int goldCost) { 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) { DeleteBodyPartProcess(bodyPart); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "SampleScene") { MonoBehaviour.FindObjectOfType <BodyPartStatusManager>().UpdateStatusCollection(); } buttonActions.SelectSurgeryAction(); } }
public static IEnumerator RemoveOrganCoroutine(Organ organ, float seconds, int goldCost, float bloodLossRateInduced, float damageInduced) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.UpdateMenuButtonsInteractivity(false); buttonActions.ActionInProgress(); while (clock.isTimePassing) { RemoveOrganDuring(organ, clock, seconds, bloodLossRateInduced, damageInduced); yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { RemoveOrganProcess(organ); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; buttonActions.SelectSurgeryAction(); } }
public static IEnumerator ConnectBodyPartCoroutine(BodyPart bodyPart1, BodyPart bodyPart2, float seconds, int goldCost, float bloodLossRateInduced, float damageInduced) { Clock clock = MonoBehaviour.FindObjectOfType <Clock>(); clock.StartClockUntil(seconds); ButtonActions buttonActions = MonoBehaviour.FindObjectOfType <ButtonActions>(); buttonActions.UpdateMenuButtonsInteractivity(false); buttonActions.ActionInProgress(); while (clock.isTimePassing) { ConnectBodyPartDuring(bodyPart1, bodyPart2, clock, seconds, bloodLossRateInduced, damageInduced); yield return(null); } buttonActions.ActionFinished(); if (!clock.actionCancelFlag) { ConnectBodyPartProcess(bodyPart1, bodyPart2); GameObject.FindObjectOfType <GoldTracker>().goldSpent += goldCost; MonoBehaviour.FindObjectOfType <BodyPartStatusManager>().UpdateStatusCollection(); buttonActions.SelectSurgeryAction(); } }