/// <summary>
    /// 在武器变化的时候, 更新当前实装的武器的准星信息
    /// </summary>
    private void UpdateBattleWeapons(IComponentEvent entityEvent)
    {
        PlayerSkillProxy m_SkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

        for (int iWeapon = 0; iWeapon < BATTLE_WEAPON_COUNT; iWeapon++)
        {
            IWeapon weapon = m_SkillProxy.GetWeaponByIndex(iWeapon);
            if (weapon == null)
            {
                continue;
            }

            ulong uid = weapon.GetUID();

            if (!m_IPerceptronTarget.HaveWeaponAndCrossSight(uid))
            {
                WeaponAndCrossSight weaponAndCross = WeaponAndCrossSightFactory.CreatTWeapon(uid,
                                                                                             weapon.GetConfig().Id, weapon.GetBaseConfig().SkillId,
                                                                                             (WeaponAndCrossSight.WeaponAndCrossSightTypes)weapon.GetConfig().Reticle);

                //Debug.LogError(string.Format("创建准星 uid = {0}, tid = {1} , type = {2}, null? {3}", uid, weapon.GetConfig().Id, weapon.GetConfig().Reticle , (weaponAndCross== null)));

                if (weaponAndCross == null)
                {
                    continue;
                }
                m_IPerceptronTarget.AddWeaponAndCrossSight(uid, weaponAndCross);
            }
        }
    }
Esempio n. 2
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);
    }
Esempio n. 3
0
    public override void Init()
    {
        base.Init();
        m_WeaponFireData = m_CfgEternityProxy.GetWeaponDataOfMissile(m_WeaponTable.TypeDateSheetld);

        m_CrossSightInfo = new CrossSightInfo();
        m_CrossSightInfo.m_MaxRayDistance  = m_SkillMaxDistance;
        m_CrossSightInfo.m_CrossSightShape = CrossSightShape.ConeSquare;
        m_CrossSightLoic = new CCrossSightLoic();
        m_CrossSightLoic = new CrossSightLoic_Improve_ConeSquare(m_CrossSightLoic);
        m_CrossSightLoic.SetCrossSightInfo(m_CrossSightInfo);

        float accuracy  = m_MainPlayer.GetWeaponAttribute(m_UId, crucis.attributepipeline.attribenum.AttributeName.kWeaponAccuracy);  //精准度
        float stability = m_MainPlayer.GetWeaponAttribute(m_UId, crucis.attributepipeline.attribenum.AttributeName.kWeaponStability); //稳定性

        // 表里配置的时间是毫秒
        m_LockonTimeParam = (m_WeaponFireData.LockTime - accuracy * m_WeaponFireData.TimeCoefficient) / 1000f;
        m_MaxMissileCountInOneShotParam = (int)(m_WeaponFireData.MagazineNumber + stability * m_WeaponFireData.MagazineQuantityCoefficient);
        m_ReticleHorizontalFOVParam     = m_WeaponFireData.AimingSize;
        m_ReticleAspect = m_WeaponFireData.AngleRange;
        if (m_ReticleAspect == 0)
        {
            Debug.LogWarning(string.Format("--------------------> 导弹类武器表 ID= {0},AngleRange = 0,策划确认下对吗? ", m_WeaponTable.TypeDateSheetld));
        }
        float fieldOfView = m_ReticleAspect == 0 ? 60 : m_ReticleHorizontalFOVParam / m_ReticleAspect;

        m_CrossSightLoic.ChangeVirtualCameraAttribute(fieldOfView, m_ReticleAspect);


        m_FireInterval = WeaponAndCrossSightFactory.CalculateFireInterval(m_MainPlayer, m_WeaponTable.TypeDateSheetld, m_UId, WeaponAndCrossSight.WeaponAndCrossSightTypes.Missile);
    }
Esempio n. 4
0
    public override void Init()
    {
        base.Init();
        m_WeaponFireData = m_CfgEternityProxy.GetWeaponDataOfMining(m_WeaponTable.TypeDateSheetld);

        m_CrossSightInfo = new CrossSightInfo();
        m_CrossSightInfo.m_MaxRayDistance         = m_SkillMaxDistance;
        m_CrossSightInfo.m_CrossSightShape        = CrossSightShape.CrossLine;
        m_CrossSightInfo.m_LineInfo.detectionMode = DetectionMode.All;
        m_CrossSightLoic = new CCrossSightLoic();
        m_CrossSightLoic = new CrossSightLoic_Improve_line(m_CrossSightLoic);
        m_CrossSightLoic.SetCrossSightInfo(m_CrossSightInfo);

        m_FireInterval = WeaponAndCrossSightFactory.CalculateFireInterval(m_MainPlayer, m_WeaponTable.TypeDateSheetld, m_UId, WeaponAndCrossSight.WeaponAndCrossSightTypes.Mining);
    }
    /// <summary>
    /// 转化炉切换
    /// </summary>
    /// <param name="entityEvent"></param>
    private void ReformerWeapons(IComponentEvent entityEvent)
    {
        if (m_IPerceptronTarget.GetCurrentState().IsHasSubState(EnumSubState.Peerless))
        {
            //转化炉模式
            if (!m_SkillProxy.UsingReformer())
            {
                return;
            }

            IReformer reformer = m_SkillProxy.GetReformer();
            if (reformer == null)
            {
                return;
            }
            ulong uid = reformer.GetUID();
            if (!m_IPerceptronTarget.HaveWeaponAndCrossSight(uid))
            {
                WeaponAndCrossSight weaponAndCross = WeaponAndCrossSightFactory.CreatTWeapon(uid,
                                                                                             reformer.GetConfig().Id, reformer.GetBaseConfig().SkillId,
                                                                                             (WeaponAndCrossSight.WeaponAndCrossSightTypes)reformer.GetConfig().Reticle);

                //Debug.LogError(string.Format("创建准星 uid = {0}, tid = {1} , type = {2}, null? {3}", uid, weapon.GetConfig().Id, weapon.GetConfig().Reticle , (weaponAndCross== null)));

                if (weaponAndCross == null)
                {
                    return;
                }
                m_IPerceptronTarget.AddWeaponAndCrossSight(uid, weaponAndCross);
            }
        }
        else
        {
            //非转化炉模式
            m_IPerceptronTarget.DeleReformerWeaponAndCrossSight();
        }
    }
        /// <summary>
        /// 获取武器射速by SkillID
        /// </summary>
        /// <param name="skllId"></param>
        /// <returns></returns>
        private float GetWeaponFireInterval(int skllId)
        {
            if (m_ISpacecraftSkillProperty.GetHeroType() == KHeroType.htPlayer)
            {
                ShipItemsProxy shipItemsProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipItemsProxy) as ShipItemsProxy;
                IShip          ship           = shipItemsProxy.GetCurrentWarShip(m_ISpacecraftSkillProperty.EntityId());
                if (ship != null)
                {
                    IWeapon[] weapons = ship.GetWeaponContainer().GetWeapons();
                    for (int i = 0; i < weapons.Length; i++)
                    {
                        if (weapons[i].GetBaseConfig().SkillId == (ulong)skllId)
                        {
                            return(WeaponAndCrossSightFactory.CalculateFireInterval((SpacecraftEntity)m_ISpacecraftSkillProperty.GetOwner(),
                                                                                    weapons[i].GetConfig().TypeDateSheetld,
                                                                                    weapons[i].GetUID(),
                                                                                    (WeaponAndCrossSight.WeaponAndCrossSightTypes)weapons[i].GetConfig().Reticle));
                        }
                    }
                }
            }

            return(1.0f);
        }
Esempio n. 7
0
    public override void Init()
    {
        base.Init();

        m_WeaponFireData = m_CfgEternityProxy.GetWeaponDataOfShotgun(m_WeaponTable.TypeDateSheetld);
        float accuracy            = m_MainPlayer.GetWeaponAttribute(m_UId, crucis.attributepipeline.attribenum.AttributeName.kWeaponAccuracy);  //精准度
        float stability           = m_MainPlayer.GetWeaponAttribute(m_UId, crucis.attributepipeline.attribenum.AttributeName.kWeaponStability); //稳定性
        float m_SonMaxSpreadAngle = m_WeaponFireData.SonDiffusionAngle - accuracy * m_WeaponFireData.SonDiffusionAngleCoefficient;              //子区域偏移最大角度

        m_RestoreDuration = (m_WeaponFireData.RecoveryTime - stability * m_WeaponFireData.RecoveryTimeCoefficient) / 1000f;
        int sonCount = (int)m_WeaponFireData.SonNumber;


        AimArea mainAimArea = new AimArea();
        // 中心区域覆盖角度
        float MainAreaCoverAngle = m_WeaponFireData.CoreDiameterAngle - accuracy * m_WeaponFireData.CoreDiameterAngleCoefficient;
        int   mainRayCount       = m_WeaponFireData.CoreRadialNumber;

        mainAimArea.Init(false, 0, MainAreaCoverAngle, mainRayCount, m_SkillMaxDistance, sonCount);

        m_AimAreaList.Add(mainAimArea);

        //子区域
        for (int i = 0; i < sonCount; i++)
        {
            AimArea sonAimArea = new AimArea();

            // 子区域覆盖角度
            float SubAimAreaCoverAngle = m_WeaponFireData.SonDiameterAngle - accuracy * m_WeaponFireData.SonDiameterAngleCoefficient;
            int   sonRayCount          = m_WeaponFireData.SonRadialNumber;
            sonAimArea.Init(true, m_SonMaxSpreadAngle, SubAimAreaCoverAngle, sonRayCount, m_SkillMaxDistance, sonCount);
            m_AimAreaList.Add(sonAimArea);
        }

        m_FireInterval = WeaponAndCrossSightFactory.CalculateFireInterval(m_MainPlayer, m_WeaponTable.TypeDateSheetld, m_UId, WeaponAndCrossSight.WeaponAndCrossSightTypes.ShotGun);
    }