Exemplo n.º 1
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null == skillCmpt || null == gun)
            {
                return;
            }
            PEActionParamB paramB = para as PEActionParamB;

            m_EndAfterShoot = paramB.b;
            m_EndFire       = false;
            m_HoldFireTime  = 0;
            switch (gun.m_ShootMode)
            {
            case ShootMode.SingleShoot:
            case ShootMode.MultiShoot:
                if (gun.m_AmmoType == AmmoType.Bullet)
                {
                    if (gun.magazineValue > 0)
                    {
                        if (Time.time - m_LastShootTime > gun.m_FireRate)
                        {
                            OnFire(1);
                        }
                    }
                    else
                    {
                        if (m_IgnoreItem || (null != packageCmpt && packageCmpt.GetItemCount(gun.curItemID) > 0))
                        {
                            PEActionParamN param = PEActionParamN.param;
                            param.n = gun.curAmmoItemIndex;
                            motionMgr.DoAction(PEActionType.GunReload, param);
                        }
                        else
                        {
                            skillCmpt.StartSkill(skillCmpt, gun.m_DryFireSoundID);
                        }
                        //audiomanager.instance.create(gun.m_aimattr.m_aimtrans.position,
                        //                             gun.m_dryfiresoundid,
                        //                             gun.m_aimattr.m_aimtrans);
                    }
                }
                else
                {
                    if (gun.magazineValue >= gun.m_EnergyPerShoot)
                    {
                        if (Time.time - m_LastShootTime > gun.m_FireRate)
                        {
                            OnFire(gun.m_EnergyPerShoot);
                        }
                    }
                    else
                    {
                        AudioManager.instance.Create(gun.m_AimAttr.m_AimTrans.position,
                                                     gun.m_DryFireSoundID,
                                                     gun.m_AimAttr.m_AimTrans);
                    }
                }
                break;
            }
        }
Exemplo n.º 2
0
        public override void DoAction(PEActionParam para = null)
        {
            if (null != skillCmpt)
            {
                if (skillCmpt.GetAttribute(AttribType.Hp) < 1)
                {
                    skillCmpt.SetAttribute(AttribType.Hp, 1f);
                }
                skillCmpt.SetAttribute(AttribType.Oxygen, skillCmpt.GetAttribute(AttribType.OxygenMax));
                skillCmpt.SetAttribute(AttribType.Stamina, skillCmpt.GetAttribute(AttribType.StaminaMax));
            }

            motionMgr.SetMaskState(PEActionMask.Revive, true);
            motionMgr.FreezePhyState(GetType(), true);
            motionMgr.Entity.SendMsg(EMsg.State_Revive);

            PEActionParamB paramB = para as PEActionParamB;

            bool immediately = paramB.b;

            if (null != viewCmpt)
            {
                viewCmpt.DeactivateRagdoll(immediately);
                viewCmpt.ActivateInjured(false);
            }
        }
Exemplo n.º 3
0
        void UpdateOtherAction()
        {
                        #if UNITY_EDITOR
            if (Input.GetKeyDown(KeyCode.Keypad5))
            {
                mPackage.Add(1277, 1);
                PeMap.StaticPoint.Mgr.Instance.UnveilAll();
            }
                        #endif

            if (PeCamera.isFreeLook || !m_ActionEnable)
            {
                return;
            }


            if (PeInput.Get(PeInput.LogicFunction.Jet))
            {
                mMotionMgr.DoAction(PEActionType.JetPack);
            }
            else
            {
                mMotionMgr.EndImmediately(PEActionType.JetPack);
            }

            if (PeInput.Get(PeInput.LogicFunction.ClimbForwardLadderOnOff))
            {
                DragItemMousePickLadder ladder = MousePicker.Instance.curPickObj as DragItemMousePickLadder;
                if (null != ladder)
                {
                    ladder.TryClimbLadder(this);
                }
            }

            mEquip.HoldSheild(PeInput.Get(PeInput.LogicFunction.Block));

            if (PeInput.Get(PeInput.LogicFunction.DrawWeapon))
            {
                if (m_DisableActionByUI && mEquip.ISAimWeapon)
                {
                    m_DisableActionByUI = false;
                }
                mEquip.ActiveWeapon(true);
            }

            if (PeInput.Get(PeInput.LogicFunction.Attack))
            {
                if (SystemSettingData.Instance.AttackWhithMouseDir)
                {
                    Vector3 dir = GetMouseClickDir();
                    mEquip.SwordAttack(dir);
                    mEquip.TwoHandWeaponAttack(dir);
                }
                else
                {
                    mEquip.SwordAttack(m_MoveDir.normalized);
                    mEquip.TwoHandWeaponAttack(m_MoveDir.normalized);
                }
            }

            if (PeInput.Get(PeInput.LogicFunction.SheatheWeapon))
            {
                mEquip.ActiveWeapon(false);
            }

            if (PeInput.Get(PeInput.LogicFunction.GatherHerb))
            {
                mMotionMgr.DoAction(PEActionType.Gather);
            }

            if (PeInput.Get(PeInput.LogicFunction.DrawWater))
            {
                mMotionMgr.DoAction(PEActionType.Draw);
            }

            if (PeInput.Get(PeInput.LogicFunction.TakeForwardVehicleOnOff))
            {
                if (null != mPassenger)
                {
                    if (mPassenger.IsOnVCCarrier)
                    {
                        mPassenger.GetOffCarrier();
                    }
                    else if (null != MousePicker.Instance.curPickObj)
                    {
                        DragItemMousePickCarrier carrier = MousePicker.Instance.curPickObj as DragItemMousePickCarrier;
                        if (null != carrier)
                        {
                            WhiteCat.CarrierController controller = carrier.GetComponent <WhiteCat.CarrierController> ();
                            if (null != controller)
                            {
                                int seatIndex = controller.FindEmptySeatIndex();
                                if (seatIndex > -2)
                                {
                                    if (GameConfig.IsMultiMode)
                                    {
                                        PEActionParamDrive param = PEActionParamDrive.param;
                                        param.controller = controller;
                                        param.seatIndex  = seatIndex;
                                        if (mMotionMgr.CanDoAction(PEActionType.Drive, param))
                                        {
                                            WhiteCat.CreationSkEntity skEntity = controller.GetComponent <WhiteCat.CreationSkEntity>();
                                            if (skEntity != null && skEntity._net != null)
                                            {
                                                if (!ForceSetting.Instance.Conflict(skEntity._net.TeamId, PlayerNetwork.mainPlayerId))
                                                {
                                                    PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_GetOnVehicle, skEntity._net.Id);
                                                }
                                                else
                                                {
                                                    new PeTipMsg(PELocalization.GetString(82209000), PeTipMsg.EMsgLevel.Warning);
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        mPassenger.GetOn(controller, seatIndex, true);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (PeInput.Get(PeInput.LogicFunction.Cut))
            {
                mMotionMgr.DoAction(PEActionType.Fell);
            }
            else
            {
                mMotionMgr.EndAction(PEActionType.Fell);
            }

            if (PeInput.Get(PeInput.LogicFunction.EndShooting))
            {
                mMotionMgr.EndAction(PEActionType.GunFire);
                mMotionMgr.EndAction(PEActionType.Pump);
            }
            else if (PeInput.Get(PeInput.LogicFunction.BegShooting))
            {
                PEActionParamB param = PEActionParamB.param;
                param.b = false;
                mMotionMgr.DoAction(PEActionType.GunFire, param);
                mMotionMgr.DoAction(PEActionType.BowShoot);
                mMotionMgr.DoAction(PEActionType.Throw);
                mMotionMgr.DoAction(PEActionType.Pump);
                mMotionMgr.DoAction(PEActionType.RopeGunShoot);
            }

            if (m_MouseMoveMode)
            {
                if (PeInput.Get(PeInput.LogicFunction.BegShooting))
                {
                    mMove.MoveTo(m_MouseHitPos, SpeedState.Sprint);
                }
                if (Input.GetMouseButtonDown(1))
                {
                    mMove.MoveTo(Vector3.zero, SpeedState.Sprint);
                }
            }

            if (PeInput.Get(PeInput.LogicFunction.EndDigging))
            {
                mMotionMgr.EndAction(PEActionType.Dig);
            }
            else if (PeInput.Get(PeInput.LogicFunction.BegDigging))
            {
                PEActionParamV param = PEActionParamV.param;
                param.vec = Vector3.zero;
                mMotionMgr.DoAction(PEActionType.Dig, param);
            }

            if (PeInput.Get(PeInput.LogicFunction.Reload))
            {
                mEquip.Reload();
            }

            if (PeInput.Get(PeInput.LogicFunction.BuildMode))
            {
                if (mMotionMgr.IsActionRunning(PEActionType.Build))
                {
                    mMotionMgr.EndAction(PEActionType.Build);
                }
                else
                {
                    if (RandomDungenMgrData.InDungeon)
                    {
                        new PeTipMsg("[C8C800]" + PELocalization.GetString(82209004), PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Stroy);
                        return;
                    }
                    if (Pathea.SingleGameStory.curType == Pathea.SingleGameStory.StoryScene.MainLand ||
                        Pathea.SingleGameStory.curType == Pathea.SingleGameStory.StoryScene.TrainingShip)
                    {
                        mMotionMgr.DoAction(PEActionType.Build);
                    }
                    else
                    {
                        new PeTipMsg("[C8C800]" + PELocalization.GetString(82209004), PeTipMsg.EMsgLevel.Norm, PeTipMsg.EMsgType.Stroy);
                    }
                }
            }
        }