Beispiel #1
0
 void IPeMsg.OnMsg(EMsg msg, params object[] args)
 {
     switch (msg)
     {
     case EMsg.View_Prefab_Build:
         BiologyViewCmpt obj = args[0] as BiologyViewCmpt;
         m_Sleep.m_PhyCtrl = obj.monoPhyCtrl;
         break;
     }
 }
    /// <summary>
    /// Takes the photo of the PeEnity.
    /// </summary>
    /// <returns>The photo.</returns>
    /// <param name="viewCmpt">View cmpt of the PeEntity.</param>
    /// <param name="width">Width.</param>
    /// <param name="height">Height.</param>
    /// <param name="local_pos">reletive position of target.</param>
    /// <param name="local_rot">local rotation.</param>
    public static Texture2D TakePhoto(Pathea.BiologyViewCmpt viewCmpt, int width, int height, Vector3 local_pos, Quaternion local_rot)
    {
        GameObject cloneGo = CloneCharacterViewModel(viewCmpt, true);

        if (cloneGo == null)
        {
            return(null);
        }
        return(DoTakePhoto(cloneGo, width, height, local_pos, local_rot));
    }
 void CreateRagdollGameObject()
 {
     Pathea.BiologyViewCmpt view = GetComponentInParent <Pathea.BiologyViewCmpt>();
     if (view != null && view.monoRagdollCtrlr != null)
     {
         Transform tr = PETools.PEUtil.GetChild(view.monoRagdollCtrlr.transform, name);
         if (tr != null)
         {
             GameObject go = new GameObject("Skinned_Copy");
             go.transform.parent = tr.parent;
         }
     }
 }
Beispiel #4
0
        public override void Start()
        {
            base.Start();

            m_MoveState   = new List <Vector3> (MoveRecordCount);
            m_MoveRequest = new List <Vector3> (MoveRequestCount);

            gMainPlayer = this;
            gameObject.AddComponent <Scanner> ();
            mMove      = Entity.GetCmpt <Motion_Move_Human> ();
            mEquip     = Entity.motionEquipment;
            mView      = Entity.biologyViewCmpt;
            mTrans     = Entity.peTrans;
            mIK        = Entity.GetCmpt <IKCmpt> ();
            m_Skill    = Entity.aliveEntity;
            mPackage   = Entity.GetCmpt <PackageCmpt> ();
            mPassenger = Entity.passengerCmpt;
            mMotionMgr = Entity.motionMgr;
            mMotionMgr.onActionStart += OnActionStart;
            mMotionMgr.onActionEnd   += OnActionEnd;
            m_Abnormalcmpt            = Entity.Alnormal;

            if (null != m_Abnormalcmpt)
            {
                m_Abnormalcmpt.evtStart += OnStartAbnormal;
                m_Abnormalcmpt.evtEnd   += OnEndAbnormal;
            }

            if (null != m_Skill)
            {
                m_Skill.onHpReduce     += OnDamage;
                m_Skill.attackEvent    += OnAttack;
                m_Skill.deathEvent     += OnDeath;
                m_Skill.onSkillEvent   += OnSkillTarget;
                m_Skill.onWeaponAttack += OnWeaponAttack;

                m_Skill.OnBeEnemyEnter += OnBeEnemyEnter;
            }

            if (!PeGameMgr.IsTutorial)
            {
                StartCoroutine(UpdateAbnormalNotice());
            }

            //历险模式下此时初始化声望系统,ForceSetting并未加载,会导致声望系统不能正常起作用
            //InitReputationSystem();
            Invoke("CheckAbnormalState", 5f);
        }
    /// <summary>
    /// Clones the character model useful.
    /// </summary>
    /// <returns>The character view model.</returns>
    /// <param name="viewCmpt">View cmpt.</param>
    public static GameObject CloneCharacterViewModel(Pathea.BiologyViewCmpt viewCmpt, bool takePhoto = false)
    {
        if (viewCmpt == null)
        {
            return(null);
        }
        GameObject viewGameObj = viewCmpt.CloneModel();

        if (viewGameObj == null)
        {
            return(null);
        }

        ResetCloneModel(viewGameObj, takePhoto);

        return(viewGameObj);
    }
Beispiel #6
0
        public override void Start()
        {
            base.Start();
            mSkEntity    = Entity.skEntity;
            mViewCmpt    = Entity.biologyViewCmpt;
            mNPC         = Entity.NpcCmpt;
            mMotionEquip = Entity.motionEquipment;
            if (null != m_InitItems && m_InitItems.Count > 0)
            {
                for (int i = 0; i < m_InitItems.Count; ++i)
                {
                    PutOnEquipment(m_InitItems[i]);
                }
                m_InitItems.Clear();
                Entity.lodCmpt.onConstruct += e => e.StartCoroutine(PreLoad());
            }
//			StartCoroutine(InitEquipment());
        }
        Texture TakePhoto()
        {
            BiologyViewCmpt v = Entity.biologyViewCmpt;

            if (v == null /*|| v.modelTrans == null*/) //lz-2016.07.23 PeViewStudio.TakePhoto 里面处理了没有模型的情况,这里不用返回
            {
                return(null);
            }

            CommonCmpt c = Entity.commonCmpt;

            if (c == null)
            {
                return(null);
            }

            return(PeViewStudio.TakePhoto(v, 64, 64, PeViewStudio.s_HeadPhotoPos, PeViewStudio.s_HeadPhotoRot));//PhotoStudio.Instance.TakePhoto(v.modelTrans.gameObject, (int)c.sex);
        }
Beispiel #8
0
        void CreateModel(ItemObject itemObj)
        {
            if (mViewCmpt == null)
            {
                mViewCmpt = Entity.biologyViewCmpt;
            }
            if (null == mViewCmpt.modelTrans)
            {
                return;
            }
            ItemAsset.Equip equip = itemObj.GetCmpt <ItemAsset.Equip>();

            if (null == equip)
            {
                return;
            }

            GameObject obj = equip.CreateGameObj();

            if (null == obj)
            {
                return;
            }

            PEEquipment equ = obj.GetComponent <PEEquipment>();

            if (null == equ)
            {
                Debug.LogError("Equip can't find:" + itemObj.nameText);
                GameObject.Destroy(obj);
                return;
            }

            //IgnoreCollision
//			PETools.PEUtil.IgnoreCollision(obj, gameObject);
            equ.InitEquipment(Entity, itemObj);
            mEquipments.Add(equ);
            HideEquipmentByFirstPerson(equ, m_HideEquipmentByFirstPerson);
            HideEquipmentByVehicle(equ, m_HideEquipmentByVehicle);
            HidEquipmentByRagdoll(equ, m_HideEquipmentByRagdoll);
            mMotionEquip.SetEquipment(equ, true);
            PreLoadEquipmentEffect(equ);
        }
        void ChangeAttackTarget()
        {
            m_AttackTargetDir = Vector3.zero;
            if (null != ikCmpt && null != trans)
            {
                Vector3 checkCenterPos = trans.position + m_AttackHeight * Vector3.up;

                if (firstPersonAttack)
                {
                    m_AttackTargetDir = Vector3.Normalize(ikCmpt.aimTargetPos - PETools.PEUtil.MainCamTransform.position);
                }
                else
                {
                    float           minDis     = 100f;
                    List <ViewCmpt> viewCmpts  = new List <ViewCmpt>();
                    Collider[]      findCols   = Physics.OverlapSphere(checkCenterPos, m_AttackChecRange, m_AttackLayer.value);
                    Vector3         attackDirH = m_AttackDir;
                    attackDirH.y = 0;
                    int selfPlayerID = Mathf.RoundToInt(motionMgr.Entity.GetAttribute(AttribType.DefaultPlayerID));
                    foreach (Collider col in findCols)
                    {
                        BiologyViewCmpt findView = col.GetComponentInParent <BiologyViewCmpt>();
                        if (null != findView && viewCmpt != findView && !viewCmpts.Contains(findView))
                        {
                            viewCmpts.Add(findView);
                            if (findView.IsRagdoll)
                            {
                                continue;
                            }
                            if (!ForceSetting.Instance.Conflict(selfPlayerID, Mathf.RoundToInt(findView.Entity.GetAttribute(AttribType.DefaultPlayerID))))
                            {
                                continue;
                            }

                            PEDefenceTrigger defencetrigger = col.GetComponent <PEDefenceTrigger>();
                            if (null == defencetrigger)
                            {
                                Transform centerTrans = findView.centerTransform;
                                Vector3   dir         = centerTrans.position - checkCenterPos;
                                float     dis         = dir.magnitude;
                                dir.y = 0;
                                if (null != centerTrans && dis < minDis && Vector3.Angle(dir, attackDirH) < m_LockMaxAngle)
                                {
                                    minDis            = dis;
                                    m_AttackTargetDir = Vector3.Normalize(centerTrans.position - checkCenterPos);
                                }
                            }
                            else
                            {
                                PECapsuleHitResult result;
                                if (defencetrigger.GetClosest(checkCenterPos, m_AttackChecRange, out result))
                                {
                                    Vector3 dir  = result.hitPos - checkCenterPos;
                                    float   dis  = dir.magnitude;
                                    Vector3 dirH = dir;
                                    dirH.y = 0;

                                    if (dis < minDis && Vector3.Angle(dirH, attackDirH) < m_LockMaxAngle)
                                    {
                                        float angle = Vector3.Angle(dir, attackDirH);
                                        if (angle < m_LockMaxAngle)
                                        {
                                            m_AttackTargetDir = dir.normalized;
                                        }
                                        else
                                        {
                                            m_AttackTargetDir = Vector3.Slerp(attackDirH.normalized, dir.normalized, m_LockMaxAngle / angle);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                ikCmpt.aimActive = Vector3.zero != m_AttackTargetDir;
                if (ikCmpt.aimActive && null != ikCmpt.m_IKAimCtrl)
                {
                    ikCmpt.m_IKAimCtrl.StartSyncAimAxie();
                }
            }
        }
 public override void Start()
 {
     base.Start();
     mView      = Entity.biologyViewCmpt;
     mMotionMgr = Entity.motionMgr;
 }
Beispiel #11
0
        public void OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.View_Prefab_Build:
                BiologyViewCmpt obj = args [0] as BiologyViewCmpt;
//				TestHitBack hitBack = obj.GetComponentInChildren<TestHitBack> ();
//				if (null != hitBack) {
//					hitBack.cam = Camera.main;
//					obj.transform.position += 1.3f * Vector3.up;
//				}
                m_PhyCtrl = obj.monoPhyCtrl;

                if (obj.monoModelCtrlr != null)
                {
                    _camTarget = obj.monoModelCtrlr.transform.Find("CamTarget");
                }
                if (obj.monoModelCtrlr != null)
                {
                    _bneckModel = obj.monoModelCtrlr.transform.Find("Bip01/Bip01 Pelvis/Bip01 Spine1/Bip01 Spine2/Bip01 Spine3/Bip01 Neck");
                }
                if (obj.monoRagdollCtrlr != null)
                {
                    _bneckRagdoll = obj.monoRagdollCtrlr.transform.Find("Bip01/Bip01 Pelvis/Bip01 Spine1/Bip01 Spine2/Bip01 Spine3/Bip01 Neck");
                }


                if (null != UILoadScenceEffect.Instance && UILoadScenceEffect.Instance.isInProgress)
                {
                    StartInvincible();
                }

                InitReputationSystem();
                Invoke("ResetFirstCtrl", 1f);
                break;

            //case EMsg.View_Model_Build:

            //    break;

            case EMsg.Camera_ChangeMode:
                PeCamera.cameraModeData = args [0] as CameraModeData;
                break;

            case EMsg.Battle_EnterShootMode:
                m_InShootMode = true;
                if (null != TestPEEntityCamCtrl.Instance && null != mView.modelTrans)
                {
                    TestPEEntityCamCtrl.Instance.SetCamMode(PETools.PEUtil.GetChild(mView.modelTrans, "CamTarget"),
                                                            PETools.PEUtil.GetChild(mView.modelTrans, "Bip01 Neck"), "3rd Person Shoot");
                }

                if (null != UISightingTelescope.Instance)
                {
                    UISightingTelescope.Instance.Show((UISightingTelescope.SightingType)args [0]);
                }
                //lz-2018.01.18 改变持枪状态,改变相机灵敏度的返回值
                SystemSettingData.Instance.holdGun = true;

                break;

            case EMsg.Battle_ExitShootMode:
                m_InShootMode = false;
                if (null != TestPEEntityCamCtrl.Instance)
                {
                    TestPEEntityCamCtrl.Instance.SetCamMode(PETools.PEUtil.GetChild(mView.modelTrans, "CamTarget"),
                                                            PETools.PEUtil.GetChild(mView.modelTrans, "Bip01 Neck"), "Normal Mode F1");
                }
                if (null != UISightingTelescope.Instance)
                {
                    UISightingTelescope.Instance.ExitShootMode();
                }
                SystemSettingData.Instance.holdGun = false;
                break;

            case EMsg.Battle_OnShoot:
                if (null != UISightingTelescope.Instance)
                {
                    UISightingTelescope.Instance.OnShoot();
                }
                break;

            case EMsg.UI_ShowChange:
                m_DisableActionByUI = (bool)args [0];
                if (m_DisableActionByUI && mEquip.ISAimWeapon)
                {
                    mEquip.ActiveWeapon(false);
//					for(PEActionType type = PEActionType.Move; type <= PEActionType.Stuned; type++)
//						mMotionMgr.EndImmediately(type);
                }
                break;

            case EMsg.Build_BuildMode:
                bool enterBuildMode = (bool)args [0];
                if (enterBuildMode)
                {
                    GameUIMode.Instance.GotoBuildMode();
                }
                else
                {
                    GameUIMode.Instance.GotoBaseMode();
                }

                PeCamera.SetVar("Build Mode", enterBuildMode);

                if (null != onBuildMode)
                {
                    onBuildMode(enterBuildMode);
                }

                break;

            case EMsg.Battle_OnAttack:
                if (null != onEquipmentAttack)
                {
                    onEquipmentAttack((int)args [2]);
                }
                PeEventGlobal.Instance.MainPlayerAttack.Invoke(Entity, (AttackMode)args [0]);
                break;

            //case EMsg.Battle_HPChange:
            //	SkEntity skEntity = (SkEntity)args[0];
            //	float damage = (float)args[1];
            //	if (skEntity != null && damage < PETools.PEMath.Epsilon)
            //	{
            //		OnDamage(skEntity, Mathf.Abs(damage));
            //	}
            //	break;

            case EMsg.Action_DurabilityDeficiency:
                if (null != onDurabilityDeficiency)
                {
                    onDurabilityDeficiency();
                }
                break;
            }
        }
Beispiel #12
0
    public void ResetViewCmpt(Pathea.BiologyViewCmpt viewCmpt)
    {
        if (viewCmpt == null)
        {
            return;
        }

        if (mViewObj != null)
        {
            modelAngle = mViewObj.transform.localRotation.eulerAngles;
            GameObject.Destroy(mViewObj);
        }

        mViewObj = viewCmpt.CloneModel();
        if (mViewObj == null)
        {
            return;
        }
        mViewObj.name                    = "Player";
        mViewObj.transform.parent        = mEqPhoto.transform;
        mViewObj.transform.localPosition = Vector3.zero;
        mViewObj.transform.localRotation = Quaternion.Euler(modelAngle);

        mViewObj.layer = Layer.ShowModel;

        Renderer[] renders = mViewObj.GetComponentsInChildren <Renderer>();
        for (int i = 0; i < renders.Length; i++)
        {
            renders[i].gameObject.layer =
                renders[i].gameObject.layer == Layer.GIEProductLayer ? Layer.ShowModelCreation : Layer.ShowModel;
        }

        Projector[] projectors = mViewObj.GetComponentsInChildren <Projector>();
        for (int i = 0; i < projectors.Length; i++)
        {
            projectors[i].gameObject.layer = Layer.ShowModelCreation;
        }

        mBodyViewCtr.SetTarget(mViewObj, ViewCameraControler.ViewPart.VP_All);
        Camera mCam = mBodyViewCtr.GetComponent <Camera>();

        mCam.depth                      = 0;
        mCam.transform.parent           = null;
        mCam.transform.position         = mViewObj.transform.position + new Vector3(0, 1.31f, 1.883728f);
        mCam.transform.localEulerAngles = new Vector3(11, 180, 0);
        mCam.cullingMask                = Layer.Mask.ShowModel | Layer.Mask.ShowModelCreation;
        mCam.nearClipPlane              = 0.1f;

        try
        {
            Component[] comps = mViewObj.GetComponentsInChildren <Component>(true);
            foreach (Component comp in comps)
            {
                //if(null != (comp as Rigidbody))
                //    mViewObj.GetComponent<Rigidbody>() .constraints = RigidbodyConstraints.FreezeAll;
                //else
                if (null == (comp as Animator) &&
                    null == (comp as SkinnedMeshRenderer) &&
                    null == (comp as Transform)
                    )
                {
                    MonoBehaviour.Destroy(comp);
                }
            }
        }
        catch
        {
            Debug.Log("delect equipment modle cmpt error!");
        }
    }
Beispiel #13
0
        public void OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.Skill_CheckLoop:
                SkFuncInOutPara funcInOut = args[0] as SkFuncInOutPara;
                if (null != funcInOut)
                {
                    if (null != funcInOut._para)
                    {
                        string param = funcInOut._para as string;
                        if (null != param && param == "SwordAttack")
                        {
                            if (null != m_TwoHandWeaponAttack.sword)
                            {
                                funcInOut._ret = m_TwoHandWeaponAttack.CheckContinueAttack();
                            }
                            else if (null != m_SwordAttack.sword)
                            {
                                funcInOut._ret = m_SwordAttack.CheckContinueAttack();
                            }
                        }
                    }
                }
                break;

            case EMsg.View_Prefab_Build:
                BiologyViewCmpt obj     = args[0] as BiologyViewCmpt;
                HumanPhyCtrl    phyCtrl = obj.monoPhyCtrl;
                m_SwordAttack.phyMotor         = phyCtrl;
                m_TwoHandWeaponAttack.phyMotor = phyCtrl;
                m_JetPackAction.m_PhyCtrl      = phyCtrl;
                m_ParachuteAction.m_PhyCtrl    = phyCtrl;
                m_GliderAction.m_PhyCtrl       = phyCtrl;
                m_HeavyEquipmentCtrl.phyCtrl   = phyCtrl;
                m_RopeGunAction.phyCtrl        = phyCtrl;
                m_IKAimCtrl      = obj.monoIKAimCtrl;
                m_GunFire.ikAim  = m_IKAimCtrl;
                m_BowShoot.ikAim = m_IKAimCtrl;
                CheckGloves();
                Invoke("ResetWeapon", 0.5f);
                break;

            case EMsg.View_Prefab_Destroy:
                DeletGloves();
                break;

            case EMsg.Battle_OnShoot:
                if (null != m_Gun)
                {
                    m_GunHold.OnFire();
                }
                if (null != m_Bow)
                {
                    m_BowHold.OnFire();
                }
                break;

            case EMsg.View_FirstPerson:
                m_SwordAttack.firstPersonAttack         = (bool)args[0];
                m_TwoHandWeaponAttack.firstPersonAttack = (bool)args[0];
                break;
            }
        }
Beispiel #14
0
        void InitAction()
        {
            m_Trans = Entity.peTrans;
            m_Skill = Entity.aliveEntity;
            m_Skill.onSheildReduce += OnSheildReduce;
            m_View      = Entity.biologyViewCmpt;
            m_EquipCmpt = Entity.equipmentCmpt;
            m_Package   = Entity.packageCmpt;
            m_NPC       = Entity.NpcCmpt;
            m_Anim      = Entity.animCmpt;
            m_MotionMgr = Entity.motionMgr;
            Invoke("CheckGloves", 0.5f);

            m_HeavyEquipmentCtrl.moveCmpt  = Entity.motionMove as Motion_Move_Human;
            m_HeavyEquipmentCtrl.ikCmpt    = Entity.IKCmpt;
            m_HeavyEquipmentCtrl.motionMgr = m_MotionMgr;

//			m_ChainSawActive.anim = anim;
            m_SwordAttack.m_UseStamina         = isMainPlayer;
            m_TwoHandWeaponAttack.m_UseStamina = isMainPlayer;
            //Gun
            m_GunFire.m_gunHold = m_GunHold;

            m_HandChangeHold.onActiveEvt   += OnActiveEquipment;
            m_HandChangeHold.onDeactiveEvt += OnDeactiveEquipment;

            m_TwoHandWeaponHold.onActiveEvt   += OnActiveEquipment;
            m_TwoHandWeaponHold.onDeactiveEvt += OnDeactiveEquipment;

            m_GunHold.onActiveEvt   += OnActiveEquipment;
            m_GunHold.onDeactiveEvt += OnDeactiveEquipment;

            m_BowHold.onActiveEvt   += OnActiveEquipment;
            m_BowHold.onDeactiveEvt += OnDeactiveEquipment;

            m_AimEquipHold.onActiveEvt   += OnActiveEquipment;
            m_AimEquipHold.onDeactiveEvt += OnDeactiveEquipment;

            if (null != m_MotionMgr)
            {
                m_MotionMgr.onActionEnd += OnActionEnd;
                m_MotionMgr.AddAction(m_HandChangeHold);
                m_MotionMgr.AddAction(m_HandChangePutOff);
                m_MotionMgr.AddAction(m_SwordAttack);
                m_MotionMgr.AddAction(m_TwoHandWeaponHold);
                m_MotionMgr.AddAction(m_TwoHandWeaponPutOff);
                m_MotionMgr.AddAction(m_TwoHandWeaponAttack);
                m_MotionMgr.AddAction(m_SheildHold);
                m_MotionMgr.AddAction(m_GunHold);
                m_MotionMgr.AddAction(m_GunPutOff);
                m_MotionMgr.AddAction(m_GunFire);
                m_MotionMgr.AddAction(m_GunReload);
                m_MotionMgr.AddAction(m_GunMelee);
                m_MotionMgr.AddAction(m_BowHold);
                m_MotionMgr.AddAction(m_BowPutOff);
                m_MotionMgr.AddAction(m_BowShoot);
                m_MotionMgr.AddAction(m_BowReload);
                m_MotionMgr.AddAction(m_AimEquipHold);
                m_MotionMgr.AddAction(m_AimEquipPutOff);
                m_MotionMgr.AddAction(m_DigTerrain);
                m_MotionMgr.AddAction(m_Fell);
                m_MotionMgr.AddAction(m_JetPackAction);
                m_MotionMgr.AddAction(m_ParachuteAction);
                m_MotionMgr.AddAction(m_GliderAction);
                m_MotionMgr.AddAction(m_DrawWater);
                m_MotionMgr.AddAction(m_PumpWater);
                m_MotionMgr.AddAction(m_ThrowGrenade);
                m_MotionMgr.AddAction(m_FlashLightAction);
                m_MotionMgr.AddAction(m_RopeGunAction);
            }
        }
Beispiel #15
0
    public static void Update()
    {
        if (inited)
        {
            // System Settings
            SetGlobalFloat("Rotate Sensitivity", SystemSettingData.Instance.CameraSensitivity * 3.5f);
            SetGlobalFloat("Original Fov", SystemSettingData.Instance.CameraFov);
            SetGlobalBool("Inverse X", SystemSettingData.Instance.CameraHorizontalInverse);
            SetGlobalBool("Inverse Y", SystemSettingData.Instance.CameraVerticalInverse);

            // Character
            if (Pathea.MainPlayerCmpt.gMainPlayer != null)
            {
                Pathea.PeEntity        entity = Pathea.MainPlayerCmpt.gMainPlayer.Entity;
                Pathea.BiologyViewCmpt vcmpt  = entity.viewCmpt as Pathea.BiologyViewCmpt;
                Pathea.PeTrans         trans  = entity.peTrans;
                Pathea.PassengerCmpt   psgr   = entity.GetCmpt <Pathea.PassengerCmpt>();

                SetTransform("Anchor", trans.camAnchor);
                if (vcmpt.monoModelCtrlr != null)
                {
                    SetTransform("Character", Pathea.MainPlayerCmpt.gMainPlayer._camTarget);
                    SetTransform("Bone Neck M", Pathea.MainPlayerCmpt.gMainPlayer._bneckModel);
                }
                if (vcmpt.monoRagdollCtrlr != null)
                {
                    SetTransform("Bone Neck R", Pathea.MainPlayerCmpt.gMainPlayer._bneckRagdoll);
                }
                bool is_rag_doll = vcmpt.IsRagdoll;
                SetVar("Is Ragdoll", is_rag_doll);

                mainPlayerPosTracker.Record(trans.position, Time.time);
                SetVar("Character Velocity", mainPlayerPosTracker.aveVelocity);

                drivePosTracker.breakDistance = 10;
                drivePosTracker.maxRecord     = 4;
                drivePosTracker.Record(trans.position, Time.time);
                SetVar("Driving Velocity", drivePosTracker.aveVelocity);
                SetVar("Rigidbody Velocity", drivePosTracker.aveVelocity);

                activitySpaceSize = Utils.EvaluateActivitySpaceSize(trans.camAnchor.position, 0.5f, 50f, Vector3.up, 4f, obstacle_layermask);
                SetVar("Activity Space Size", activitySpaceSize);

                // Some vars
                SetBool("Lock Cursor Mode", lockCursorMode || PeInput.UsingJoyStick);
                SetVar("Arouse Cursor", arouseCursor);
                SetVar("Roll Mode", Pathea.MainPlayerCmpt.isCameraRollable);

                if (GetVar("Build Mode").value_b)
                {
                    //lz-2017.05.18 Tutorial模式下建造不允许进入自由视角
                    if (PeInput.Get(PeInput.LogicFunction.Build_FreeBuildModeOnOff) && !Pathea.PeGameMgr.IsTutorial)
                    {
                        freeLook = !freeLook;
                        camc.CrossFade("Global Blend", freeLook ? 0 : 1, 0.3f);
                    }
                }
                else
                {
                    int mode = 1;
                    if (psgr != null)
                    {
                        WhiteCat.CarrierController dc = psgr.drivingController;
                        if (dc != null)
                        {
                            mode = 2;
                            SetVar("Vehicle Arm", dc.isAttackMode);
                        }
                    }
                    camc.CrossFade("Global Blend", mode, 0.3f);
                    freeLook = false;
                }
                UpdateShake();
            }
            // Internal Logic
#if true
            if (PeInput.Get(PeInput.LogicFunction.ChangeContrlMode))
            {
                if (SystemSettingData.Instance.FirstPersonCtrl)
                {           // F3->F1
                    lockCursorMode = false;
                    SystemSettingData.Instance.mMMOControlType = true;
                    SystemSettingData.Instance.FirstPersonCtrl = false;
                    SystemSettingData.Instance.dataDirty       = true;
                    if (onControlModeChange != null)
                    {
                        onControlModeChange.Invoke(ControlMode.ThirdPerson);
                    }
                }
                else if (SystemSettingData.Instance.mMMOControlType)
                {   // F1->F2
                    lockCursorMode = true;
                    SystemSettingData.Instance.mMMOControlType = false;
                    SystemSettingData.Instance.FirstPersonCtrl = false;
                    SystemSettingData.Instance.dataDirty       = true;
                    if (onControlModeChange != null)
                    {
                        onControlModeChange.Invoke(ControlMode.MMOControl);
                    }
                }
                else
                {                                                   // F2->F3
                    lockCursorMode = true;
                    SystemSettingData.Instance.FirstPersonCtrl = true;
                    SystemSettingData.Instance.dataDirty       = true;
                    if (onControlModeChange != null)
                    {
                        onControlModeChange.Invoke(ControlMode.FirstPerson);
                    }
                }
            }
#else
            if (PeInput.Get(PeInput.LogicFunction.F1Mode))
            {
                lockCursorMode = false;
                SystemSettingData.Instance.mMMOControlType = true;
                SystemSettingData.Instance.FirstPersonCtrl = false;
                SystemSettingData.Instance.dataDirty       = true;
            }
            else if (PeInput.Get(PeInput.LogicFunction.F2Mode))
            {
                lockCursorMode = true;
                SystemSettingData.Instance.mMMOControlType = false;
                SystemSettingData.Instance.FirstPersonCtrl = false;
                SystemSettingData.Instance.dataDirty       = true;
            }
            else if (PeInput.Get(PeInput.LogicFunction.F3Mode))
            {
                lockCursorMode = true;
                SystemSettingData.Instance.FirstPersonCtrl = true;
                SystemSettingData.Instance.dataDirty       = true;
            }
#endif
            if (shootModeIndex == 0 && shootModeTime > 0)
            {
                shootModeTime -= Time.deltaTime;
                if (shootModeTime <= 0)
                {
                    camc.CrossFade("3rd Person Blend", 0, 0.05f);
                    camc.CrossFade("1st Person Blend", 0, 0.05f);
                }
            }

            if (isFirstPerson)
            {
                SetVar("1st Offset Up", camModeData.offsetUp);
                SetVar("1st Offset", camModeData.offset);
                SetVar("1st Offset Down", camModeData.offsetDown);
            }

            // Mouse states
            SetGlobalVar("Mouse On Scroll", UIMouseEvent.opAnyScroll);
            SetGlobalVar("Mouse On GUI", UIMouseEvent.onAnyGUI);
            SetGlobalVar("Mouse Op GUI", UIMouseEvent.opAnyGUI);
        }
    }
 public override void Start()
 {
     base.Start();
     m_SkEntity = Entity.aliveEntity;
     m_View     = Entity.biologyViewCmpt;
 }