protected void OnArrived(Message msg)
        {
            var _msg = msg as MessageArrived;

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            //自己的entity
            if (_msg.followPath.ownerEntity.entityID != entity.entityID)
            {
                return;
            }

            //先判断走到起点
            if (_msg.followPath.isArrivedEnd && !isArrivedStartOfPath)
            {
                isArrivedStartOfPath = true;
                EntityVisitor.GodownPath(entity, pathOfGotoLittleZoo);
                return;
            }

            if (_msg.followPath.isArrivedEnd && !isArrivedLittleZoo)
            {
                LogWarp.Log("到达动物栏,准备走向等待位");
                isArrivedLittleZoo      = true;
                entity.stayBuildingID   = this.stayBuildingID;
                entity.stayGroupID      = this.stayGroupID;
                isToEnterLittleZooApply = true;
                return;
            }
        }
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorGotoParking.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, OnArrived);

            Vector3 startPos = Vector3.zero;

            if (entity.entityFuncType == (int)EntityFuncType.Visitor_From_Car)
            {
                PathManager.GetInstance().GetPathFirstPos(Config.globalConfig.getInstace().ShuttleVisitorLeavePath, ref startPos);
                entity.position = startPos;
                EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().ShuttleVisitorLeavePath);
                return;
            }

            PathManager.GetInstance().GetPathFirstPos(Config.globalConfig.getInstace().AdvertVisitorLeavePath, ref startPos);
            entity.position = startPos;
            EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().AdvertVisitorLeavePath);
        }
예제 #3
0
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorGotoGroundParking.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, OnArrived);

#if UNITY_EDITOR
            if (entity.entityFuncType != (int)EntityFuncType.Visitor_From_GroundParking)
            {
                string e = string.Format("{0}这里必须是地面停车场来的游客", entity.entityID);
                throw new System.Exception(e);
            }
#endif
            //先走完基路
            isFinishedBasePath = false;
            EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().GroundParkingVistorBasePath);

            ////构建去地面停车场的路
            //List<Vector3> pathList = null;
            //var pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(entity.groundParkingGroupID, entity.groundParkingIdx);
            //if (!GroundParingSpacePathManager.IsExist(pathUnit.visitorBackPath))
            //{
            //    pathList = GroundParingSpacePathManager.GenVisitorBackPath(entity.groundParkingGroupID, entity.groundParkingIdx);
            //    GroundParingSpacePathManager.GetInstance().AddPath(GroundParingSpacePathType.VisitorBackPath, pathUnit, pathList, null);
            //}
            //pathList = pathUnit.visitorBackPath;

            //EntityVisitor.GodownPath(entity, pathList);
        }
        protected void OnArrived(Message msg)
        {
            var _msg = (MessageArrived)msg;
            //自己的entity
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (_msg.followPath.ownerEntity.entityID != entity.entityID)
            {
                return;
            }

            //到达终点, 但场景扩了, 需要继续往前走
            if (_msg.followPath.isArrivedEnd && extendSceneTime > 0)
            {
                --extendSceneTime;
                extendPathList.Add(entity.position);
                extendPathList.Add(entity.position + extendOffset);
                EntityVisitor.GodownPath(entity, extendPathList);
            }

            //单纯的到达终点
            if (_msg.followPath.isArrivedEnd)
            {
                isToStateVisitorGotoExitGateEntryQueue = true;
            }
        }
        protected void OnVisitorWhereLeaveFromReply(Message msg)
        {
            var _msg   = msg as VisitorWhereLeaveFromReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            //地下走
            if (!_msg.isFromGround)
            {
                entity.entityFuncType       = (int)EntityFuncType.Visitor_From_Car;
                entity.groundParkingGroupID = Const.Invalid_Int;
                entity.groundParkingIdx     = Const.Invalid_Int;
                EntityVisitor.GodownPath(entity, pathOfLeaveZoo);
                return;
            }

            //地上走
            entity.entityFuncType             = (int)EntityFuncType.Visitor_From_GroundParking;
            entity.groundParkingGroupID       = _msg.groupID;
            entity.groundParkingIdx           = _msg.idx;
            isToStateVisitorGotoGroundParking = true;
        }
예제 #6
0
        protected void OnVisitorWhereLeaveFromReply(Message msg)
        {
            var _msg   = msg as VisitorWhereLeaveFromReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (_msg.entityID != entity.entityID)
            {
                return;
            }

#if UNITY_EDITOR
            if (entity.entityFuncType != (int)(EntityFuncType.Visitor_From_GroundParking))
            {
                string e = string.Format("{0} 这里只能是地上游客获得申请回复", entity.entityID);
                throw new System.Exception(e);
            }
#endif
            //地下走, 需要构建去地上观察路的路径的反路
            if (!_msg.isFromGround)
            {
                entity.entityFuncType       = (int)EntityFuncType.Visitor_From_Car;
                entity.groundParkingGroupID = Const.Invalid_Int;
                entity.groundParkingIdx     = Const.Invalid_Int;
                entity.pathList.Clear();
                entity.pathList.Add(entity.position);
                entity.pathList.AddRange(PathManager.GetInstance().GetPath(Config.globalConfig.getInstace().EntryQueueObservePath, true));
                EntityVisitor.GodownPath(entity, entity.pathList);
                return;
            }

            //地上游客地上走
            //需要判定当前的位置和分配的位置,如果不一致得先走到分配的位置
            var            pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(_msg.groupID, _msg.idx);
            List <Vector3> pathList = null;
#if UNITY_EDITOR
            if (!GroundParingSpacePathManager.IsExist(pathUnit.entryObservePath))
            {
                string e = string.Format("大门排队满了,分配的地面停车场游客居然没有回去的观察路线groupID={0}, idx = {1}",
                                         _msg.groupID, _msg.idx);
                throw new System.Exception(e);
            }
#endif
            pathList = pathUnit.entryObservePath;
            entity.pathList.Clear();
            entity.pathList.AddRange(pathList);
            entity.pathList.Reverse();
            if (entity.groundParkingGroupID == _msg.groupID && entity.groundParkingIdx == _msg.idx)
            {
                EntityVisitor.GodownPath(entity, entity.pathList, true);
                return;
            }
            entity.groundParkingGroupID = _msg.groupID;
            entity.groundParkingIdx     = _msg.idx;
            entity.pathList.Insert(0, entity.position);
            EntityVisitor.GodownPath(entity, entity.pathList, true);
            return;
        }
        protected void OnAddVisitorToEntryQueuePlaceHolderReply(Message msg)
        {
            var _msg = msg as AddVisitorToEntryQueuePlaceHolderReply;

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            //无论成功失败,都有入口ID
            entity.zooEntryID = _msg.entryID;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 在VisitorGotoZooEntry状态 收到{1}", entity.entityID, msg);
            if (!_msg.result)
            {
                LogWarp.Log("入口所有排队满了, 准备离开, 转离开");
                DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 在VisitorGotoZooEntry状态 收到{1}入口所有排队满了, 准备离开, 转离开", entity.entityID, msg);
                this.isToVisitorStateLeaveZooEntryQueueFull = true;
                return;
            }

            isHold = true;
            Vector3        endPos         = UnityEngine.Vector3.zero;
            EntityFuncType entityFuncType = (EntityFuncType)(entity.entityFuncType);

            switch (entityFuncType)
            {
            case EntityFuncType.Visitor_From_Ship:
                entity.pathList.Clear();
                entity.pathList.Add(entity.position);
                endPos = UnityEngine.Vector3.zero;
                PathManager.GetInstance().GetPathLastPos(_msg.pathName, ref endPos);
                entity.pathList.Add(endPos);
                EntityVisitor.GodownPath(entity, entity.pathList);
                break;

            case EntityFuncType.Visitor_From_Car:
                EntityVisitor.GodownPath(entity, _msg.pathName, true);
                break;

            case EntityFuncType.Visitor_From_GroundParking:
                entity.pathList.Clear();
                entity.pathList.Add(entity.position);
                endPos = Vector3.zero;
                PathManager.GetInstance().GetPathLastPos(_msg.pathName, ref endPos);
                entity.pathList.Add(endPos);
                EntityVisitor.GodownPath(entity, entity.pathList, true);

                break;

            default:
                string e = string.Format("没有这种游客类型{0}", entityFuncType);
                throw new System.Exception(e);
            }
        }
예제 #8
0
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorLeaveZooEntryQueueFull.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);
            entity.moveSpeed = Config.globalConfig.getInstace().ZooVisitorBackSpeed;
            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, this.OnArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.VisitorWhereLeaveFromReply, this.OnVisitorWhereLeaveFromReply);

            //走回去的路,广告游客(ship)没有停车场逻辑,地下游客走地下, 地上游客走申请
            EntityFuncType entityFuncType = (EntityFuncType)(entity.entityFuncType);

            switch (entityFuncType)
            {
            case EntityFuncType.Visitor_From_Ship:
                EntityVisitor.GodownPath(entity, PathManager.GetInstance().GetPath(
                                             Config.globalConfig.getInstace().AdvertVisitorOut));
                break;

            case EntityFuncType.Visitor_From_Car:
                //这里没有走申请,得发个消息,让底下停车场数量-1
                MessageInt.Send((int)GameMessageDefine.DirectMinusOneUnderParkingNum, entity.entityID);
                EntityVisitor.GodownReversePath(entity, Config.globalConfig.getInstace().EntryQueueObservePath);
                break;

            case EntityFuncType.Visitor_From_GroundParking:
                VisitorWhereLeaveFromApply.Send(entity.entityID);
                break;

            default:
                string e = string.Format("没有这种游客类型{0}", entityFuncType);
                throw new System.Exception(e);
            }

            //生成愤怒表情
            var pool = PoolManager.GetInstance().GetGameObjectPool(9301);

            expGo             = pool.New();
            expTrans          = expGo.transform;
            expTrans.position = entity.position;
            ExpressionScaleAnim(expTrans, Config.globalConfig.getInstace().ExpressionScaleOrg,
                                Config.globalConfig.getInstace().ExpressionScaleMax,
                                Config.globalConfig.getInstace().ExpressionScaleDuration,
                                Config.globalConfig.getInstace().ExpressionDuration);
        }
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorGotoStartOfExitGateEntryPath.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            isToStateVisitorGotoExitGateEntryQueue = false;
            extendSceneTime = 0;

            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived,
                                                this.OnArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastAfterExtendSceneAndModifiedPath,
                                                this.OnBroadcastAfterExtendSceneAndModifiedPath);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastForwardOneStepInExitGateQueue,
                                                this.OnBroadcastForwardOneStepInExitGateQueue);

            var cellBuildUp = Config.buildupConfig.getInstace().getCell(entity.stayBuildingID);

            entity.pathList.Clear();
            Vector3 pos = Vector3.zero;

            if (PathManager.GetInstance().GetPathLastPos(cellBuildUp.outpath, ref pos))
            {
                entity.pathList.Add(pos);
            }

            var cellExitGate = Config.exitgateConfig.getInstace().getCell(entity.ExitGateEntryID);

            if (cellBuildUp.pathtype == 0)
            {
                PathManager.GetInstance().GetPathFirstPos(cellExitGate.positiveexitgate, ref pos);
            }
            else
            {
                PathManager.GetInstance().GetPathFirstPos(cellExitGate.negativeexitgate, ref pos);
            }

            entity.pathList.Add(pos);

            //LogWarp.LogErrorFormat("littlezoo={0}, outpath={1}, pathtype={2}, positive={3}, negative={4} ",
            //    entity.stayBuildingID, cellBuildUp.outpath, cellBuildUp.pathtype,
            //    cellExitGate.positiveexitgate, cellExitGate.negativeexitgate);

            EntityVisitor.GodownPath(entity, entity.pathList, true);
        }
예제 #10
0
        protected void GotoFirstPathOfZoo(EntityVisitor entity)
        {
            float   zooFirstPosOffset = Config.globalConfig.getInstace().ZooFirstPosOffset;
            var     startPos          = entity.position;
            var     midPos            = startPos + GlobalDataManager.GetInstance().SceneForward *zooFirstPosOffset;
            Vector3 endPos            = Vector3.zero;
            bool    retCode           = PathManager.GetInstance().GetPathFirstPos(Config.globalConfig.getInstace().FirstPathOfZoo, ref endPos);

#if UNITY_EDITOR
            if (!retCode)
            {
                string e = string.Format("取{0} 得起点异常", Config.globalConfig.getInstace().FirstPathOfZoo);
                throw new System.Exception(e);
            }
#endif
            entity.pathList.Clear();
            entity.pathList.Add(startPos);
            entity.pathList.Add(midPos);
            entity.pathList.Add(endPos);
            EntityVisitor.GodownPath(entity, entity.pathList);
        }
        protected void OnVisitorGetRandomLittleZooReply(Message msg)
        {
            var _msg   = msg as VisitorGetRandomLittleZooReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (entity.entityID != _msg.entityID)
            {
                return;
            }

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, " {0}", _msg);

            if (!_msg.result)
            {
                DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 申请失败,准备离开", entity.entityID);
                PrepareLeaveZoo(entity);
                return;
            }

            this.stayBuildingID = _msg.littleZooID;
            this.stayGroupID    = _msg.groupID;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, " GetPath {0} -> {1}", entity.stayBuildingID, _msg.littleZooID);

            this.pathOfGotoLittleZoo = EntityVisitor.GetPath(entity.stayBuildingID, _msg.littleZooID);
            if (string.IsNullOrEmpty(pathOfGotoLittleZoo))
            {
                string e = string.Format("{0}没有找到路{1} -> {2} !!!!!!!!!!", entity.entityID, entity.stayBuildingID, _msg.littleZooID);
                throw new System.Exception(e);
            }
            //LogWarp.LogFormat("动物栏{0}, 等待位获得成功, 排号{1}, 路径{2}", _msg.littleZooID, _msg.indexInQueue, pathOfGotoLittleZoo);

            if (this.isArrivedStartOfPath)
            {
                EntityVisitor.GodownPath(entity, pathOfGotoLittleZoo);
                return;
            }

            EntityVisitor.GotoStartOfPath(entity, pathOfGotoLittleZoo);
        }
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateVisitorLeaveFromZooEntry.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            isArrivedStartOfPathTo1000        = false;
            isArrivedEndOfPathTo1000          = false;
            isToStateVisitorGotoGroundParking = false;

            var playdata = GlobalDataManager.GetInstance().playerData;

            entryBuildingID = GlobalDataManager.GetInstance().logicTableGroup.GetSingleBuildingID(playdata.playerZoo.currSceneID, BuildingType.EntryGate);

            entity.moveSpeed = Config.globalConfig.getInstace().ZooVisitorBackSpeed;

            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, OnArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.VisitorWhereLeaveFromReply, this.OnVisitorWhereLeaveFromReply);

            pathOfLeaveZoo = Config.globalConfig.getInstace().NaturalVisitorOut_1;
            //选当前所在位置到1000的路,走过去。
            if (entity.stayBuildingID == entryBuildingID)
            {
                LogWarp.LogFormat("{0}  刚入口排队结束进入动物后就返回!", entity.entityID);
                isArrivedStartOfPathTo1000 = true;
                EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().EntryGoBackPath);
                return;
            }

            pathOfTo1000 = EntityVisitor.GetPath(entity.stayBuildingID, entryBuildingID);
            if (string.IsNullOrEmpty(pathOfTo1000))
            {
                string e = string.Format("StateVisitorLeaveNonLittleZoo 没找到{0}->{1}的路!!!!", entity.stayBuildingID, 1000);
                throw new Exception(e);
            }
            EntityVisitor.GotoStartOfPath(entity, pathOfTo1000);
        }
예제 #13
0
        protected void OnArrived(Message msg)
        {
            var _msg = (MessageArrived)msg;

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            //自己的entity
            if (_msg.followPath.ownerEntity.entityID != entity.entityID)
            {
                return;
            }

            if (_msg.followPath.isArrivedEnd && !isFinishedBasePath)
            {
                isFinishedBasePath = true;
                //构建去地面停车场的路
                List <Vector3> pathList = null;
                var            pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(entity.groundParkingGroupID, entity.groundParkingIdx);
                if (!GroundParingSpacePathManager.IsExist(pathUnit.visitorBackPath))
                {
                    pathList = GroundParingSpacePathManager.GenVisitorBackPath(entity.groundParkingGroupID, entity.groundParkingIdx);
                    GroundParingSpacePathManager.GetInstance().AddPath(GroundParingSpacePathType.VisitorBackPath, pathUnit, pathList, null);
                }
                pathList = pathUnit.visitorBackPath;
                EntityVisitor.GodownPath(entity, pathList);

                return;
            }

            if (_msg.followPath.isArrivedEnd)
            {
                MessageGroundParkingSpace.Send((int)GameMessageDefine.BroadcastLetGroundParingCarLeave,
                                               entity.groundParkingGroupID, entity.groundParkingIdx);

                // 回POOL
                EntityManager.GetInstance().RemoveFromEntityMovables(entity);
            }
        }
        protected void OnVisitorGetVisitSeatReply(Message msg)
        {
            var _msg   = msg as VisitorGetVisitSeatReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            if (!_msg.result)
            {
                isToStateChoseLittleZoo = true;
                return;
            }
            entity.indexInVisitQueue = _msg.idxOfQueue;
            entity.pathList.Clear();
            entity.pathList.Add(entity.position);
            var     buildinPos = LittleZooBuildinPosManager.GetInstance().GetLittleZooBuildinPos(entity.stayBuildingID);
            Vector3 visitPos   = buildinPos.visitPosList[_msg.idxOfQueue];

            entity.pathList.Add(visitPos);
            EntityVisitor.GodownPath(entity, entity.pathList, false);
        }
        protected void GoToOrgPosOfQueue(EntityVisitor entity)
        {
            var cellBuildUp = Config.buildupConfig.getInstace().getCell(entity.stayBuildingID);

            var cellExitGate = Config.exitgateConfig.getInstace().getCell(entity.ExitGateEntryID);

            entity.pathList.Clear();
            if (cellBuildUp.pathtype == 0)
            {
                entity.pathList.AddRange(PathManager.GetInstance().GetPath(cellExitGate.positiveexitgate));
            }
            else
            {
                entity.pathList.AddRange(PathManager.GetInstance().GetPath(cellExitGate.negativeexitgate));
            }

            finishQueueStep = entity.indexInExitGateEntryQueue;
            float   queuePosX = (float)(cellExitGate.maxnumofperqueue - entity.indexInExitGateEntryQueue);
            Vector3 queuePos  = entity.pathList[entity.pathList.Count - 1];

            queuePos.x -= queuePosX;
            entity.pathList.Add(queuePos);
            EntityVisitor.GodownPath(entity, entity.pathList);
        }
        protected void OnArrived(Message msg)
        {
            var _msg = (MessageArrived)msg;

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            //自己的entity
            if (_msg.followPath.ownerEntity.entityID != entity.entityID)
            {
                return;
            }

            var entityFuncType = (EntityFuncType)entity.entityFuncType;

            //到达离开的起点,向1000走
            if (_msg.followPath.isArrivedEnd && !isArrivedStartOfPathTo1000)
            {
                isArrivedStartOfPathTo1000 = true;
                EntityVisitor.GodownPath(entity, pathOfTo1000);
                return;
            }

            //向动物园外走(已经走到1000了)
            if (_msg.followPath.isArrivedEnd && !isArrivedEndOfPathTo1000)
            {
                DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 往回走", entity.entityID);
                isArrivedEndOfPathTo1000 = true;

                //switch(entityFuncType)
                //{
                //    case EntityFuncType.Visitor_From_Ship:
                //        EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().AdvertVisitorLeavePath);
                //        break;
                //    case EntityFuncType.Visitor_From_Car:
                //        EntityVisitor.GodownPath(entity, pathOfLeaveZoo);
                //        break;
                //    case EntityFuncType.Visitor_From_GroundParking:
                //        EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().GroundParkingVistorBasePath);
                //        break;
                //    default:
                //        string e = string.Format("没有这种游客类型{0}", entityFuncType);
                //        throw new System.Exception(e);
                //}

                //如果是广告游客直接离开
                //非广告游客请求是从地面还是地下走
                switch (entityFuncType)
                {
                case EntityFuncType.Visitor_From_Ship:
                    EntityVisitor.GodownPath(entity, Config.globalConfig.getInstace().AdvertVisitorLeavePath);
                    break;

                case EntityFuncType.Visitor_From_Car:
                case EntityFuncType.Visitor_From_GroundParking:
                    VisitorWhereLeaveFromApply.Send(entity.entityID);
                    break;

                default:
                    string e = string.Format("没有这种游客类型{0}", entityFuncType);
                    throw new System.Exception(e);
                }

                return;
            }

            if (_msg.followPath.isArrivedEnd)
            {
                //LogWarp.Log("结束离开");
                //DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 回收", entity.entityID);
                //EntityManager.GetInstance().RemoveFromEntityMovables(entity);

                ////通知生成离开的汽车
                //if (entity.entityFuncType == (int)EntityFuncType.Visitor_From_Car)
                //{
                //    MessageManager.GetInstance().Send((int)GameMessageDefine.SpawnVisitorCarLeaveZoo);
                //}

                //switch (entityFuncType)
                //{
                //    case EntityFuncType.Visitor_From_Car:
                //        //EntityManager.GetInstance().RemoveFromEntityMovables(entity);
                //        ////通知生成离开的汽车
                //        //MessageManager.GetInstance().Send((int)GameMessageDefine.SpawnVisitorCarLeaveZoo);
                //        //break;
                //    case EntityFuncType.Visitor_From_GroundParking:
                //        //转向走向地面停车场
                //        //isToStateVisitorGotoGroundParking = true;
                //        VisitorWhereLeaveFromApply.Send(entity.entityID);
                //        break;
                //    case EntityFuncType.Visitor_From_Ship:
                //        EntityManager.GetInstance().RemoveFromEntityMovables(entity);
                //        break;
                //    default:
                //        string e = string.Format("没有这种游客类型{0}", entityFuncType);
                //        throw new System.Exception(e);
                //}

                //地下游客清除自己,通知生成离开的车
                //广告游客清除自己
                //地上游客,不可能,是异常
                switch (entityFuncType)
                {
                case EntityFuncType.Visitor_From_Ship:
                    EntityManager.GetInstance().RemoveFromEntityMovables(entity);
                    break;

                case EntityFuncType.Visitor_From_Car:
                    DebugFile.GetInstance().WriteKeyFile("FromUnder_", "{0}", entity.entityID);
                    EntityManager.GetInstance().RemoveFromEntityMovables(entity);
                    ////通知生成离开的汽车
                    MessageManager.GetInstance().Send((int)GameMessageDefine.SpawnVisitorCarLeaveZoo);
                    break;

                default:
                    string e = string.Format("这里不可能出现这种游客类型{0}", entityFuncType);
                    throw new System.Exception(e);
                }
            }
        }
        public override void Enter(int preStateName)
        {
            //LogWarp.Log("VisitorGotoZooEntry.Enter");
            base.Enter(preStateName);

            isToVisitorStateLeaveZooEntryQueueFull = false;
            isToVisitorStateEntryQueue             = false;
            //isStartGotoEntry = false;

            isArrivedObservePos = false;

            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} VisitorGotoZooEntry.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "visitor_{0}_{1}_{2}", entity.entityID, (VisitorState)this.preStateName, (VisitorState)this.stateName);

            entity.Reset();
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} Play {1}, {2}, {3}",
                                                 entity.entityID, Config.globalConfig.getInstace().VisitorWalk,
                                                 entity.mainGameObject.GetInstanceID(),
                                                 entity.anim.animation.gameObject.GetInstanceID()
                                                 );
            entity.PlayActionAnim(Config.globalConfig.getInstace().VisitorWalk);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.AddVisitorToEntryQueuePlaceHolderReply, this.OnAddVisitorToEntryQueuePlaceHolderReply);
            MessageManager.GetInstance().Regist((int)UFrameBuildinMessage.Arrived, this.OnArrived);
            MessageManager.GetInstance().Regist((int)GameMessageDefine.BroadcastForwardOneStepInEntryGateQueue, OnBroadcastForwardOneStepInExitGateQueue);
            //去观察点
            string         pathName;
            EntityFuncType entityFuncType = (EntityFuncType)(entity.entityFuncType);

            switch (entityFuncType)
            {
            case EntityFuncType.Visitor_From_Ship:
                pathName = Config.globalConfig.getInstace().AdvertVisitorInto_2;
                EntityVisitor.GodownPath(entity, pathName, true);
                break;

            case EntityFuncType.Visitor_From_Car:
                pathName = Config.globalConfig.getInstace().EntryQueueObservePath;
                EntityVisitor.GodownPath(entity, pathName, true);
                break;

            case EntityFuncType.Visitor_From_GroundParking:
                //LogWarp.LogErrorFormat("entityID={0} StateVisitorGotoZooEntry  groupID={1}, idx={2}", entity.entityID, entity.groundParkingGroupID, entity.groundParkingIdx);
                var            pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(entity.groundParkingGroupID, entity.groundParkingIdx);
                List <Vector3> pathList = null;
                if (!GroundParingSpacePathManager.IsExist(pathUnit.entryObservePath))
                {
                    pathList = GroundParingSpacePathManager.GenObservePath(entity.groundParkingGroupID, entity.groundParkingIdx);
                    GroundParingSpacePathManager.GetInstance().AddPath(GroundParingSpacePathType.EntryObservePath, pathUnit, pathList, null);
                }
                pathList = pathUnit.entryObservePath;
                entity.pathList.Clear();
                entity.pathList.AddRange(pathList);
                EntityVisitor.GodownPath(entity, entity.pathList, true);

                ///*新手引导阶段    添加跟随对象 不做步骤调用(仅限于步骤9)*/
                if (GlobalData.GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true)
                {
                    UIGuidePage uIGuidePage = PageMgr.GetPage <UIGuidePage>();
                    if (uIGuidePage == null)
                    {
                        string e1 = string.Format("新手引导界面  PageMgr.allPages里 UIGuidePage   为空");
                        throw new System.Exception(e1);
                    }
                    //LogWarp.LogError("测试:  entity.mainGameObject.name " + entity.mainGameObject.name+ "    uIGuidePage.procedure= "+ uIGuidePage.procedure);
                    if (uIGuidePage.newBieGuild_step == NewBieGuild.Step_9 && uIGuidePage.number == 0)
                    {
                        uIGuidePage.entity = entity;
                        uIGuidePage.number = 1;
                    }
                }

                break;

            default:
                string e = string.Format("没有这种游客类型{0}", entityFuncType);
                throw new System.Exception(e);
            }
        }