IEnumerator copulateChild(HouseAction houseAction, float time) { houseAction.countdownLabel.text = time.ToString(); float valueEachFrame = Time.fixedDeltaTime / (time / PlayerInfo.Instance.userInfo.timeScale); float elapsedTime = 0.0f; float currentTime = time; while (true) { elapsedTime += Time.fixedDeltaTime; houseAction.countdownForeground.fillAmount -= valueEachFrame; if (elapsedTime >= 1.0f) { currentTime--; elapsedTime = 0.0f; houseAction.countdownLabel.text = currentTime.ToString(); } if (houseAction.countdownForeground.fillAmount <= 0.0f && currentTime <= 0) { copulateOut(); yield break; } yield return(0); } }
public void copulateIn() { PlayerDragon.SetActive(false); currentHouse.StateAction = EHouseStateAction.CLOSE; dragonController.isCopulate = true; HouseAction action = currentHouse.GetComponent <HouseAction>(); action.countdown.SetActive(true); action.countdownForeground.fillAmount = 1; EffectSupportor.Instance.fadeInAndDestroy(action.countdown, ESpriteType.UI_SPRITE, 0.8f); StartCoroutine(copulateChild(action, 1)); }
void Start() { panelTween = PlayManager.Instance.towerInfoController.GetComponent <TweenPosition>(); foreach (Transform child in PlayManager.Instance.footerBar.transform) { if (child.name == PlayNameHashIDs.PanelTowerBuild) { GetComponent <UIPlayTween>().tweenTarget = child.gameObject; break; } } houseController = transform.parent.GetComponent <HouseController>(); houseAction = transform.parent.GetComponent <HouseAction>(); }