コード例 #1
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);
        }
コード例 #2
0
    public bool DoGetOnTrain(int entityId, int routeId, bool checkState = true)
    {
        Pathea.PeEntity entity = Pathea.EntityMgr.Instance.Get(entityId);
        if (null == entity)
        {
            Debug.LogError("cant find entity:" + entityId);
            return(false);
        }

        Pathea.PassengerCmpt passenger = entity.GetCmpt <Pathea.PassengerCmpt>();
        if (null == passenger)
        {
            Debug.LogError("no Pathea.RailPassengerCmpt");
            return(false);
        }

        return(passenger.GetOn(routeId, checkState));
    }
コード例 #3
0
    public bool DoGetOffTrain(int routeId, int entityId, Vector3 pos)
    {
        Pathea.PeEntity entity = Pathea.EntityMgr.Instance.Get(entityId);
        if (null == entity)
        {
            Debug.LogError("cant find entity:" + entityId);
            return(false);
        }

        Pathea.PassengerCmpt passenger = entity.GetCmpt <Pathea.PassengerCmpt>();
        if (null == passenger)
        {
            Debug.LogError("no Pathea.RailPassengerCmpt");
            return(false);
        }

        if (passenger.railRouteId != routeId)
        {
            return(false);
        }

        return(passenger.GetOff(pos));
    }
コード例 #4
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);
        }
    }