Exemplo n.º 1
0
        public void TravelTo(Vector3 pos)
        {
            if (!TravelEnable())
            {
                Debug.Log("<color=aqua>fast travel enable = false</color>");
                return;
            }

            PeEntity mainPlayer = PeCreature.Instance.mainPlayer;

            if (null == mainPlayer)
            {
                Debug.LogError("no main player");
                return;
            }

            PeTrans tran = mainPlayer.peTrans;

            if (null == tran)
            {
                return;
            }

            tran.fastTravelPos = pos;
            if (PeGameMgr.yirdName == AdventureScene.Dungen.ToString())
            {
                RandomDungenMgr.Instance.TransFromDungeon(pos);
                PeGameMgr.targetYird = AdventureScene.MainAdventure.ToString();
            }

            DispatchFastTravel(pos);
            TravelWithLoadScene();
        }
Exemplo n.º 2
0
        public void SetToTravelPos()
        {
            if (travelPos == Vector3.zero)
            {
                return;
            }
            PlayerNetwork pn = PlayerNetwork.mainPlayer;

            pn.transform.position = travelPos;
            if (null != pn._move)
            {
                pn._move.NetMoveTo(travelPos, Vector3.zero, true);
            }
            if (bTraveling)
            {
                return;
            }
            bTraveling = true;
            PeEntity mainPlayer = PeCreature.Instance.mainPlayer;

            if (null == mainPlayer)
            {
                Debug.LogError("no main player");
                return;
            }

            PeTrans tran = mainPlayer.peTrans;

            if (null == tran)
            {
                return;
            }
            tran.position = travelPos;
            StartLoadScene();
        }
Exemplo n.º 3
0
            PeGameSummary Gather()
            {
                PeGameSummary summary = new PeGameSummary();

                summary.screenshot = ArchiveMgr.Instance.autoSave ? null : PeScreenshot.GetTex();

                PeTrans tr = MainPlayer.Instance.entity.peTrans;

                if (tr != null)
                {
                    summary.playerPos = tr.fastTravel ? tr.fastTravelPos : tr.position;
                }

                summary.gameTime  = GameTime.Timer.Second;
                summary.playTime  = (int)GameTime.PlayTime.Second;
                summary.saveTime  = DateTime.Now;
                summary.sceneMode = PeGameMgr.sceneMode;
                summary.seed      = summary.sceneMode == Pathea.PeGameMgr.ESceneMode.Story ? "NA" : RandomMapConfig.SeedString;

                PeEntity mainPlayer = PeCreature.Instance.mainPlayer;

                summary.playerName = null == mainPlayer ? "NA" : mainPlayer.ToString();

                summary.gameLevel = PeGameMgr.gameLevel;
                return(summary);
            }
Exemplo n.º 4
0
        public override void Start()
        {
            base.Start();

            mMove      = Entity.GetCmpt <Motion_Move>();
            mTrans     = Entity.peTrans;
            mMotionMgr = Entity.GetCmpt <MotionMgrCmpt>();
        }
Exemplo n.º 5
0
    protected void InitTransform(Transform t)
    {
        t.position   = _pos;
        t.rotation   = _rot;
        t.localScale = _sca;

        mPeTrans = t.GetComponent <Pathea.PeTrans>();
    }
Exemplo n.º 6
0
        public override void Start()
        {
            base.Start();

            mTrans      = Entity.peTrans;
            mEntityInfo = Entity.GetCmpt <EntityInfoCmpt>();
            //mServant = Entity.GetCmpt<NpcCmpt>();
            mCommon = Entity.GetCmpt <CommonCmpt>();
        }
Exemplo n.º 7
0
        public void Follow(PeTrans target, float height = 0f)
        {
            if (null == target)
            {
                return;
            }

            Follow(target.trans, height);
        }
Exemplo n.º 8
0
    bool CheckDistance(Vector3 pos)
    {
        Pathea.PeTrans playerTrans = Pathea.PeCreature.Instance.mainPlayer.GetCmpt <Pathea.PeTrans>();
        if (playerTrans == null)
        {
            return(true);
        }

        return(Vector3.Distance(playerTrans.position, pos) < PickDistance);
    }
Exemplo n.º 9
0
 public void SevantLostController(PeTrans leader)
 {
     for (int i = 0; i < mFollowers.Length; i++)
     {
         Vector3 fixedPos = PETools.PEUtil.GetEqualPositionToStand(PETools.PEUtil.MainCamTransform.position, -PETools.PEUtil.MainCamTransform.forward, leader.position, -leader.forward, 3.0f);
         if (mFollowers[i] != null)
         {
             mFollowers[i].Req_Translate(fixedPos);
         }
     }
 }
Exemplo n.º 10
0
        public void LearnEffectAndSound()
        {
            PeTrans trans = Entity.peTrans;

            if (trans == null)
            {
                return;
            }
            Pathea.Effect.EffectBuilder.Instance.Register(LearnEffectId, null, trans.position, trans.rotation);
            AudioManager.instance.Create(trans.position, LearnSoundId);
        }
Exemplo n.º 11
0
        static void SetPos(Pathea.PeEntity entity, Vector3 pos)
        {
            PeTrans trans = entity.peTrans;

            if (null == trans)
            {
                Debug.LogError("entity has no PeTrans");
                return;
            }

            trans.position = pos;
        }
Exemplo n.º 12
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null == trans || null == move)
            {
                return;
            }
            PEActionParamN paramN       = para as PEActionParamN;
            PeEntity       targetEntity = EntityMgr.Instance.Get(paramN.n);

            if (null != targetEntity)
            {
                m_TargetMotion = targetEntity.motionMgr;
            }
            else
            {
                return;
            }

            if (null != m_TargetMotion)
            {
                m_TargetAction = m_TargetMotion.GetAction <Action_Handed>();
            }
            else
            {
                return;
            }

            m_TargetTrans = targetEntity.peTrans;
            if (null == m_TargetTrans)
            {
                return;
            }

            if (null == m_MoveAction)
            {
                m_MoveAction = motionMgr.GetAction <Action_Move>();
            }

            m_AnimMatch = false;
            motionMgr.SetMaskState(PEActionMask.Hand, true);
            PEActionParamN param = PEActionParamN.param;

            param.n = motionMgr.Entity.Id;
            m_TargetMotion.DoActionImmediately(PEActionType.Handed, param);
            m_EndAction   = false;
            m_StartTime   = Time.time;
            m_CurTryCount = 0;
            if (PeGameMgr.IsMulti && entity == PeCreature.Instance.mainPlayer)
            {
                targetEntity.netCmpt.network.RPCServer(EPacketType.PT_NPC_RequestAiOp, (int)EReqType.Hand, entity.Id);
            }
        }
Exemplo n.º 13
0
    public bool CheckDistance()
    {
        MousePickable mousePickable = GetComponent <MousePickable>();

        if (mousePickable != null)
        {
            Pathea.PeTrans trans = mousePickable.GetComponent <Pathea.PeTrans>();
            if (trans != null)
            {
                return(CheckDistance(trans.position));
            }
        }
        return(false);
    }
Exemplo n.º 14
0
        public override void Start()
        {
            base.Start();
            m_SpeedState = SpeedState.None;
            m_PeTrans    = Entity.peTrans;
            m_Animator   = Entity.GetCmpt <AnimatorCmpt>();
            m_Attribute  = Entity.GetCmpt <SkAliveEntity>();
            m_target     = GetComponent <TargetCmpt>();
            //m_Limiter = new MovementLimiter(this, m_Field);

            if (m_Attribute != null)
            {
                m_Attribute.deathEvent += OnDeath;
            }
        }
Exemplo n.º 15
0
        public override void Awake()
        {
            base.Awake();
            m_Animator = GetComponent <AnimatorCmpt>();
            m_SkEntity = GetComponent <SkAliveEntity>();
            m_Behave   = GetComponent <BehaveCmpt>();
            m_Motor    = GetComponent <Motion_Move_Motor>();
            m_Trans    = GetComponent <PeTrans>();
            m_Request  = GetComponent <RequestCmpt>();

            if (m_SkEntity != null)
            {
                m_SkEntity.deathEvent += OnDeath;
            }
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
    Vector2 GetPlayerPos()
    {
        if (mTrans == null)
        {
            Pathea.PeEntity entity = Pathea.PeCreature.Instance.mainPlayer;
            if (null != entity)
            {
                mTrans = entity.GetCmpt <Pathea.PeTrans>();
            }
        }

        if (null != mTrans)
        {
            return(new Vector2(mTrans.position.x, mTrans.position.z));
        }
        return(Vector2.zero);
    }
Exemplo n.º 18
0
    void Start()
    {
        MousePickablePeEntity mousePickable = GetComponent <MousePickablePeEntity>();

        if (mousePickable == null)
        {
            mousePickable = gameObject.AddComponent <MousePickablePeEntity>();
            mousePickable.CollectColliders();
        }

        CreateDroppableItemList();
        mousePickable.eventor.Subscribe((object sender, MousePickable.RMouseClickEvent e) =>
        {
            Pathea.PeTrans trans = e.mousePickable.GetComponent <Pathea.PeTrans>();
            OpenGui(trans.position);
        });
    }
Exemplo n.º 19
0
        public override void Start()
        {
            base.Start();
            mPeTrans   = Entity.peTrans;
            mSkEntity  = Entity.GetComponent <PESkEntity>();
            mMotionMgr = Entity.GetCmpt <MotionMgrCmpt>();

            if (mRailRouteId != Railway.Manager.InvalId)
            {
                if (null != Railway.Manager.Instance.GetRoute(mRailRouteId))
                {
                    DoGetOn(mRailRouteId, true);
                }
                else
                {
                    mRailRouteId = Railway.Manager.InvalId;
                }
            }
        }
Exemplo n.º 20
0
        public override void Start()
        {
            base.Start();

            m_Trans    = GetComponent <PeTrans>();
            m_SkEntity = GetComponent <SkEntity>();

            Entity.peSkEntity.onHpChange   += OnHpChange;
            Entity.peSkEntity.onHpReduce   += OnDamage;
            Entity.peSkEntity.attackEvent  += OnAttack;
            Entity.peSkEntity.onSkillEvent += OnSkillTarget;

            m_TowerEffect = new List <TowerEffect>();
            TowerProtoDb.Item item = TowerProtoDb.Get(Entity.ProtoID);
            if (item != null && item.effects != null && item.effects.Count > 0)
            {
                for (int i = 0; i < item.effects.Count; i++)
                {
                    m_TowerEffect.Add(new TowerEffect(item.effects[i].hpPercent, item.effects[i].effectID, item.effects[i].audioID));
                }
            }
        }
Exemplo n.º 21
0
        public override void Start()
        {
            base.Start();
            m_SkillCmpt = Entity.aliveEntity;
            m_PeTrans   = Entity.peTrans;

            m_Repulsed.m_Behave = Entity.GetCmpt <BehaveCmpt>();
            m_Repulsed.m_Move   = Entity.GetCmpt <Motion_Move_Motor>();

            m_MotionMgr = Entity.motionMgr;
            if (null != m_MotionMgr)
            {
                m_MotionMgr.AddAction(m_Whacked);
                m_MotionMgr.AddAction(m_Repulsed);
                m_MotionMgr.AddAction(m_Wentfly);
                m_MotionMgr.AddAction(m_Knocked);
                m_MotionMgr.AddAction(m_GetUp);
                m_MotionMgr.AddAction(m_Death);
                m_MotionMgr.AddAction(m_AlienDeath);
                m_MotionMgr.AddAction(m_Revive);
            }
        }
Exemplo n.º 22
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null == trans || null == move)
            {
                return;
            }
            PEActionParamN paramN = para as PEActionParamN;
            PeEntity       entity = EntityMgr.Instance.Get(paramN.n);

            if (null != entity)
            {
                m_TargetTrans = entity.peTrans;
            }
            if (null == m_TargetTrans)
            {
                return;
            }

            m_AnimMatch  = false;
            standAnimEnd = false;
            motionMgr.SetMaskState(PEActionMask.Hand, true);
        }
Exemplo n.º 23
0
        void Start()
        {
            if (!m_Init)
            {
                InitSkEntity();
            }

            Entity.AddMsgListener(this);

            m_CollisionEntities = new Dictionary <Collider, List <Collider> >();

            m_View        = Entity.viewCmpt;
            m_Trans       = Entity.peTrans;
            m_Animator    = Entity.animCmpt;
            m_Beat        = Entity.GetCmpt <Motion_Beat>();
            m_MotionMgr   = Entity.motionMgr;
            m_MotionEquip = Entity.GetCmpt <Motion_Equip>();
            m_Live        = Entity.GetCmpt <Motion_Live>();
            onHpChange   += OnHpChange;
            onSkillEvent += OnTargetSkill;
            onTranslate  += OnTranslate;
            Invoke("CheckInitAttr", 0.5f);
        }
Exemplo n.º 24
0
        public static PeEntity Create(string path, Vector3 pos, Quaternion rot, Vector3 scl)
        {
            try
            {
                //Debug.LogError("[PeEntity]load entity object:" + path);
                GameObject obj = AssetsLoader.Instance.InstantiateAssetImm(path, pos, rot, Vector3.one); // scl apply to PeTrans
                if (null == obj)
                {
                    Debug.LogError("cant load entity object:" + path);
                    return(null);
                }

                PeEntity e = obj.GetComponent <PeEntity>();
                if (null == e)
                {
                    e = obj.AddComponent <PeEntity>();
                }

                PeTrans t = e.peTrans;
                if (null != t)
                {
                    t.position = pos;
                    t.rotation = rot;
                    t.scale    = scl;
                }

                //for restore
                e.mPrefabPath = path;
                return(e);
            }
            catch (System.Exception e)
            {
                Debug.LogError(e + " : " + path);
                return(null);
            }
        }
Exemplo n.º 25
0
        public void OnHpChange(SkEntity self, SkEntity caster, float hpChange)
        {
            if (null == self)
            {
                return;
            }
            SkAliveEntity skAlive = self as SkAliveEntity;

            if (null != skAlive)
            {
                PeTrans    trans  = skAlive.Entity.peTrans;
                CommonCmpt common = skAlive.Entity.commonCmpt;
                if (null != trans)
                {
                    HPChangeEventData data = new HPChangeEventData();
                    data.m_Self      = self;
                    data.m_HPChange  = hpChange;
                    data.m_Transfrom = trans.trans;
                    data.m_Proto     = (null != common && null != common.entityProto)?common.entityProto.proto:EEntityProto.Doodad;
                    data.m_AddTime   = Time.realtimeSinceStartup;
                    _datas.Push(data);
                }
            }
        }
Exemplo n.º 26
0
    void UpdateMiniMap()
    {
        if (null == mView)
        {
            Pathea.PeEntity e = Pathea.PeCreature.Instance.mainPlayer;
            if (null != e)
            {
                mView = e.GetCmpt <Pathea.PeTrans>();
            }
        }

        if (null != mView && GameUI.Instance.bVoxelComplete)
        {
            if (!GameConfig.IsInVCE)
            {
                if (!mMiniMapCam.targetTexture.IsCreated())
                {
                    mMiniMapCam.targetTexture.Create();
                    ReFlashMap();
                }

                Vector3 pos = mView.position + 1000 * Vector3.up;
                pos.y = 0;

                //if (true)
                if (Vector3.Distance(pos, mMapCenterPos) > 62f || (GameTime.Timer.Second - mMapReFlashTime > 600.0))                // disable camera would cause unreasonable memory allocation
                {
                    mMiniMapCam.enabled            = true;
                    mMapCenterPos                  = pos;
                    mMiniMapCam.transform.position = mView.position + 300 * Vector3.up;
                    mMapReFlashTime                = GameTime.Timer.Second;
                }
                else
                {
                    if (mMiniMapCam.enabled)
                    {
                        mMiniMapCam.enabled = false;
                    }
                }

                mMiniMapTex.uvRect = new Rect((pos.x - mMapCenterPos.x) / 248f / mMiniMapCam.aspect + 0.25f, (pos.z - mMapCenterPos.z) / 248f + 0.25f, 0.5f / mMiniMapCam.aspect, 0.5f);
                float mCenter_x = Convert.ToSingle(0.5 + (pos.x - mMapCenterPos.x) / 248f);
                float mCenter_y = Convert.ToSingle(0.5 + (pos.z - mMapCenterPos.z) / 248f);
                mMiniMapTex.material.SetFloat("_Center_x", mCenter_x);
                mMiniMapTex.material.SetFloat("_Center_y", mCenter_y);
                mMiniMapTex.material.SetFloat("_Alpha", mMapAlpha);
                mMiniMapTex.material.SetFloat("_Bright", mMapBright);

                //float xfactor = (mMapSize.x - mMinSize.x)/(mMaxSize.x - mMinSize.x);
                //float yfactor = (mMapSize.y - mMinSize.y) / (mMaxSize.y - mMinSize.y);

                //mMiniMapTex.uvRect = new Rect((pos.x - mMapCenterPos.x) / 248f + ((1 - xfactor) * 0.5f), (pos.z - mMapCenterPos.z) / 248f + ((1 - xfactor) * 0.5f), xfactor, yfactor);
                //float mCenter_x = Convert.ToSingle(xfactor + (pos.x - mMapCenterPos.x) / 248f);
                //float mCenter_y = Convert.ToSingle(yfactor + (pos.z - mMapCenterPos.z) / 248f);
                //mMiniMapTex.material.SetFloat("_Center_x", mCenter_x);
                //mMiniMapTex.material.SetFloat("_Center_y", mCenter_y);
                //mMiniMapTex.material.SetFloat("_Alpha", mMapAlpha);
                //mMiniMapTex.material.SetFloat("_Bright", mMapBright);
            }
        }
    }
Exemplo n.º 27
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);
        }
    }
Exemplo n.º 28
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);
            }
        }
Exemplo n.º 29
0
 public override void Start()
 {
     base.Start();
     m_Trans     = Entity.peTrans;
     m_SmoothAim = Entity.GetCmpt <MainPlayerCmpt>() == null;
 }
Exemplo n.º 30
0
 public MovementLimiter(Motion_Move_Motor motor, MovementField movementField)
 {
     m_MotionMove    = motor;
     m_Trans         = m_MotionMove.GetComponent <PeTrans>();
     m_MovementField = movementField;
 }