public bool ClearOpt() { if (m_OptList == null) { return(true); } for (int i = 0; i < m_OptList.Count; ++i) { IFishOpt opt = m_OptList[i]; FishOptState state = opt.CheckDelay(0); if (state == FishOptState.FOS_DELAY || state == FishOptState.FOS_FIRST) { continue; } bool bRemove; bool bRet = opt.Update(1000, this, out bRemove); if (!bRet) { string str = "Num:" + opt.CatchData.FishList.Count + ", "; for (int j = 0; j < opt.CatchData.FishList.Count; ++j) { str += opt.CatchData.FishList[j].FishType + ","; } Debug.Log(FishID + ":鱼死亡OPT,又加新动作:" + opt.ToString() + "," + str); return(false); } } m_OptList.Clear(); return(true); }
public void AddOpt(IFishOpt opt) { if (m_OptList == null) { m_OptList = new List <IFishOpt>(); } m_OptList.Add(opt); }
public bool OptUpdate(float delta) { if (m_OptList == null) { return(true); } bool bRemove; for (int i = 0; i < m_OptList.Count;) { IFishOpt opt = m_OptList[i]; FishOptState state = opt.CheckDelay(delta); if (state == FishOptState.FOS_DELAY) { ++i; continue; } if (state == FishOptState.FOS_FIRST) { opt.Init(this); } bool bRet = opt.Update(delta, this, out bRemove); if (bRet == false) { return(false); } if (bRemove) { Utility.ListRemoveAt(m_OptList, i); } else { ++i; } } return(true); }