Пример #1
0
    public override void Init()
    {
        base.Init();
        m_WeaponFireData = m_CfgEternityProxy.GetWeaponDataOfMachineGun(m_WeaponTable.TypeDateSheetld);
        m_CrossSightInfo = new CrossSightInfo();
        m_CrossSightInfo.m_MaxRayDistance  = m_SkillMaxDistance;
        m_CrossSightInfo.m_CrossSightShape = CrossSightShape.ConeSquare;
        m_CrossSightInfo.m_ConeSquareInfo.detectionMode = DetectionMode.All;
        m_CrossSightLoic = new CCrossSightLoic();
        m_CrossSightLoic = new CrossSightLoic_Improve_ConeSquare(m_CrossSightLoic);
        m_CrossSightLoic.SetCrossSightInfo(m_CrossSightInfo);
        m_CrossSightLoic.SetBallisticOffsetFunc(BallisticOffsetFunc, null);


        m_CurrentBulletCount = 0;                                                                                                          //子弹数
        m_Accuracy           = m_MainPlayer.GetWeaponAttribute(m_UId, crucis.attributepipeline.attribenum.AttributeName.kWeaponAccuracy);  //精准度
        m_Stability          = m_MainPlayer.GetWeaponAttribute(m_UId, crucis.attributepipeline.attribenum.AttributeName.kWeaponStability); //稳定性
        m_Aspect             = m_WeaponFireData.AngleRatio;


        m_CurrentHorizontalAngle = GetHorizontalAngle_Before();
        m_CurrentVerticalAngle   = m_Aspect == 0 ? m_CurrentHorizontalAngle : m_CurrentHorizontalAngle / m_Aspect;
        m_CrossSightLoic.ChangeVirtualCameraAttribute(m_CurrentHorizontalAngle, m_Aspect);

        m_FireInterval = WeaponAndCrossSightFactory.CalculateFireInterval(m_MainPlayer, m_WeaponTable.TypeDateSheetld, m_UId, WeaponAndCrossSight.WeaponAndCrossSightTypes.MachineGun);
    }
    public BattleWeapon_MachineGun(IWeapon weapon) : base(weapon)
    {
        m_WeaponFireData = m_CfgEternityProxy.GetWeaponDataOfMachineGun(m_WeaponConfig.TypeDateSheetld);
        m_SkillVO        = m_PlayerSkillProxy.GetSkillByID((int)m_WeaponItem.GetBaseConfig().SkillId);

        m_CurrentBulletCount = 0;
        m_State = GunState.Stop;

        // TEST
        //SetupStaticWeaponParam_Debug();
        TranslateUniformParamToWeaponParam();
        // TEST
    }
Пример #3
0
    /// <summary>
    /// 获得射击间隔
    /// </summary>
    /// <returns></returns>
    public static float CalculateFireInterval(SpacecraftEntity entity, uint TypeDateSheetld, ulong weaponUid, WeaponAndCrossSight.WeaponAndCrossSightTypes type)
    {
        if (entity == null)
        {
            return(0);
        }

        int   minuteBulletNumber = 0;
        float fir = 0f;

        CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;

        switch (type)
        {
        case WeaponAndCrossSight.WeaponAndCrossSightTypes.MachineGun:
        {
            WeaponRapidFirer WData = cfgEternityProxy.GetWeaponDataOfMachineGun(TypeDateSheetld);
            minuteBulletNumber = WData.MinuteBulletNumber;
        }
        break;

        case WeaponAndCrossSight.WeaponAndCrossSightTypes.Missile:
        {
            WeaponMissile WData = cfgEternityProxy.GetWeaponDataOfMissile(TypeDateSheetld);
            minuteBulletNumber = WData.MinuteBulletNumber;
        }
        break;

        case WeaponAndCrossSight.WeaponAndCrossSightTypes.ShotGun:
        {
            WeaponShotgun WData = cfgEternityProxy.GetWeaponDataOfShotgun(TypeDateSheetld);
            minuteBulletNumber = WData.MinuteBulletNumber;
        }
        break;

        case WeaponAndCrossSight.WeaponAndCrossSightTypes.Mining:
        {
            WeaponMiningLaser WData = cfgEternityProxy.GetWeaponDataOfMining(TypeDateSheetld);
            minuteBulletNumber = WData.MinuteBulletNumber;
        }
        break;

        case WeaponAndCrossSight.WeaponAndCrossSightTypes.Null:
        default:
            return(0f);
        }



        // 当武器射速属性 >= 0,使用1号武器射击间隔公式
        // 当武器射速属性 < 0,使用2号武器射击间隔公式

        // 1号武器射击间隔公式
        // ( 60 / A) /( 1 + B / 100)*1000

        // 2号武器射击间隔公式
        // ABS(( 60 / A) *( 1 + B / 100 - 2)*1000)

        // A:1分钟子弹数
        // B:武器射速

        // 备注:
        //  武器射击间隔公式最终数值为整数四舍五入
        //  最终单位数值为毫秒

        float weaponFireSpeed = entity.GetWeaponAttribute(weaponUid, crucis.attributepipeline.attribenum.AttributeName.kLightHeatCastSpeed);

        if (weaponFireSpeed >= 0)
        {
            fir = 60f / minuteBulletNumber / (1 + weaponFireSpeed / 100f);
        }
        else
        {
            fir = Mathf.Abs(60f / minuteBulletNumber * (1 + weaponFireSpeed / 100f - 2f));
        }

        return(fir);
    }