IEnumerator SkipMissionAnimation(MissionInfoViewer skipInfoViewer) { var missionManager = MyMissionManager.Instance; missionManager.SkipMission(skipInfoViewer.MissionData); AddInfoViewer(3); yield return(KKUtilities.FloatLerp(0.3f, (t) => { skipInfoViewer.transform.localScale = Vector3.Lerp(Vector3.one, Vector3.zero, Easing.InQuad(t)); })); infoViewerPool.ReturnInstance(skipInfoViewer.GetComponent <PoolMonoBehaviour>()); viewers.Remove(skipInfoViewer); for (int i = 0; i < viewers.Count; i++) { var viewer = viewers[i]; var rectTransform = viewer.transform as RectTransform; var startPos = rectTransform.anchoredPosition; var origin = new Vector2(-365.0f, 0.0f); var offset = new Vector2(365.0f, 0.0f); var targetPos = origin + (offset * i); this.FloatLerp(0.3f, (t) => { rectTransform.anchoredPosition = Vector2.Lerp(startPos, targetPos, Easing.OutQuad(t)); }); } yield return(new WaitForSeconds(0.3f)); skipMissionAnimating = false; }
public void SkipMission(MissionInfoViewer infoViewer) { if (skipMissionAnimating) { return; } skipMissionAnimating = true; MyAdManager.Instance.ShowRewardVideo("SkipMission", () => { StartCoroutine(SkipMissionAnimation(infoViewer)); }, () => { skipMissionAnimating = false; }); }