public void AfterTickMoveables()
        {
            foreach (var v in this.entityMovableRemoves)
            {
                bool retCode = entityMovables.Remove(v.entityID);
#if UNITY_EDITOR
                if (!retCode)
                {
                    string e = string.Format("{0} AfterTickMoveables 异常{1}", v.entityID, v.mainGameObject.name);
                    throw new System.Exception(e);
                }
#endif
                DebugFile.GetInstance().WriteKeyFile(v.entityID, "{0} AfterTickMoveables {1}", v.entityID, v.mainGameObject.GetInstanceID());
                DebugFile.GetInstance().WriteKeyFile(v.mainGameObject.GetInstanceID(), "{0} AfterTickMoveables {1}", v.mainGameObject.GetInstanceID(), v.entityID);


                EntityFuncType eEntityFuncType = (EntityFuncType)v.entityFuncType;
                switch (eEntityFuncType)
                {
                case EntityFuncType.CrossRoadCar:
                    CrossRoadGame.EntityCrossRoadCar.pool.Delete(v as CrossRoadGame.EntityCrossRoadCar);
                    break;

                case EntityFuncType.Animal_LittleGame:
                    EntityCrossRoadAnimal.pool.Delete(v as CrossRoadGame.EntityCrossRoadAnimal);
                    break;

                default:
                    string e = string.Format("没有这种 EntityFuncType {0}", eEntityFuncType);
                    throw new System.Exception(e);
                }
            }
            entityMovableRemoves.Clear();
        }
 public void Init(VisitorStage stage, EntityFuncType funcType, int groupID, int idx)
 {
     this.stage    = stage;
     this.funcType = funcType;
     this.groupID  = groupID;
     this.idx      = idx;
 }
        public void ReleaseEntity(EntityMovable entity)
        {
            //清go
            var goPool = PoolManager.GetInstance().IsBelongGameObjectPool(entity.entityResType);

            goPool.OnRecovery(entity.mainGameObject);

            //清entity
            EntityFuncType eEntityFuncType = (EntityFuncType)entity.entityFuncType;

            switch (eEntityFuncType)
            {
            case EntityFuncType.CrossRoadCar:
                CrossRoadGame.EntityCrossRoadCar.pool.Delete(entity as CrossRoadGame.EntityCrossRoadCar);
                break;

            case EntityFuncType.Animal_LittleGame:
                EntityCrossRoadAnimal.pool.Delete(entity as CrossRoadGame.EntityCrossRoadAnimal);
                break;

            default:
                string e = string.Format("没有这种 EntityFuncType {0}", eEntityFuncType);
                throw new System.Exception(e);
            }
        }
Exemple #4
0
        protected void ArrivedVisitorCar(FollowPathRightAngles followPath, EntityFuncType entityFuncType)
        {
            DebugFile.GetInstance().WriteKeyFile(followPath.ownerEntity.entityID, "{0} {1} ArrivedVisitorCar",
                                                 followPath.ownerEntity.entityID, entityFuncType);

            var entity = followPath.ownerEntity as EntityVisitorCar;

            EntityManager.GetInstance().RemoveFromEntityMovables(entity);

            // 生成游客
            LogWarp.Log("car -> visistor");
            switch (entityFuncType)
            {
            case EntityFuncType.VisitorCar_EnterZoo:
                //车到了,刷下游客停车场数量
                numShowParking--;
                ShowLeftParkingNum(numShowParking);
                SpawnVisitorFromCar.Send(VisitorStage.GotoZoo, EntityFuncType.Visitor_From_Car);
#if DEBUG_VISIT
                BroadcastNum.Send((int)GameMessageDefine.BroadcastVisitorNum, numGroundParkingCar + numUnderParkingCar, 0f, 0);
                BroadcastNum.Send((int)GameMessageDefine.BroadcastMaxVisitorNum, numMaxParking, 0f, 0);
#endif
                break;

            case EntityFuncType.VisitorCar_LeaveZoo:
                break;
            }
        }
        public static SpawnVisitorFromCar Send(VisitorStage stage, EntityFuncType funcType)
        {
            var msg = pool.New();

            msg.Init(stage, funcType);
            MessageManager.GetInstance().Send(msg);
            return(msg);
        }
        public static SpawnVisitorFromGroundParking Send(VisitorStage stage, EntityFuncType funcType, int groupID, int idx)
        {
            var msg = pool.New();

            msg.Init(stage, funcType, groupID, idx);
            MessageManager.GetInstance().Send(msg);
            return(msg);
        }
        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);
            }
        }
Exemple #8
0
        public void Release(EntityMovable entity)
        {
            //清go
            var goPool = PoolManager.GetInstance().IsBelongGameObjectPool(entity.entityResType);

            goPool.OnRecovery(entity.mainGameObject);

            //清entity
            EntityFuncType eEntityFuncType = (EntityFuncType)entity.entityFuncType;

            switch (eEntityFuncType)
            {
            case EntityFuncType.VisitorCar_EnterZoo:
            case EntityFuncType.VisitorCar_LeaveZoo:
                EntityVisitorCar.pool.Delete(entity as EntityVisitorCar);
                break;

            case EntityFuncType.Visitor_From_Car:
            case EntityFuncType.Visitor_From_Ship:
            case EntityFuncType.Visitor_From_GroundParking:
                EntityVisitor.pool.Delete(entity as EntityVisitor);
                break;

            case EntityFuncType.Animal_Wander:
                EntityAnimalWander.pool.Delete(entity as EntityAnimalWander);
                break;

            case EntityFuncType.Shuttle:
                EntityShuttle.pool.Delete(entity as EntityShuttle);
                break;

            case EntityFuncType.Ship:
                EntityShip.pool.Delete(entity as EntityShip);
                break;

            case EntityFuncType.Train:
                EntityShip.pool.Delete(entity as EntityShip);
                break;

            case EntityFuncType.GroundParkingCar:
                EntityGroundParkingCar.pool.Delete(entity as EntityGroundParkingCar);
                break;

            case EntityFuncType.CrossRoadCar:
                CrossRoadGame.EntityCrossRoadCar.pool.Delete(entity as CrossRoadGame.EntityCrossRoadCar);
                break;

            default:
                string e = string.Format("没有这种 EntityFuncType {0}", eEntityFuncType);
                throw new System.Exception(e);
            }
        }
Exemple #9
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);
        }
Exemple #10
0
        /// <summary>
        /// 根据策划资源表的restype随机生成
        /// </summary>
        /// <param name="resType"></param>
        /// <param name="entityFuncType"></param>
        /// <returns></returns>
        public EntityGameObject GetRandomEntity(ResType resType, EntityFuncType entityFuncType)
        {
            EntityGameObject entity = null;

            List <ResourceKeyCell> cellList = GlobalDataManager.GetInstance().logicTableResource.GetResListByResType((int)resType);

            if (cellList == null || cellList.Count <= 0)
            {
                string e = string.Format("cellList 异常 {0}", (int)resType);
                throw new System.Exception(e);
            }

            int idx  = UnityEngine.Random.Range(0, cellList.Count);
            var cell = cellList[idx];

            entity = GenEntityGameObject(cell.key, entityFuncType);
            return(entity);
        }
Exemple #11
0
        protected void SpawnInGroundParkingCar(EntityFuncType entityFuncType, ParkingSpace parkingSpace)
        {
            EntityGroundParkingCar entity = null;

            //if (isRandomCar)
            {
                entity = EntityManager.GetInstance().GetRandomEntity(ResType.Car, entityFuncType) as EntityGroundParkingCar;
            }
            //else
            //{
            //    entity = EntityManager.GetInstance().GenEntityGameObject(2, EntityFuncType.VisitorCar_EnterZoo) as EntityGroundParkingCar;
            //}

            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "car_{0}_{1}_{2}", entity.mainGameObject.GetInstanceID(), entityFuncType, entity.entityID);
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 生成 {1}", entity.entityID, entity.mainGameObject.GetInstanceID());
            DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} 生成 {1}", entity.mainGameObject.GetInstanceID(), entity.entityID);

            EntityManager.GetInstance().AddToEntityMovables(entity);
            if (entity.anim == null)
            {
                entity.anim = new SimpleAnimation();
            }

            entity.anim.Init(entity.mainGameObject);
            if (entity.followPath == null)
            {
                entity.followPath = new FollowPathSuperMarketSimply();
            }

            //从表里取速度
            entity.moveSpeed = Config.globalConfig.getInstace().ZooCarSpeed;

            if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true)
            {
                UIGuidePage uIGuidePage = PageMgr.GetPage <UIGuidePage>();
                if (uIGuidePage == null && GlobalDataManager.GetInstance().playerData.GetLittleZooModuleData(1001).littleZooTicketsLevel < 5)
                {
                    entity.moveSpeed = Config.globalConfig.getInstace().GuideZooCarSpeed;
                }
                else if (uIGuidePage == null && GlobalDataManager.GetInstance().playerData.GetLittleZooModuleData(1001).littleZooTicketsLevel >= 5)
                {
                    GlobalDataManager.GetInstance().playerData.playerZoo.isGuide = false;
                }
            }


            entity.groundParkingGroupID = parkingSpace.groupID;
            entity.groundParkingIdx     = parkingSpace.idx;

            string pathName = "";

            switch (entityFuncType)
            {
            case EntityFuncType.GroundParkingCar:
                //pathName = globalConfig.getInstace().NaturalVisitorInto;
                pathName = string.Format("InGroundParking_{0}_{1}", parkingSpace.groupID, parkingSpace.idx);

                break;

            //case EntityFuncType.VisitorCar_LeaveZoo:
            //    pathName = globalConfig.getInstace().NaturalVisitorOut_2;
            //    break;
            default:
                string e = string.Format("car 没有这种功能类型{0}", entityFuncType);
                throw new System.Exception(e);
            }
            int sceneID = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID;

            Config.parkingCell parkingCell = GlobalDataManager.GetInstance().logicTableParkingData.GetParkingCell(sceneID);
            //var path = PathManager.GetInstance().GetPath(pathName);
            //var path = CalcPathManager.GenInGroundParkingSpacePath(ps.groupID, ps.idx, 8f, 5f, 7f, -1);
            var            pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(parkingSpace.groupID, parkingSpace.idx);
            List <Vector3> path     = null;

            if (!GroundParingSpacePathManager.IsExist(pathUnit.inPath))
            {
                //path = GroundParingSpacePathManager.GenInPath(parkingSpace.groupID, parkingSpace.idx, 8f, 5f, 7f, -1);
                path = GroundParingSpacePathManager.GenInPath(parkingSpace.groupID, parkingSpace.idx,
                                                              Config.globalConfig.getInstace().GroundParkingFristSpaceOffset,
                                                              Config.globalConfig.getInstace().GroundParkingSpace,
                                                              Config.globalConfig.getInstace().GroundParkingSpacePosOffset,
                                                              parkingCell.openseatdir[parkingSpace.groupID]);

                GroundParingSpacePathManager.GetInstance().AddPath(GroundParingSpacePathType.InPath, pathUnit, path, null);
            }
            path = pathUnit.inPath;

            entity.position = path[0];
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 移动位置到路径起点{1}, pos {2}", entity.entityID, entity.mainGameObject.GetInstanceID(), path[0]);
            DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} 移动位置到路径起点{1}, pos {2}", entity.mainGameObject.GetInstanceID(), entity.entityID, path[0]);

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 沿着路径{1}出发", entity.entityID, pathName);
            //entity.followPath.Init(entity, path.ToArray(), path[0], 0, entity.moveSpeed, false);
            entity.followPath.Init(entity, parkingSpace.groupID, parkingSpace.idx, path, path[0], 0, entity.moveSpeed);
            entity.Active();
            //ps.parkingCar = entity;
            //TracedCamera(entity);
            parkingSpace.SetBeLocked(entity);

            /*若是新手引导阶段,附加跟随对象 不调用步骤*/
            if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide == true)
            {
                DelayedOperationNewbieGuideStage(entity);
            }
        }
Exemple #12
0
        public void AfterTickMoveables()
        {
            foreach (var v in this.entityMovableRemoves)
            {
                bool retCode = entityMovables.Remove(v.entityID);
#if UNITY_EDITOR
                if (!retCode)
                {
                    string e = string.Format("{0} AfterTickMoveables 异常{1}", v.entityID, v.mainGameObject.name);
                    throw new System.Exception(e);
                }
#endif
                DebugFile.GetInstance().WriteKeyFile(v.entityID, "{0} AfterTickMoveables {1}", v.entityID, v.mainGameObject.GetInstanceID());
                DebugFile.GetInstance().WriteKeyFile(v.mainGameObject.GetInstanceID(), "{0} AfterTickMoveables {1}", v.mainGameObject.GetInstanceID(), v.entityID);


                EntityFuncType eEntityFuncType = (EntityFuncType)v.entityFuncType;
                switch (eEntityFuncType)
                {
                case EntityFuncType.VisitorCar_EnterZoo:
                case EntityFuncType.VisitorCar_LeaveZoo:
                    EntityVisitorCar.pool.Delete(v as EntityVisitorCar);
                    break;

                case EntityFuncType.Visitor_From_Car:
                case EntityFuncType.Visitor_From_Ship:
                case EntityFuncType.Visitor_From_GroundParking:
                    EntityVisitor.pool.Delete(v as EntityVisitor);
                    break;

                case EntityFuncType.Animal_Wander:
                    EntityAnimalWander.pool.Delete(v as EntityAnimalWander);
                    break;

                case EntityFuncType.Shuttle:
                    EntityShuttle.pool.Delete(v as EntityShuttle);
                    break;

                case EntityFuncType.Ship:
                    EntityShip.pool.Delete(v as EntityShip);
                    break;

                case EntityFuncType.Train:
                    EntityShip.pool.Delete(v as EntityShip);
                    break;

                case EntityFuncType.GroundParkingCar:
                    EntityGroundParkingCar.pool.Delete(v as EntityGroundParkingCar);
                    break;

                case EntityFuncType.CrossRoadCar:
                    CrossRoadGame.EntityCrossRoadCar.pool.Delete(v as CrossRoadGame.EntityCrossRoadCar);
                    break;

                default:
                    string e = string.Format("没有这种 EntityFuncType {0}", eEntityFuncType);
                    throw new System.Exception(e);
                }
            }
            entityMovableRemoves.Clear();
        }
Exemple #13
0
        /// <summary>
        /// 根据策划资源表的主键和实体单位功能类型(与表无关)
        /// </summary>
        /// <param name="entityResType">对应策划资源表的主键</param>
        /// <param name="entityFuncType"></param>
        /// <returns></returns>
        public EntityGameObject GenEntityGameObject(int entityResType, EntityFuncType entityFuncType)
        {
            EntityGameObject entity = null;

            int ientityFuncType = (int)entityFuncType;

            switch (entityFuncType)
            {
            case EntityFuncType.VisitorCar_EnterZoo:
            case EntityFuncType.VisitorCar_LeaveZoo:
                entity = EntityVisitorCar.pool.New();
#if UNITY_EDITOR
                if ((entity as EntityVisitorCar).followPath != null && (entity as EntityVisitorCar).followPath.IsRunning())
                {
                    string ee = string.Format("{0} followPath.IsRunning", entity.entityID);
                    throw new System.Exception(ee);
                }
#endif
                break;

            case EntityFuncType.Visitor_From_Car:
            case EntityFuncType.Visitor_From_Ship:
            case EntityFuncType.Visitor_From_GroundParking:
                entity = EntityVisitor.pool.New();
                break;

            case EntityFuncType.Animal_Wander:
                entity = EntityAnimalWander.pool.New();
                break;

            case EntityFuncType.Shuttle:
                entity = EntityShuttle.pool.New();
                break;

            case EntityFuncType.Ship:
                entity = EntityShip.pool.New();
                break;

            case EntityFuncType.Train:
                entity = EntityShip.pool.New();
                break;

            case EntityFuncType.GroundParkingCar:
                entity = EntityGroundParkingCar.pool.New();
                break;

            case EntityFuncType.CrossRoadCar:
                entity = CrossRoadGame.EntityCrossRoadCar.pool.New();
                break;

            case EntityFuncType.Animal_LittleGame:
                entity = CrossRoadGame.EntityCrossRoadAnimal.pool.New();
                break;

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

            entity.entityFuncType = ientityFuncType;
            int newEntityID = GetNewEntityID();
#if UNITY_EDITOR
            if (entity.mainGameObject != null)
            {
                DebugFile.GetInstance().WriteKeyFile(newEntityID, "{0} get from pool oldEntityID={1}, mainGameObject={2} ",
                                                     newEntityID, entity.entityID, entity.mainGameObject.GetInstanceID());
                DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} get from pool oldEntityID={1}, newEntityID={2} ",
                                                     entity.mainGameObject.GetInstanceID(), entity.entityID, newEntityID);
            }
#endif
            entity.entityID = newEntityID;


            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} GetNewEntityID", entity.entityID);
            if (entity.mainGameObject != null && entity.entityResType == entityResType)
            {
#if UNITY_EDITOR
                if (entityMovables.ContainsKey(entity.entityID))
                {
                    string e = string.Format("{0} 还在移动列表", entity.entityID);
                    throw new System.Exception(e);
                }
#endif
                //什么都不用干,用原来的mainGameObject
                DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} old {1}", entity.entityID, entity.mainGameObject.GetInstanceID());
                DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} old {1}", entity.mainGameObject.GetInstanceID(), entity.entityID);
                return(entity);
            }

            GameObjectPool pool = null;
            if (entity.mainGameObject != null && entity.entityResType != entityResType)
            {
                //回收mainGameObject
                pool = PoolManager.GetInstance().IsBelongGameObjectPool(entity.entityResType);
                if (pool == null)
                {
                    string e = string.Format("异常,找不到回收的GameObjectPool {0}", entity.entityResType);
                    throw new System.Exception(e);
                }
                DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} change {1}, pos {2}", entity.entityID, entity.mainGameObject.GetInstanceID(), entity.mainGameObject.transform.position);
                DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} change {1}, pos {2}", entity.mainGameObject.GetInstanceID(), entity.entityID, entity.mainGameObject.transform.position);

                pool.Delete(entity.mainGameObject);
                entity.ClearCatchTrans();
            }

            entity.entityResType = (int)entityResType;
            pool = PoolManager.GetInstance().GetGameObjectPool(entity.entityResType);
            entity.mainGameObject = pool.New();
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} new {1}", entity.entityID, entity.mainGameObject.GetInstanceID());
            DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} new {1}", entity.mainGameObject.GetInstanceID(), entity.entityID);

            return(entity);
        }
 public void Init(VisitorStage stage, EntityFuncType funcType)
 {
     this.stage    = stage;
     this.funcType = funcType;
 }
Exemple #15
0
        /// <summary>
        /// 地下停车场的车
        /// </summary>
        /// <param name="entityFuncType"></param>
        protected void SpawnVisitorCar(EntityFuncType entityFuncType)
        {
            EntityVisitorCar entity = null;

            //if (isRandomCar)
            {
                entity = EntityManager.GetInstance().GetRandomEntity(ResType.Car, entityFuncType) as EntityVisitorCar;
            }
            //else
            //{
            //    entity = EntityManager.GetInstance().GenEntityGameObject(2, EntityFuncType.VisitorCar_EnterZoo) as EntityVisitorCar;
            //}

            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "car_{0}_{1}_{2}", entity.mainGameObject.GetInstanceID(), entityFuncType, entity.entityID);
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 生成 {1}", entity.entityID, entity.mainGameObject.GetInstanceID());
            DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} 生成 {1}", entity.mainGameObject.GetInstanceID(), entity.entityID);

            EntityManager.GetInstance().AddToEntityMovables(entity);
            if (entity.anim == null)
            {
                entity.anim = new SimpleAnimation();
            }

            entity.anim.Init(entity.mainGameObject);
            if (entity.followPath == null)
            {
                //entity.followPath = new FollowPath();
                entity.followPath = new FollowPathRightAngles();
            }

            //从表里取速度
            entity.moveSpeed = Config.globalConfig.getInstace().ZooCarSpeed;

            //从表里取路径
            string pathName = "";

            switch (entityFuncType)
            {
            case EntityFuncType.VisitorCar_EnterZoo:
                pathName = globalConfig.getInstace().NaturalVisitorInto;
                break;

            case EntityFuncType.VisitorCar_LeaveZoo:
                pathName = globalConfig.getInstace().NaturalVisitorOut_2;
                break;

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

            var path = PathManager.GetInstance().GetPath(pathName);

            entity.position = path[0];
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 移动位置到路径起点{1}, pos {2}", entity.entityID, entity.mainGameObject.GetInstanceID(), path[0]);
            DebugFile.GetInstance().WriteKeyFile(entity.mainGameObject.GetInstanceID(), "{0} 移动位置到路径起点{1}, pos {2}", entity.mainGameObject.GetInstanceID(), entity.entityID, path[0]);

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} 沿着路径{1}出发", entity.entityID, pathName);
            //entity.followPath.Init(entity, path.ToArray(), path[0], 0, entity.moveSpeed, false);
            entity.followPath.Init(entity, pathName, path, path[0], 0, entity.moveSpeed);
            entity.Active();
        }
        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);
            }
        }
 public void Init(int entityID, EntityFuncType entityFuncType)
 {
     this.entityID       = entityID;
     this.entityFuncType = entityFuncType;
 }