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;
            }
        }
        protected virtual void Follow(int deltaTimeMS)
        {
            //是否到后点
            //到达后点, 开始启动旋转,位移转按角速度求出的位置
            //未到达后点往后点继续前进
            if (turnCD.IsRunning() || !turnCD.IsFinish())
            {
                return;
            }

            //还没到最后一个转弯点
#if UNITY_EDITOR
            if (ctrList == null)
            {
                string e = string.Format("{0} 路径异常", this.ownerEntity.entityID);
                throw new System.Exception(e);
            }
#endif
            if (idxCtr < ctrList.Count)
            {
                var ctr = ctrList[idxCtr];
                if (!IsArrivedTarget(ctr.backPos))
                {
                    UnArrived(deltaTimeMS, ctr.backPos);
                    return;
                }

                //重新设置旋转CD
                turnCD.ResetOrg(turnCDVal);
                turnCD.Run();
                return;
            }

            //到这里已经转过最后一个弯了
            var lastPos = pathPosList[pathPosList.Count - 1];
            if (!IsArrivedTarget(lastPos))
            {
                UnArrived(deltaTimeMS, lastPos);
                return;
            }

            //走到这里已经到达路径最后一个点,走完全部path
            WhenArrivedEndPos();

            this.isArrivedEnd = true;
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        void OnDrag_NormalPlus(DragGesture gesture)
        {
            if (gesture.State == GestureRecognitionState.InProgress && CouldDrag())
            {
                //LogWarp.LogErrorFormat("{0} OnDrag_NormalPlus", Time.realtimeSinceStartup);
                //MessageString.Send((int)UFrameBuildinMessage.CameraDebug, Time.realtimeSinceStartup + " OnDrag_NormalPlus");
                if (gesture.DeltaMove.SqrMagnitude() > 0)
                {
                    Vector2 screenSpaceMove = dragSensitivity * gesture.DeltaMove;
                    Vector3 worldSpaceMove  = screenSpaceMove.x * cacheTrans.right + screenSpaceMove.y * cacheTrans.up;

                    dragMoveTo.x -= worldSpaceMove.x;
                    dragMoveTo.z -= worldSpaceMove.z;

                    dragSmoothDir.x = -worldSpaceMove.x;
                    dragSmoothDir.y = -worldSpaceMove.z;

                    dragMoveTo2D.x = dragMoveTo.x;
                    dragMoveTo2D.y = dragMoveTo.z;
                    if (CouldMoveTo(dragMoveTo2D))
                    {
                        cacheTrans.position = dragMoveTo;
#if UNITY_EDITOR
                        moveToPoint.position = dragMoveTo;
                        //LogWarp.LogErrorFormat("{0} CouldMoveTo moveToPoint {1}", Time.realtimeSinceStartup, dragMoveTo);
#endif
                    }
                    else
                    {
                        WhenCannotMoveTo(dragMoveTo2D);
                    }

                    DragSmoothCD.Stop();
                }
            }
            else if (gesture.State == GestureRecognitionState.Started && CouldDrag())
            {
                DragSmoothCD.Stop();
            }
            else if (gesture.State == GestureRecognitionState.Ended && CouldDrag())
            {
                DragSmoothCD.ResetOrg(dragSmoothDurationMS);
                DragSmoothCD.Run();
            }
        }
        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
        }