##骨骼位置/权重发射物##
配置表更改:
在ShootWeapon类中的InjectsId获取发射列表
private List
{
isSpecialInject = true;
injectBonePair = new Dictionary<string, string>();
List
BasePropSaveData basePropSaveData = GetHandSaveData();
if (basePropSaveData == null || string.IsNullOrEmpty(basePropSaveData.propId))
{
Debug.LogError("未知原因,找不到手持装备,装备Id:" + ItemId);
return new List<string>();
}
string ammoId = basePropSaveData.EquipSepcificData.ammoId;
List<string> injectsList = new List<string>();
InjectSettingEx injectSettingEx = InjectSettingsEx.Find(id => id.ammoId == ammoId || id.ammoId == "-1");
#if UNITY_EDITOR
if (injectSettingEx == null && EditorValues.UnlimitBullet && equipmentCfgAttackInjectSettingsEx.Count > 0)
{
ammoId = equipmentCfgAttackInjectSettingsEx[0].ammoId;
injectSettingEx = InjectSettingsEx.Find(id => id.ammoId == ammoId || id.ammoId == "-1");
}
#endif
while (injectSettingEx != null)
{
List<string> injectsIds = new List<string>();
List<float> iteminjectRateWeight = new List<float>();
#region 平均权重
foreach (var itemdate in injectSettingEx.injectItems)
{
injectsIds.Add(itemdate.injectId);
iteminjectRateWeight.Add(itemdate.itemWeight);
injectBonePair.Add(itemdate.injectId, itemdate.boneName);
}
int averageCount = iteminjectRateWeight.Count;
float averageWeight = 100f;
List<int> averageIndex = new List<int>();
for (int i = 0; i < iteminjectRateWeight.Count; i++)
{
if (!iteminjectRateWeight[i].Equals(0))
{
averageCount--;
averageWeight -= iteminjectRateWeight[i];
}
else
averageIndex.Add(i);
}
foreach (var item in averageIndex)
{
iteminjectRateWeight[item] = averageWeight / averageCount;
}
#endregion
injectsList.Add(injectsIds.GetRandom(100, iteminjectRateWeight.ToArray()));
InjectSettingsEx.Remove(injectSettingEx);
injectSettingEx = InjectSettingsEx.Find(id => id.ammoId == ammoId || id.ammoId == "-1");
}
return injectsList;
}
##额外发射物##
private List
{
List
foreach (var addition in additionalInjectSettings)
{
if (Random.value*100 < addition.rate)
merge.Add(addition.injectId);
}
return merge;
}