Exemple #1
0
        public static bool DetectNPCCloseChainFrom(CellObjCtrl ctrl, ref List <CellObjCtrl> ringObjs, ref List <CellObjCtrl> _chainObjs)
        {
            bool bDetected         = false;
            List <CellObjCtrl> lst = new List <CellObjCtrl> ();

            lst.Add(ctrl);
            while (CellObjCtrlUtils.IsFwdSameCamp(ctrl))
            {
                ctrl = CellObjCtrlUtils.GetFwdCellObjCtrl(ctrl);
                if (lst.Contains(ctrl))
                {
                    int startId = lst.IndexOf(ctrl);
                    int cnt     = startId;
                    //Debug.Log ("remove cnt:" + cnt);
                    _chainObjs = lst;
                    lst.RemoveRange(0, cnt);
                    bDetected = true;
                    break;
                }
                lst.Add(ctrl);
            }
            ringObjs = lst;

            return(bDetected);
        }