public float GetAttachedAttributeByType(WeaponAttributeType attributeType) { int pid = 0; switch (attributeType) { case WeaponAttributeType.BaseDamage: pid = Parts.Bore; break; case WeaponAttributeType.DistanceDecay: pid = Parts.Interlock; break; case WeaponAttributeType.EmitVelocity: case WeaponAttributeType.AttackInterval: pid = Parts.Feed; break; default: return(SingletonManager.Get <WeaponPartsConfigManager>() .GetPartAchiveAttachedAttributeByType(Parts, attributeType)); } float val = SingletonManager.Get <WeaponPartsConfigManager>() .GetPartAchiveAttachedAttributeByType(pid, attributeType); return(val == GlobalConst.AttributeInvalidValue ? 0 : val); }
public float GetPartAchiveAttachedAttributeByType(int partId, WeaponAttributeType attributeType) { if (partId == 0) { return(0); } return(GetPartAttachedAttributes(partId).GetAttribute(attributeType)); }
public float GetAttribute(WeaponAttributeType attributeType) { var length = attributesGuide[(int)attributeType]; if (length > 0) { return(list[length - 1].Val); } return(-999f); }
private void GetPartAchiveAttachedAttributeByType(int partId, WeaponAttributeType attributeType, ref float attrVal) { if (partId > 0) { var result = GetPartAttachedAttributes(partId).GetAttribute(attributeType); if (result != AttributeInvalidConst) // (Math.Abs(result) < Math.Abs(attrVal)|| attrVal==0f)) { attrVal = attrVal == 0f ? result : attrVal * result; } } }
public float GetPartAchiveAttachedAttributeByType(WeaponPartsAchive achive, WeaponAttributeType attributeType) { float attachedVal = 0f; GetPartAchiveAttachedAttributeByType(achive.UpperRail, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Stock, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Magazine, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Muzzle, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.LowerRail, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.SideRail, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Bore, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Feed, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Trigger, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Interlock, attributeType, ref attachedVal); GetPartAchiveAttachedAttributeByType(achive.Brake, attributeType, ref attachedVal); return(attachedVal); }
/// <summary> /// call syncParts before usage /// </summary> /// <param name="attributeType"></param> /// <returns></returns> public float GetAttachedAttributeByType(WeaponAttributeType attributeType) { return(SingletonManager.Get <WeaponPartsConfigManager>().GetPartAchiveAttachedAttributeByType(partsAchiveCache, attributeType)); }
public ChangeByPartAttribute(WeaponAttributeType attributeType, PartModifyType modifyType) { AttributeType = attributeType; ModifyType = modifyType; }