private IEnumerator showBuildAnimation(int index, int level, bool isRepair, System.Action onComplate = null) { //yield return new WaitForSeconds(0.5f); GameMainManager.instance.audioManager.PlaySound(AudioNameEnum.building_upgrade); buildingAnimation.transform.position = islandFactory.GetBuildTransform(index).position; islandFactory.HideBuild(index); buildingAnimation.SetActive(true); yield return(new WaitForSeconds(1)); buildingAnimation.SetActive(false); BuildingData bd = new BuildingData(); bd.level = level; bd.status = 0; islandFactory.UpdateBuildingData(index, bd); islandFactory.ShowBuild(index); EventDispatcher.instance.DispatchEvent(new UpdateBaseDataEvent(UpdateBaseDataEvent.UpdateType.Money, 0)); if (!isRepair) { EventDispatcher.instance.DispatchEvent(new GetStarPosEvent((pos) => { star.transform.position = islandFactory.GetBuildTransform(index).position; star.SetActive(true); Sequence sq = DOTween.Sequence(); sq.Append((star.transform as RectTransform).DOAnchorPos(new Vector2(0, 30), 0.3f).SetRelative().SetEase(Ease.OutCubic)); sq.Append((star.transform as RectTransform).DOAnchorPos(new Vector2(0, -30), 0.7f).SetRelative().SetEase(Ease.OutBounce)); sq.Append(star.transform.DOMove(pos, 1).SetEase(Ease.InCubic)); sq.OnComplete(() => { star.SetActive(false); EventDispatcher.instance.DispatchEvent(new UpdateBaseDataEvent(UpdateBaseDataEvent.UpdateType.star, 0)); }); })); } if (onComplate != null) { yield return(new WaitForSeconds(2)); onComplate(); } }