コード例 #1
0
        protected void OnWanderArrived(Message msg)
        {
            var _msg = msg as WanderArrived;

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

            //LogWarp.Log(UnityEngine.Time.realtimeSinceStartup + " OnWanderArrived ");
            pathWander.Stop();
            //wander.Stop();
            anim.Stop();
            //停止, 开始随机获取除了walking之外的两个动画之一,播放,
            string randomName = GlobalDataManager.GetInstance().animalAnimation.GetRandomName();

            anim.Play(randomName);

            isPlayWalk = false;
            //计时准备
            isStopWander = true;
            stopWanderAm = 0;
            if (anim == null || string.IsNullOrEmpty(randomName))
            {
#if UNITY_EDITOR
                //LogWarp.LogErrorFormat("注意:动画名字为空: name= "+ anim.lastAnimName+ "   动物本身为空或未随机到动物动画名字  randomName");
                string e = string.Format("注意:动画名字为空: name= " + anim.lastAnimName + "   动物本身为空或未随机到动物动画名字  randomName");
                throw new System.Exception(e);
#endif
            }
            stopWanderMS = Math_F.FloatToInt1000(anim.GetClipLength(randomName));
        }
コード例 #2
0
ファイル: Wander.cs プロジェクト: GITHUB243884919/CrossRoad
        public override void Tick(int deltaTimeMS)
        {
            if (!CouldRun())
            {
                return;
            }


            if (Math_F.Approximate3D(this.ownerEntity.position, this.tarPos) || IsPassed(this.tarPos))
            {
                //this.tarPos = Math_F.RandomInsideCircle(this.orgPos, this.radius);
                WanderArrived.Send(this.ownerEntity.entityID);
                return;
            }

            this.tickDir = Math_F.TwoPositionDir(this.ownerEntity.position, this.tarPos);

            ////活动移动量
            this.tickSpeed = this.speed * deltaTimeMS * 0.001f;
            //活动移动量
            this.tickMove = this.tickDir * this.tickSpeed;

            ////新位置
            this.ownerEntity.position += tickMove;
        }
コード例 #3
0
        public Config.npcactionCell PlayActionAnim()
        {
            int idx = Const.Invalid_Int;

            Math_F.TableProbability(animWeight, ref idx);
#if UNITY_EDITOR
            if (idx == Const.Invalid_Int)
            {
                string e = string.Format("随机动画异常{0}", mainGameObject.name);
                throw new System.Exception(e);
            }
#endif
            //var cell = Config.npcactionConfig.getInstace().getCell(idx);
            var cell = GlobalDataManager.GetInstance().logicTableVisitorAction.actionList[idx];
#if UNITY_EDITOR
            if (cell == null)
            {
                string e = string.Format("随机动画异常{0}, {1}", mainGameObject.name, idx);
                throw new System.Exception(e);
            }
#endif
            anim.Play(cell.actionname);
            DebugFile.GetInstance().WriteKeyFile(entityID, "{0} PlayAnim {1}", entityID, cell.actionname);

            return(cell);
        }
コード例 #4
0
        public virtual void OnUpdate_NormalPlus()
        {
            if (dragType != DragType.NormalPlus || !CouldDrag())
            {
                return;
            }

            int deltaMS = Math_F.FloatToInt1000(Time.deltaTime);

            DragSmoothCD.Tick(deltaMS);
            if (!DragSmoothCD.IsFinish() && DragSmoothCD.IsRunning())
            {
                //LogWarp.LogErrorFormat("{0} OnUpdate_NormalPlus", Time.realtimeSinceStartup);
                //MessageString.Send((int)UFrameBuildinMessage.CameraDebug, Time.realtimeSinceStartup + " OnUpdate_NormalPlus");
                //滑动减速
                var deltaMove2D = dragSmoothDir * (float)DragSmoothCD.cd / (float)DragSmoothCD.org;
                dragMoveTo2D.x = cacheTrans.position.x + deltaMove2D.x;
                dragMoveTo2D.y = cacheTrans.position.z + deltaMove2D.y;
                if (CouldMoveTo(dragMoveTo2D))
                {
                    dragMoveTo.x        = cacheTrans.position.x + deltaMove2D.x;
                    dragMoveTo.z        = cacheTrans.position.z + deltaMove2D.y;
                    cacheTrans.position = dragMoveTo;
                }
            }
        }
コード例 #5
0
ファイル: Wander.cs プロジェクト: GITHUB243884919/CrossRoad
 public override void Run()
 {
     base.Run();
     this.tarPos = Math_F.RandomInsideCircle(this.orgPos, this.radius);
     this.ownerEntity.LookAt(this.tarPos);
     //LogWarp.LogFormat("Run tarPos {0}", tarPos);
 }
コード例 #6
0
    /// <summary>
    /// 设置增益buff的倒计时功能
    /// </summary>
    protected void SetCountDownShow_Double(int deltaTimeMS)
    {
        var    buffList = GlobalDataManager.GetInstance().playerData.playerZoo.buffList;
        string time_str = "00:00:00";

        for (int i = 0; i < buffList.Count; i++)
        {
            if (buffList[i].buffID == 14)
            {
                double time = buffList[i].CD.cd;
                advertButton_Time.text = Math_F.OnDounbleToFormatTime_Anhour((int)time);;
                return;
            }
            else
            {
                if (i == buffList.Count - 1)
                {
                    advertButton_Time.text = time_str;
                }
            }
        }
        if (buffList.Count == 0)
        {
            advertButton_Time.text = time_str;
        }
    }
コード例 #7
0
        public void Update()
        {
            int deltaMS = Math_F.FloatToInt1000(Time.deltaTime);

            fsmLoad.Tick(deltaMS);
            gameModules.Tick(deltaMS);
        }
コード例 #8
0
        protected void InitExitGateData()
        {
#if DEBUG_VISIT
            int entryNum     = GetEntryNum(2000);
            int checkInCDVal = GetChinkinCDValMs(2000);
#else
            int entryNum     = GetEntryNum();
            int checkInCDVal = GetChinkinCDValMs();
#endif

            var sortExitGateIDs = GlobalDataManager.GetInstance().logicTableExitGate.sortExitGateIDs;
            int exitGateID      = Const.Invalid_Int;

            for (int i = 0; i < entryNum; i++)
            {
                exitGateID = sortExitGateIDs[i];
                var cell     = Config.exitgateConfig.getInstace().getCell(exitGateID);
                var exitGate = new ExitGate(exitGateID, checkInCDVal, cell.positiveexitgate, cell.positiveexitgate, cell.maxnumofperqueue);

                exitGates.Add(exitGateID, exitGate);
            }

            shuttleVisitorQueue.Clear();
            //maxShuttleVisitorQueue = ExitGateModule.GetMaxShuttleVisitor();
            maxShuttleInterval      = Math_F.FloatToInt1000(Config.globalConfig.getInstace().MaxShuttleInterval);
            shuttleaccumulativeTime = 0;
            shuttleVisitorList.Clear();
        }
コード例 #9
0
        public override void Enter(int preStateName)
        {
            base.Enter(preStateName);

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

            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} StateShuttleGotoCalcPath.Enter", entity.entityID);
            DebugFile.GetInstance().MarkGameObject(entity.mainGameObject, "Shuttle_{0}_{1}_{2}", entity.entityID, (ShuttleState)this.preStateName, (ShuttleState)this.stateName);

            isToStateShuttleGobackCalcPath = false;
            getOffAccumulativeTime         = 0;
            lastVisitorIdx = 0;
            isGetOff       = false;
            shuttleVisitorGetOffInterval = Math_F.FloatToInt1000(Config.globalConfig.getInstace().ShuttleVisitorGetOffInterval);

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

            //var cfgPath = PathManager.GetInstance().GetPath(Config.globalConfig.getInstace().Path_ShuttleGotoStatuc);
            //var pathList = new List<Vector3>();
            //pathList.Add(entity.position);
            //pathList.AddRange(cfgPath);
            //entity.followPath.Init(entity, pathList.ToArray(), pathList[0], 0, entity.moveSpeed, false);
            //entity.followPath.Run();


            var cfgPathGoback = PathManager.GetInstance().GetPath(Config.globalConfig.getInstace().Path_ShuttleGobackStatic);

            entity.pathList.Clear();
            //var pathList = new List<Vector3>();
            entity.pathList.Add(entity.position);
            entity.pathList.Add(cfgPathGoback[0]);
            entity.followPath.Init(entity, entity.pathList, entity.pathList[0], 0, entity.moveSpeed, false);
            entity.followPath.Run();
        }
コード例 #10
0
 public bool IsArrivedTarget(Vector3 target)
 {
     if (Math_F.Approximate3D(this.ownerEntity.position, target) || this.IsPassed(target))
     {
         return(true);
     }
     return(false);
 }
コード例 #11
0
        /// <summary>
        /// 根据速度计算旋转角速度。
        /// 速度可以看成是以控制点为中心,半径为specialOffset的圆上的上两个点的距离。
        /// 这样可以根据余弦定理可以求角
        /// speed最好带入毫秒单位,否则Acos会出现NaN值
        /// 准确的说,应该确保2 * this.specialOffset * this.specialOffset > speed * speed
        /// 以毫秒单位的speed不能超过圆的直径,否则构不成三角形
        /// 也就是cos为[0, 1]
        /// </summary>
        /// <param name="speed"></param>
        /// <returns></returns>
        float CalcTurnSpeed(float speed)
        {
            //cos(A) = (b^b + c^c - a^a) / 2bc
            float cos = (2 * this.turnOffset * this.turnOffset - speed * speed) / (2 * this.turnOffset * this.turnOffset);
            float rad = Mathf.Acos(cos);

            return(turnSpeed = Math_F.RadianToAngle(rad));
        }
コード例 #12
0
ファイル: Wander.cs プロジェクト: GITHUB243884919/CrossRoad
 public void Init(EntityMovable ownerEntity, Vector3 orgPos, float radius, float speed)
 {
     this.ownerEntity = ownerEntity;
     this.orgPos      = orgPos;
     this.radius      = radius;
     this.speed       = speed;
     this.tarPos      = Math_F.RandomInsideCircle(this.orgPos, this.radius);
 }
コード例 #13
0
 /// <summary>
 /// 秒售票CD倒计时
 /// </summary>
 /// <param name="isTime"></param>
 protected void TimeFormatCalculate_Ticket(double isTime)
 {
     celerityTicket.Find("Text").GetComponent <Text>().text = Math_F.OnDounbleToFormatTime_Minute((int)isTime);
     if (isTime <= 1)
     {
         celerityTicket.gameObject.SetActive(false);
     }
 }
コード例 #14
0
        //public void Start()
        //{
        //    Init();
        //}

        public void Update()
        {
            int deltaMS = Math_F.FloatToInt1000(Time.deltaTime);

            MessageManager.GetInstance().Tick();
            fsmLoad.Tick(deltaMS);
            gameModules.Tick(deltaMS);
        }
コード例 #15
0
        protected void OnLittleZooDataReply(Message msg)
        {
            var _msg   = msg as LittleZooDataReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            //LogWarp.LogErrorFormat("{0}, {1}", _msg != null, entity != null);
            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            int cdVal      = _msg.littleZoo.visitCDValue;
            var playerData = GlobalDataManager.GetInstance().playerData;

            if (playerData.playerZoo.buffVisitCDVal != UFrame.Const.Invalid_Float)
            {
                int buffVisitCDVal = Math_F.FloatToInt1000(playerData.playerZoo.buffVisitCDVal);
                cdVal = Mathf.Min(cdVal, buffVisitCDVal);
            }

            if (visitCD == null)
            {
                visitCD = new IntCD(cdVal);
            }
            else
            {
                visitCD.ResetOrg(cdVal);
            }
            if (!GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                GetSceneUIGameObject();
            }

            visitCD.Run();
            isRevCDVal = true;

            //cd时间太短就执行idle
            if (cdVal < Math_F.FloatToInt1000(Config.globalConfig.getInstace().VisitorMinAnimLen))
            {
                entity.PlayActionAnim(Config.globalConfig.getInstace().VisitorIdle);
                return;
            }
            var cell = entity.PlayActionAnim();

            if (cell.effectresid > 0)
            {
                effID = cell.effectresid;
                var pool = PoolManager.GetInstance().GetGameObjectPool(effID);
                effGo    = pool.New();
                effTrans = effGo.transform;
                effTrans.SetParent(GlobalDataManager.GetInstance().zooGameSceneData.littleZooParentNode, false);
                effPos            = entity.position;
                effPos.y          = cell.effectY;
                effTrans.position = effPos;
                effTrans.rotation = entity.rotation;
            }
        }
コード例 #16
0
        public override bool CouldMoveTo(Vector2 moveTo)
        {
            if (LoadingMgr.Inst.runTimeLoaderType == RunTimeLoaderType.Editor)
            {
                return(base.CouldMoveTo(moveTo));
            }

            return(Math_F.IsPointInPolygon(moveTo, cameraArea));
        }
コード例 #17
0
    private void SetCountDownShow_CrossRoad(int deltaTimeMS)
    {
        var countDownTicks = playerData.playerLittleGame.intCD;

        //LogWarp.LogErrorFormat("小游戏倒计时    {0}     ", (int)(countDownTicks.cd / 1000));
        if (countDownTicks != null)
        {
            strength_Time.text = Math_F.OnDounbleToFormatTime_Anhour((int)(countDownTicks.cd / 1000));
        }
    }
コード例 #18
0
        protected void Follow(int deltaTimeMS)
        {
            if (!Math_F.Approximate3D(this.ownerEntity.position, this.nextPos) && !this.IsPassed(this.nextPos))
            {
                this.UnArrived(deltaTimeMS);
                return;
            }

            this.Arrived();
        }
コード例 #19
0
 protected virtual void UnArrived(int deltaTimeMS, Vector3 target)
 {
     //向目的地走
     this.tickDir = Math_F.TwoPositionDir(this.ownerEntity.position, target);
     //活动移动量
     this.tickSpeed = this.speed * deltaTimeMS;
     this.tickMove  = this.tickDir * this.tickSpeed;
     //新位置
     this.ownerEntity.position += this.tickMove;
 }
コード例 #20
0
        /// <summary>
        /// 轮船开过来,下指定数量的游客
        /// </summary>
        /// <param name="maxSpawnVisitorNum"></param>
        public static void GetoffVisitor(int maxSpawnVisitorNum)
        {
            LogWarp.LogError("GetoffVisitor");
            EntityShip entity;

            int sceneID       = GlobalDataManager.GetInstance().playerData.playerZoo.currSceneID;
            int visitorpathID = Config.sceneConfig.getInstace().getCell(sceneID).visitorpath;

            Config.sceneaddvisitorCell sceneaddvisitorCell = Config.sceneaddvisitorConfig.getInstace().getCell(visitorpathID);

            switch (visitorpathID)
            {
            case 0:
                entity = EntityManager.GetInstance().GetRandomEntity(ResType.Ship, EntityFuncType.Ship) as EntityShip;
                break;

            case 1:
                entity = EntityManager.GetInstance().GetRandomEntity(ResType.Train, EntityFuncType.Train) as EntityShip;
                break;

            default:
                entity = EntityManager.GetInstance().GetRandomEntity(ResType.Ship, EntityFuncType.Ship) as EntityShip;
                break;
            }

            EntityManager.GetInstance().AddToEntityMovables(entity);
            if (entity.followPath == null)
            {
                entity.followPath = new FollowPath();
            }
            entity.moveSpeed = sceneaddvisitorCell.movespeed;
            var path = PathManager.GetInstance().GetPath(sceneaddvisitorCell.intopath);

            entity.position = path[0];
            entity.followPath.Init(entity, path, path[0], 0, entity.moveSpeed, false);
            entity.maxSpawnVisitorNum    = maxSpawnVisitorNum;
            entity.visitorGetOffInterval = Math_F.FloatToInt1000(Config.globalConfig.getInstace().ShipVisitorGetOffInterval);
            if (entity.fsmMachine == null)
            {
                entity.fsmMachine = new FSMMachineShip(entity);

                entity.fsmMachine.AddState(new StateShipGoto((int)ShipState.Goto,
                                                             entity.fsmMachine));
                entity.fsmMachine.AddState(new StateShipGoback((int)ShipState.Goback,
                                                               entity.fsmMachine));

                entity.fsmMachine.SetDefaultState((int)ShipState.Goto);
            }
            else
            {
                entity.fsmMachine.GotoState((int)ShipState.Goto);
            }
            entity.Active();
        }
コード例 #21
0
        protected void UnArrived(int deltaTimeMS)
        {
            //向目的地走
            this.tickDir = Math_F.TwoPositionDir(this.ownerEntity.position, this.nextPos);

            //活动移动量
            this.tickSpeed = this.speed * deltaTimeMS * 0.001f;
            this.tickMove  = this.tickDir * this.tickSpeed;

            //新位置
            this.ownerEntity.position += this.tickMove;
        }
コード例 #22
0
        /// <summary>
        /// 直接转,相当于LookAt基本不用。
        /// </summary>
        /// <param name="target"></param>
        protected void TurnTo(Vector3 target)
        {
            var   dirWorld = target - this.ownerEntity.position;
            float angle    = Math_F.TwoDirYAngle(this.ownerEntity.forward, dirWorld.normalized);

            if (Vector3.Cross(dirWorld, this.ownerEntity.forward).y >= 0)
            {
                this.ownerEntity.Rotate(new Vector3(0, -angle, 0), Space.Self);
                return;
            }

            this.ownerEntity.Rotate(new Vector3(0, angle, 0), Space.Self);
        }
コード例 #23
0
        /// <summary>
        /// CD递减
        /// </summary>
        /// <param name="deltaTimeMS"></param>
        public override void Tick(int deltaTimeMS)
        {
            if (!isRecvCDVal)
            {
                return;
            }
            if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                if (visitCDGameObject == null)
                {
                    GetSceneUIGameObject();
                }
            }
            checkInCD.Tick(deltaTimeMS);  // cd时间递减
#if UNITY_EDITOR && !NOVICEGUIDE
            if (visitCDGameObject == null)
            {
                string e = string.Format("visitCDGameObject == null");
                throw new System.Exception(e);
                //GetSceneUIGameObject();
            }
#endif
            accumulativeUpdateUITime += deltaTimeMS;
            if (!checkInCD.IsFinish() && accumulativeUpdateUITime >= maxUpdateUIDuration)
            {
                image_VisitCD.fillAmount = 1 - (float)checkInCD.cd / checkInCD.org;
                accumulativeUpdateUITime = 0;
            }

            if (!checkInCD.IsFinish() && this.shouldImmediateFinishEntryGateCheckInCD)
            {
                checkInCD.cd             = Math_F.FloatToInt1000(playerData.playerZoo.buffEntryGateCDVal);
                image_VisitCD.fillAmount = 1 - (float)checkInCD.cd / checkInCD.org;
                shouldImmediateFinishEntryGateCheckInCD = false;
            }

            //cd自己结束或者收到秒cd
            if (checkInCD.IsRunning() && checkInCD.IsFinish())
            {
                image_VisitCD.fillAmount             = 0;
                visitCDGameObject.transform.position = UFrame.Const.Invisible_Postion;
                //只有最新解锁的场景动物栏和大门产钱
                if (playerData.playerZoo.currSceneID == playerData.playerZoo.lastUnLockSceneID)
                {
                    GetFlutterTextGameObject();
                }
                checkInCD.Stop();
                WhenCDFinished();
            }
        }
コード例 #24
0
        protected void OnGetEntryGateDataReply(Message msg)
        {
            var _msg   = msg as GetEntryGateDataReply;
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;

            //LogWarp.LogErrorFormat("{0}, {1}", _msg != null, entity != null);
            if (_msg.entityID != entity.entityID)
            {
                return;
            }

            int cdVal = _msg.entryGate.checkInCDVal;

#if UNITY_EDITOR
            if (cdVal <= 0)
            {
                string e = string.Format("cdVal = {0}", cdVal);
                throw new System.Exception(e);
            }
#endif
            var playerData = GlobalDataManager.GetInstance().playerData;
            if (playerData.playerZoo.buffEntryGateCDVal != UFrame.Const.Invalid_Float)
            {
                int buffCD = Math_F.FloatToInt1000(playerData.playerZoo.buffEntryGateCDVal);
                cdVal = Mathf.Min(cdVal, buffCD);
            }

            if (checkInCD == null)
            {
                checkInCD = new IntCD(cdVal);
            }
            else
            {
                checkInCD.ResetOrg(cdVal);
            }

            if (!GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                GetSceneUIGameObject();
            }

            checkInCD.Run();

            isRecvCDVal = true;
        }
コード例 #25
0
        public override void Tick(int deltaTimeMS)
        {
            if (!isRevCDVal)
            {
                return;
            }

            visitCD.Tick(deltaTimeMS);  // cd时间递减

            if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                if (visitCDGameObject == null)
                {
                    GetSceneUIGameObject();
                }
            }

            if (!visitCD.IsFinish())
            {
                image_VisitCD.fillAmount = 1 - (float)visitCD.cd / visitCD.org;
            }

            if (!visitCD.IsFinish() && shouldImmediateFinishVisitCD)
            {
                visitCD.cd = Math_F.FloatToInt1000(playerData.playerZoo.buffVisitCDVal);
                image_VisitCD.fillAmount     = 1 - (float)visitCD.cd / visitCD.org;
                shouldImmediateFinishVisitCD = false;
            }

            //cd结束腾出观光位
            //是再次进入选动物栏状态,还是已经到最后一组准备离开
            if (visitCD.IsRunning() && visitCD.IsFinish())
            {
                image_VisitCD.fillAmount             = 0;
                visitCDGameObject.transform.position = UFrame.Const.Invisible_Postion;
                //只有最新解锁的场景动物栏和大门产钱
                if (playerData.playerZoo.currSceneID == playerData.playerZoo.lastUnLockSceneID)
                {
                    GetFlutterTextGameObject();
                }

                visitCD.Stop();
                WhenVisitCDFinished();
            }
        }
コード例 #26
0
        protected void WhenExtendScene(int groupID)
        {
            LogWarp.LogFormat("camera {0}", GetLoadGroup());
            if (LoadingMgr.Inst.runTimeLoaderType == RunTimeLoaderType.Game)
            {
                var cell = Config.groupConfig.getInstace().getCell(groupID);
                //gameCamLeftUpPos.x -= Config.globalConfig.getInstace().ZooPartResLen;
                gameCamLeftUpPos.x -= cell.groundsize;
                //gameCamRightUpPos.x -= Config.globalConfig.getInstace().ZooPartResLen;
                gameCamRightUpPos.x -= cell.groundsize;
            }

            cameraArea.Clear();
            cameraArea.Add(Math_F.Vector3_2D(editorCamLeftDownPos));
            cameraArea.Add(Math_F.Vector3_2D(gameCamLeftUpPos));
            cameraArea.Add(Math_F.Vector3_2D(gameCamRightUpPos));
            cameraArea.Add(Math_F.Vector3_2D(editorCamRightDownPos));
        }
        protected void RunCheckInCD()
        {
            int cdVal      = ExitGateModule.GetChinkinCDValMs();
            var playerData = GlobalDataManager.GetInstance().playerData;

            if (playerData.playerZoo.buffExitEntryCDVal != UFrame.Const.Invalid_Float)
            {
                int buffExitEntryCDValMS = Math_F.FloatToInt1000(playerData.playerZoo.buffExitEntryCDVal);
                cdVal = Mathf.Min(cdVal, buffExitEntryCDValMS);
            }
            checkInCD.ResetOrg(cdVal);
            checkInCD.Run();
#if UNITY_EDITOR
            var entity = (this.fsmCtr as FSMMachineVisitor).ownerEntity;
            LogWarp.LogFormat("{0} RunCheckInCD cdVal={1}", entity.entityID, cdVal);
            DebugFile.GetInstance().WriteKeyFile(entity.entityID, "{0} RunCheckInCD cdVal={1}", entity.entityID, cdVal);
#endif
        }
コード例 #28
0
        public override void Tick(int deltaTimeMS)
        {
            if (!this.CouldActive())
            {
                return;
            }
            if (Math_F.Approximate3D(position, endPos) ||
                this.IsPassed(endPos)
                )
            {
                //到达终点
                //重要:回收前先把Collider设置成false,避免在pool中触发碰撞
                GetTrans().Find("Collider").gameObject.SetActive(false);
                CrossRoadModelManager.GetInstance().entityModel.RemoveFromEntityMovables(this);

                return;
            }

            Tick_Move(deltaTimeMS);
        }
コード例 #29
0
        public virtual void Init(EntityMovable ownerEntity, int groupID, int idx, List <Vector3> pathPosList, Vector3 orgPos, int nextPosIdx, float speed)
        {
            if (this.IsRunning())
            {
                string e = string.Format("{0} {1} FollowPathRightAngles非法初始化", ownerEntity.entityID, ownerEntity.mainGameObject.GetInstanceID());
                throw new System.Exception(e);
            }

            this.ownerEntity  = ownerEntity;
            this.pathPosList  = pathPosList;
            this.orgPos       = orgPos;
            this.nextPosIdx   = nextPosIdx;
            this.nextPos      = this.pathPosList[this.nextPosIdx];
            this.speed        = speed * 0.001f;
            this.orgRotation  = this.ownerEntity.mainGameObject.transform.rotation;
            this.isArrivedEnd = false;

            idxCtr = 0;
            //停止旋转CD
            turnCD.Stop();
            this.turnSpeed = CalcTurnSpeed(this.speed);
            //因为知道角度是90度所以cd是旋转cd恒定的
            turnCDVal = Math_F.FloatToInt(cornerAngle / this.turnSpeed);

            var pathUnit = GroundParingSpacePathManager.GetInstance().GetPathUnit(groupID, idx);

            if (!GroundParingSpacePathManager.IsExist(pathUnit.inPathRac))
            {
                ctrList = GroundParingSpacePathManager.GenRAC(pathPosList, this.turnOffset);
                GroundParingSpacePathManager.GetInstance().AddPath(
                    GroundParingSpacePathType.InPathRac, pathUnit, null, ctrList);
            }
            ctrList      = pathUnit.inPathRac;
            this.groupID = groupID;
            this.idx     = idx;

            isForward = true;
            //先把朝向转到第一个后点
            ownerEntity.LookAt(ctrList[0].backPos);
        }
コード例 #30
0
        protected void OnLoadZooSceneFinished(Message msg)
        {
            cacheTrans  = FingerCamera.GetInstance().cacheTrans;
            cacheCam    = FingerCamera.GetInstance().cacheCam;
            crossPoint  = FingerCamera.GetInstance().crossPoint;
            tryPoint    = FingerCamera.GetInstance().tryPoint;
            moveToPoint = FingerCamera.GetInstance().moveToPoint;


            this.cacheTrans.position = editorInitPos;
            //FingerCamera.GetInstance().cacheTrans.position = editorInitPos;
            this.cacheCam.orthographicSize = this.maxOrthographicSize;
            //FingerCamera.GetInstance().cacheCam.orthographicSize = this.maxOrthographicSize;
            dragMoveTo = cacheTrans.position;

            LogWarp.LogFormat("camera {0}", GetLoadGroup());
            if (LoadingMgr.Inst.runTimeLoaderType == RunTimeLoaderType.Game)
            {
                offset = (Config.globalConfig.getInstace().InitMaxGroupNum - GetLoadGroup()) * Config.globalConfig.getInstace().ZooPartResLen;

                gameCamLeftUpPos    = editorCamLeftUpPos;
                gameCamLeftUpPos.x += offset;

                gameCamRightUpPos    = editorCamRightUpPos;
                gameCamRightUpPos.x += offset;
            }

            cameraArea.Clear();
            cameraArea.Add(Math_F.Vector3_2D(editorCamLeftDownPos));
            cameraArea.Add(Math_F.Vector3_2D(gameCamLeftUpPos));
            cameraArea.Add(Math_F.Vector3_2D(gameCamRightUpPos));
            cameraArea.Add(Math_F.Vector3_2D(editorCamRightDownPos));

#if UNITY_EDITOR
            SetRange();
#else
            GameObject.Find("camer_range").SetActive(false);
#endif
        }