public void SetFree()
        {
#if UNITY_EDITOR
            if (parkingCar == null)
            {
                string e = string.Format("SetFree 时上面没车 groupID={0}, idx={1}", groupID, idx);
                throw new System.Exception(e);
            }
#endif
            spaceState = ParkingSpaceState.Free;
            parkingCar = null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 延时,新手引导阶段的相机跟随赋值
        /// </summary>
        private void DelayedOperationNewbieGuideStage(EntityGroundParkingCar entity)
        {
            float timeCount = 0.1f;

            DOTween.To(() => timeCount, a => timeCount = a, 0.1f, 0.1f).OnComplete(new TweenCallback(delegate
            {
                UIGuidePage uIGuidePage = PageMgr.GetPage <UIGuidePage>();
                if (uIGuidePage == null)
                {
                    string e = string.Format("新手引导界面  PageMgr.allPages里 UIGuidePage   为空");
                    throw new System.Exception(e);
                }
                if (uIGuidePage.newBieGuild_step < NewBieGuild.Step_2 && uIGuidePage.number == 0)
                {
                    uIGuidePage.entity = entity;
                }
            }));
        }
Exemplo n.º 3
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);
            }
        }
 public void SetBeLocked(EntityGroundParkingCar car)
 {
     parkingCar = car;
     spaceState = ParkingSpaceState.BeLocked;
 }