Vector3 GetFlyTargetPos(MG_MenuFlyTarget _flyTarget) { if (dic_flytarget_transform.TryGetValue((int)_flyTarget, out Transform trans_Target)) { return(trans_Target.position); } return(Vector3.zero); }
void FlyToTargetCallback(MG_MenuFlyTarget _flyTarget) { if (_flyTarget == MG_MenuFlyTarget.WheelTicket) { MG_UIManager.Instance.UpdateWheelTicketText(); return; } StopCoroutine("ExpandTarget"); StartCoroutine("ExpandTarget", _flyTarget); }
public void FlyToTarget(Vector3 startWorldPos, Vector3 targetWorldPos, int num, MG_MenuFlyTarget flyType, Action <MG_MenuFlyTarget> callback) { this.flyType = flyType; StartPos = startWorldPos; TargetPos = targetWorldPos; flyNum = num; RandomSpawnPos(); canvasGroup.alpha = 1; canvasGroup.blocksRaycasts = true; if (cor_fly != null) { StopCoroutine(cor_fly); } cor_fly = StartCoroutine(StartMove(flyType, callback)); }
void FlyToTargetCallback(MG_MenuFlyTarget _flyTarget) { switch (_flyTarget) { case MG_MenuFlyTarget.WheelTicket: MG_UIManager.Instance.UpdateWheelTicketText(); return; case MG_MenuFlyTarget.Orange: case MG_MenuFlyTarget.Cherry: case MG_MenuFlyTarget.Watermalen: MG_UIManager.Instance.UpdateSlotsPanel_FruitText(); return; } StopCoroutine("ExpandTarget"); StartCoroutine("ExpandTarget", _flyTarget); }
IEnumerator ExpandTarget(MG_MenuFlyTarget _flyTarget) { if (!dic_flytarget_transform.TryGetValue((int)_flyTarget, out Transform tempTrans)) { yield break; } bool toBiger = true; while (true) { yield return(null); if (toBiger) { if (Time.unscaledDeltaTime < 0.4f) { tempTrans.localScale += Vector3.one * Time.unscaledDeltaTime * 3; } else { tempTrans.localScale += Vector3.one * 0.02f * 3; } if (tempTrans.localScale.x >= 1.3f) { toBiger = false; switch (_flyTarget) { case MG_MenuFlyTarget.OneGold: UpdateGoldText(); break; case MG_MenuFlyTarget.Cash: UpdateCashText(); break; case MG_MenuFlyTarget.Diamond: UpdateSpecialTokenText(); break; case MG_MenuFlyTarget.Scratch: case MG_MenuFlyTarget.ScratchTicket: MG_UIManager.Instance.Update_ScratchTicketText(); break; default: UpdateSpecialTokenText(); break; } } } else { if (Time.unscaledDeltaTime < 0.4f) { tempTrans.localScale -= Vector3.one * Time.unscaledDeltaTime * 3; } else { tempTrans.localScale -= Vector3.one * 0.02f * 3; } if (tempTrans.localScale.x <= 1f) { break; } } } if (_flyTarget == MG_MenuFlyTarget.ScratchTicket && MG_SaveManager.Current_GamePanel != (int)MG_GamePanelType.ScratchPanel) { if (!go_scratchRP.activeSelf) { go_scratchRP.SetActive(true); } } yield return(null); tempTrans.localScale = Vector3.one; }
public void FlyToTarget(Vector3 startPos, MG_MenuFlyTarget flyTarget, int num) { MG_Manager.Instance.MG_Fly.FlyToTarget(startPos, GetFlyTargetPos(flyTarget), num, flyTarget, FlyToTargetCallback); }
IEnumerator StartMove(MG_MenuFlyTarget _flyTarget, Action <MG_MenuFlyTarget> callback) { float spreadTime = 0; float height = 50; while (spreadTime <= 0.2f) { yield return(null); spreadTime += Time.unscaledDeltaTime; float progress = spreadTime * 5; for (int i = 0; i < flyNum; i++) { list_allFly[i].position = Vector3.Lerp(StartPos, list_allEndPos[i], progress); list_allFly[i].position += new Vector3(0, -(spreadTime - 0.1f) * (spreadTime - 0.1f) * height * 100 + height, 0); } } yield return(null); for (int i = 0; i < flyNum; i++) { list_allFly[i].position = list_allEndPos[i]; } yield return(null); while (spreadTime <= 0.3f) { yield return(null); spreadTime += Time.unscaledDeltaTime; for (int i = 0; i < flyNum; i++) { list_allFly[i].position = list_allEndPos[i] + new Vector3(0, -(spreadTime - 0.25f) * (spreadTime - 0.25f) * 8000 + 20, 0); } } yield return(new WaitForSeconds(0.5f * Time.timeScale)); float flyTime = 0; float delay = 0.3f; int startIndex = 0; while (startIndex <= flyNum - 1) { yield return(null); flyTime += Time.unscaledDeltaTime * 5; float progress; for (int i = startIndex; i < flyNum; i++) { if (flyTime - i * delay >= 1) { callback(_flyTarget); startIndex = i + 1; list_allFlyImage[i].color = Color.clear; progress = 1; MG_Manager.Play_FlyOver(); } else { progress = flyTime; } float thisProgress = progress - i * delay; list_allFly[i].position = Vector3.Lerp(list_allEndPos[i], TargetPos, thisProgress); } } canvasGroup.alpha = 0; canvasGroup.blocksRaycasts = false; }
public void FlyEffectTo_MenuTarget(Vector3 startPos, MG_MenuFlyTarget flyTarget, int num) { MenuPanel.FlyToTarget(startPos, flyTarget, num); }