Example #1
0
        public override bool Update()
        {
            if (null == skillCmpt || null == bow)
            {
                return(true);
            }

            if (GameConfig.IsMultiMode)
            {
                NetworkInterface net = NetworkInterface.Get(motionMgr.Entity.Id);
                if (null != net && !net.hasOwnerAuth)
                {
                    return(true);
                }
            }

            if (!skillCmpt.IsSkillRunning(bow.skillID))
            {
                if (m_IgnoreItem || null != packageCmpt && packageCmpt.GetItemCount(bow.curItemID) > 0)
                {
                    PEActionParamN param = PEActionParamN.param;
                    param.n = bow.curItemIndex;
                    motionMgr.DoAction(PEActionType.BowReload, param);
                }
                else
                {
                    motionMgr.DoAction(PEActionType.BowPutOff);
                }

                bow.OnShoot();
                return(true);
            }

            return(true);
        }
Example #2
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;
            }
        }
Example #3
0
 public void Reload()
 {
     if (null != m_Gun)
     {
         PEActionParamN param = PEActionParamN.param;
         param.n = m_Gun.curAmmoItemIndex;
         m_MotionMgr.DoAction(PEActionType.GunReload, param);
     }
 }
Example #4
0
        public override bool CanDoAction(PEActionParam para = null)
        {
            PEActionParamN paramN         = para as PEActionParamN;
            int            targetAmmIndex = paramN.n;

            if (m_IgnoreItem)
            {
                return(null != bow && null != packageCmpt);
            }

            return(null != bow && null != packageCmpt && (targetAmmIndex != bow.curItemIndex || packageCmpt.GetItemCount(bow.curItemID) > 0));
        }
Example #5
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);
            }
        }
Example #6
0
        public override void DoAction(PEActionParam para = null)
        {
            PEActionParamN paramN = para as PEActionParamN;

            m_ModeIndex = paramN.n;
            if (null != gun && null != gun.m_SkillIDList && gun.m_SkillIDList.Length > m_ModeIndex)
            {
                m_SkillInst = skillCmpt.StartSkill(targetEntity, gun.m_SkillIDList[m_ModeIndex]);
            }

            if (null != entity && null != gun.m_AttackMode && gun.m_AttackMode.Length > m_ModeIndex)
            {
                entity.SendMsg(EMsg.Battle_OnAttack, gun.m_AttackMode[m_ModeIndex], gun.transform, gun.curItemID);
            }
        }
Example #7
0
        public override void DoAction(PEActionParam para = null)
        {
            motionMgr.SetMaskState(PEActionMask.BowReload, true);
            PEActionParamN paramN = para as PEActionParamN;

            m_TargetAmmoIndex = paramN.n;
            if (null != bow && null != anim && motionMgr.IsActionRunning(PEActionType.BowHold))
            {
                anim.SetTrigger(bow.m_ReloadAnim);
                m_AnimEnd = false;
            }
            if (null != bow && null != ikCmpt && null != ikCmpt.m_IKAimCtrl)
            {
                ikCmpt.m_IKAimCtrl.StartSyncAimAxie();
            }
        }
Example #8
0
        public override bool CanDoAction(PEActionParam para = null)
        {
            if (null != gun && m_IgnoreItem)
            {
                return(true);
            }
            PEActionParamN paramN         = PEActionParamN.param;
            int            targetAmmIndex = paramN.n;

            if (m_IgnoreItem)
            {
                return(null != gun && null != packageCmpt && gun.m_AmmoType == AmmoType.Bullet &&
                       gun.magazineValue < gun.magazineSize);
            }

            return(null != gun && null != packageCmpt && gun.m_AmmoType == AmmoType.Bullet &&
                   gun.magazineValue < gun.magazineSize && (targetAmmIndex != gun.curAmmoItemIndex || packageCmpt.GetItemCount(gun.curItemID) > 0));
        }
Example #9
0
        public override void DoAction(PEActionParam para = null)
        {
            PEActionParamN paramN = PEActionParamN.param;

            motionMgr.SetMaskState(PEActionMask.GunReload, true);
            m_TargetAmmoIndex = paramN.n;
            if (null != gun && null != anim && motionMgr.IsActionRunning(PEActionType.GunHold))
            {
                anim.SetTrigger(gun.m_ReloadAnim);
                m_Audio     = AudioManager.instance.Create(gun.transform.position, gun.m_ReloadSoundID, gun.transform);
                m_ReloadEnd = false;
                m_AnimEnd   = false;
            }
            else
            {
                Reload();
            }
            if (null != gun && null != ikCmpt && null != ikCmpt.m_IKAimCtrl)
            {
                ikCmpt.m_IKAimCtrl.StartSyncAimAxie();
            }
        }
Example #10
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);
        }