// Weeds logic IEnumerator IllnessRoutine() { Weed.lastWeedCrush = swapEvent; Weed.seed = 0; int last_swapEvent = swapEvent; yield return(new WaitForSeconds(1f)); while (Weed.WeedCount > 0) { yield return(StartCoroutine(Utils.WaitFor(() => swapEvent > last_swapEvent && Weed.all != null && Weed.all.Count > 0, 0.1f))); last_swapEvent = swapEvent; yield return(StartCoroutine(Utils.WaitFor(CanIWait, 0.1f))); if (Weed.lastWeedCrush < swapEvent) { Weed.seed = 1; //swapEvent - Weed.lastWeedCrush; DebugUtil.Debug("Weed:" + Weed.seed); Weed.lastWeedCrush = swapEvent; } Weed.Grow(); } }
private IEnumerator ShowUI(bool isWin, int jiangBei, int money) { yield return(new WaitForSeconds(1.2f)); UIMgr.Instance.ShowUI(E_UIType.UIWinOrLosePanel, typeof(UIWinOrLose), (ui) => { UIWinOrLose uiWinOrLoose = ui as UIWinOrLose; if (uiWinOrLoose) { uiWinOrLoose.ShowWinOrLoose(isWin, jiangBei, money); SessionControl.Instance.isPlaying = false; EFightStatus = E_FightStatus.None; Level.AllLevels.Clear(); //清除所有卡牌 CardManager.Instance.DestroyAllCard(); SlotManager.Instance.Clear(); ParticleControl.Instance.Clear(); Weed.Clear(); DestroyFightScene(); } }); }
public static void Grow() { List <Slot> slots = new List <Slot> (); foreach (Weed weed in all) { foreach (Side side in Utils.straightSides) { if (weed.slot[side] && !weed.slot[side].Block && !(weed.slot[side].GetChip() && weed.slot[side].GetChip().chipType == "SugarChip")) { slots.Add(weed.slot[side]); } } } while (seed > 0) { if (slots.Count == 0) { return; } Slot target = slots[Random.Range(0, slots.Count)]; slots.Remove(target); if (target.GetChip()) { target.GetChip().HideChip(false); } Weed newWeed = ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(prefabName).GetComponent <Weed>(); newWeed.transform.position = target.transform.position; newWeed.name = "New_Weed"; newWeed.transform.SetParent(target.transform, false); target.SetBlock(newWeed); newWeed.slot = target; // AudioAssistant.Shot("WeedCreate"); newWeed.Initialize(); seed--; } }