예제 #1
0
    /// <summary>
    /// 获取当前武器武器准星对象
    /// </summary>
    /// <returns></returns>
    public WeaponAndCrossSight GetCurrentWeaponAndCrossSight()
    {
        SpacecraftEntity mainPlayer = m_GameplayProxy.GetEntityById <SpacecraftEntity>(m_GameplayProxy.GetMainPlayerUID());

        if (mainPlayer == null)
        {
            return(null);
        }

        WeaponAndCrossSight result = null;

        if (UsingReformer())
        {
            //转化炉武器
            IReformer reformer = GetReformer();
            if (reformer != null && mainPlayer.HaveWeaponAndCrossSight(reformer.GetUID()))
            {
                result = mainPlayer.GetWeaponAndCrossSight(reformer.GetUID());
            }
        }
        else
        {
            //普通武器
            IWeapon weapon = GetCurrentWeapon();
            if (weapon != null && mainPlayer.HaveWeaponAndCrossSight(weapon.GetUID()))
            {
                result = mainPlayer.GetWeaponAndCrossSight(weapon.GetUID());
            }
        }

        return(result);
    }