public WeaponPart GenerateRandomWeaponPart( PartType forcePart = PartType.NONE ) { WeaponPart part = ScriptableObject.CreateInstance <WeaponPart>(); PartType partType = forcePart; if (partType == PartType.NONE) { partType = (PartType)(UnityEngine.Random.Range( 0, WeaponPart.GetPartTypeCount() ) + 1); } switch (partType) { case PartType.QUIVER: part.RandomizeQuiver(); break; case PartType.BARREL: part.RandomizeBarrel(); break; case PartType.STOCK: part.RandomizeStock(); break; case PartType.HANDLE: part.RandomizeHandle(); break; case PartType.SIGHT: part.RandomizeSight(); break; case PartType.STRING: part.RandomizeString(); break; } return(part); }