Exemple #1
0
        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);
        }
Exemple #2
0
 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);
        }
Exemple #4
0
 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;
         }
     }
 }
Exemple #5
0
        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);
        }
Exemple #6
0
 /// <summary>
 /// call syncParts before usage
 /// </summary>
 /// <param name="attributeType"></param>
 /// <returns></returns>
 public float GetAttachedAttributeByType(WeaponAttributeType attributeType)
 {
     return(SingletonManager.Get <WeaponPartsConfigManager>().GetPartAchiveAttachedAttributeByType(partsAchiveCache, attributeType));
 }
Exemple #7
0
 public ChangeByPartAttribute(WeaponAttributeType attributeType, PartModifyType modifyType)
 {
     AttributeType = attributeType;
     ModifyType    = modifyType;
 }