• 注册
  • 玩家交流 玩家交流 关注:2097 内容:15400

    3.0已经有无人机的机枪的代码了

  • 查看作者
  • 打赏作者
  • 当前位置: 七日杀中文网 > 玩家交流 > 正文
  • 玩家交流
  • Lv.7
    武林萌主

    3.0已经有无人机的机枪的代码了

    public override void Init()
            {
                damageMultiplier = new DamageMultiplier(entityProperties);
                WeaponJoint = entity.transform.FindInChilds("WristRight");
                if (entityProperties.Values.ContainsKey("MaxDistance"))
                {
                    range = StringParsers.ParseFloat(entityProperties.Values["MaxDistance"]);
                }
    
                spreadHorizontal = new Vector2(-1f, 1f);
                spreadVertical = new Vector2(-1f, 1f);
                if (entityProperties.Values.ContainsKey("RaySpread"))
                {
                    float num = StringParsers.ParseFloat(entityProperties.Values["RaySpread"]);
                    num *= 0.5f;
                    spreadHorizontal = new Vector2(0f - num, num);
                    spreadVertical = new Vector2(0f - num, num);
                }
    
                if (entityProperties.Values.ContainsKey("RayCount"))
                {
                    RayCount = int.Parse(entityProperties.Values["RayCount"]);
                }
    
                if (entityProperties.Values.ContainsKey("BurstRoundCount"))
                {
                    burstRoundCountMax = int.Parse(entityProperties.Values["BurstRoundCount"]);
                }
    
                if (entityProperties.Values.ContainsKey("BurstFireRate"))
                {
                    burstFireRate = Mathf.Max(StringParsers.ParseFloat(entityProperties.Values["BurstFireRate"]), 0.1f);
                }
    
                actionTime = burstFireRate * (float)burstRoundCountMax;
                if (entityProperties.Values.ContainsKey("CooldownTime"))
                {
                    cooldown = StringParsers.ParseFloat(entityProperties.Values["CooldownTime"]);
                }
    
                if (entityProperties.Values.ContainsKey("EntityDamage"))
                {
                    entityDamage = int.Parse(entityProperties.Values["EntityDamage"]);
                }
    
                buffActions = new List<string>();
                if (entityProperties.Values.ContainsKey("Buff"))
                {
                    string[] collection = entityProperties.Values["Buff"].Replace(" ", "").Split(',', StringSplitOptions.None);
                    buffActions.AddRange(collection);
                }
            }

    可以看到无人机的机枪是有其他武器的一系列属性的

    public void _fireWeapon()
            {
                EntityDrone entityDrone = entity as EntityDrone;
                Vector3 position = WeaponJoint.transform.position;
                Vector3 vector = target.getChestPosition() - Origin.position;
                EntityAlive entityAlive = GameManager.Instance.World.GetEntity(entityDrone.belongsPlayerId) as EntityAlive;
                GameRandom gameRandom = GameManager.Instance.World.GetGameRandom();
                _ = entityDrone.OriginalItemValue.ItemClass.ItemTags;
                int num = (int)EffectManager.GetValue(PassiveEffects.RoundRayCount, entityDrone.OriginalItemValue, RayCount, entityAlive, null, entityDrone.OriginalItemValue.ItemClass.ItemTags, calcEquipment: true, calcHoldingItem: false);
                float value = EffectManager.GetValue(PassiveEffects.MaxRange, entityDrone.OriginalItemValue, range, entityAlive, null, entityDrone.OriginalItemValue.ItemClass.ItemTags, calcEquipment: true, calcHoldingItem: false);
                for (int i = 0; i < num; i++)
                {
                    Vector3 normalized = (vector - position).normalized;
                    normalized = Quaternion.Euler(gameRandom.RandomRange(spreadHorizontal.x, spreadHorizontal.y), gameRandom.RandomRange(spreadVertical.x, spreadVertical.y), 0f) * normalized;
                    Ray ray = new Ray(position + Origin.position, normalized);
                    int num2 = Mathf.FloorToInt(EffectManager.GetValue(PassiveEffects.EntityPenetrationCount, entityDrone.OriginalItemValue, 0f, entityAlive, null, entityDrone.OriginalItemValue.ItemClass.ItemTags, calcEquipment: true, calcHoldingItem: false));
                    num2++;
                    int num3 = Mathf.FloorToInt(EffectManager.GetValue(PassiveEffects.BlockPenetrationFactor, entityDrone.OriginalItemValue, 1f, entityAlive, null, entityDrone.OriginalItemValue.ItemClass.ItemTags, calcEquipment: true, calcHoldingItem: false));
                    EntityAlive entityAlive2 = null;
                    for (int j = 0; j < num2; j++)
                    {
                        if (!Voxel.Raycast(GameManager.Instance.World, ray, value, -538751005, 8, 0f))
                        {
                            continue;
                        }
    
                        WorldRayHitInfo worldRayHitInfo = Voxel.voxelRayHitInfo.Clone();
                        if (worldRayHitInfo.tag.StartsWith("E_"))
                        {
                            string bodyPartName;
                            EntityAlive entityAlive3 = ItemActionAttack.FindHitEntityNoTagCheck(worldRayHitInfo, out bodyPartName) as EntityAlive;
                            if (entityAlive2 == entityAlive3)
                            {
                                ray.origin = worldRayHitInfo.hit.pos + ray.direction * 0.1f;
                                j--;
                                continue;
                            }
    
                            entityAlive2 = entityAlive3;
                        }
                        else
                        {
                            j += Mathf.FloorToInt((float)ItemActionAttack.GetBlockHit(GameManager.Instance.World, worldRayHitInfo).Block.MaxDamage / (float)num3);
                        }
    
                        ItemActionAttack.Hit(worldRayHitInfo, entityDrone.belongsPlayerId, EnumDamageTypes.Piercing, GetDamageBlock(entityDrone.OriginalItemValue, BlockValue.Air, GameManager.Instance.World.GetEntity(entityDrone.belongsPlayerId) as EntityAlive, 1), GetDamageEntity(entityDrone.OriginalItemValue, GameManager.Instance.World.GetEntity(entityDrone.belongsPlayerId) as EntityAlive, 1), 1f, entityDrone.OriginalItemValue.PercentUsesLeft, 0f, 0f, "bullet", damageMultiplier, buffActions, new ItemActionAttack.AttackHitInfo(), 1, 0, 0f, null, null, ItemActionAttack.EnumAttackMode.RealNoHarvesting, null, entityDrone.entityId, entityDrone.OriginalItemValue);
                    }
                }
    
                ParticleEffect pe = new ParticleEffect("nozzleflashuzi", WeaponJoint.position + Origin.position, Quaternion.Euler(0f, 180f, 0f), 1f, Color.white, "Electricity/Turret/turret_fire", WeaponJoint);
                SpawnParticleEffect(pe, -1);
                float lightValue = GameManager.Instance.World.GetLightBrightness(World.worldToBlockPos(entity.position)) / 2f;
                ParticleEffect pe2 = new ParticleEffect("nozzlesmokeuzi", WeaponJoint.position + Origin.position, lightValue, new Color(1f, 1f, 1f, 0.3f), null, WeaponJoint, _OLDCreateColliders: false);
                SpawnParticleEffect(pe2, -1);
                burstRoundCount++;
                if ((int)EffectManager.GetValue(PassiveEffects.MagazineSize, entityDrone.OriginalItemValue) > 0)
                {
                    entityDrone.AmmoCount--;
                }
    
                entityDrone.OriginalItemValue.UseTimes += EffectManager.GetValue(PassiveEffects.DegradationPerUse, entityDrone.OriginalItemValue, 1f, entityAlive, null, entityDrone.OriginalItemValue.ItemClass.ItemTags, calcEquipment: true, calcHoldingItem: false) * ItemAction.ItemDegradationModifier;
            }

    开火逻辑里,造成伤害单位还是无人机的所属玩家。

    "点赞是美意,打赏是鼓励"

    Lv.6
    2.6之前的xml文件中,就能查到被注释的无人机机枪模组,模型资源文件也包含了无人机机枪模型(可调用),本人不懂dll,所以在尝试改ui,取消模组注释,游戏中安装模组后,并没有发生主动攻击情况,无奈搁置

    兴趣型mod玩家,xml忠实爱好者,只喜欢直连类型xml创作

    回复
    Lv.7

    我的无人机攻击模组在2.6中已经实现了攻击功能,只是没有发布出来。但是,由于我是编程能力有限,适配3.0还有点困难。

    回复
    Lv.7

    3.0的无人机径向菜单好像被硬编码了,还在想办法解决

    回复
    创建和谐社区,请勿发表 不符合法律法规 的内容,社区不是大家 发泄个人情绪 的地方
    获取金币请查看 网页右侧悬浮栏领金币按钮 ,做 签到社区任务 获得金币!

    请登录之后再进行评论

    登录
    • 大版主
    • 小版主
  • 摸鱼摸鱼摸
    摸鱼摸鱼摸
    交流吹水群967780922
  • 柒月白风清
    柒月白风清
    一只小萌新,万年摸鱼党!已经脱坑了。。。
  • Cure_805
    Cure_805
    晚上在睡觉,白天在工作,不一定能及时回复,有事可以留言!
  • 至善丶丶
    至善丶丶
    群:1050040662 定制/开服/地图制作/价格公道
  • 银河
    银河
    CSOL大灾变欢迎你的到来。QQ群:967780922
  • 无名氏_217
  • 安安
    安安
    大背包、常显、叠加、除草树,唯一作者QQ383125283
  • happy!
    happy!
    住院中
  • 咖啡很苦
  • 妮可Neko
    妮可Neko
    无聊写些小玩意儿
  • 社会你小七
    社会你小七
    代表作:七日杀反作弊、七日杀云黑、七日杀BOT、七日杀云商城
  • yichen
    yichen
    无限恐怖762251937/不死者末日1080207504
  • 暂没有数据

    赞助广告位

  • 点击展示图片即可一键加入QQ群
    赞助广告:100R/月 目前空缺广告位:0

    分享网站

  • 繁体中文
  • 任务
  • 动态
  • 到底部
  • 帖子间隔 侧栏位置: