I'm trying to create a function to generate a random object from a subset of objects, and from that contain a value from a subset of values.
Currently I'm using switch/case and it works, I was just curious if there was a better way.
Class containing main function:
public class Loot : MonoBehaviour, IPointerClickHandler {
    enum BaseType {Sword, Dagger};
    enum BaseQuality {Weak, Normal, Strong}
    public void OnPointerClick(PointerEventData eventData) {
        Array baseTypes = Enum.GetValues(typeof(BaseType));
        Array baseQualities = Enum.GetValues(typeof(BaseQuality));
        System.Random random = new System.Random();
        String baseType = baseTypes.GetValue(random.Next(baseTypes.Length)).ToString();
        String baseQuality = baseQualities.GetValue(random.Next(baseQualities.Length)).ToString();
        int damage = 0;
        switch(baseQuality) {
            case "Weak":
                damage = -1;
                break;
            case "Strong":
                damage = 1;
                break;
        }
        Weapon weapon = new Weapon();
        switch(baseType) {
            case "Sword":
                weapon = new Sword();
                break;
            case "Dagger":
                weapon = new Dagger();
                break;
        }
        weapon.Name = baseQuality + " " + baseType;
        weapon.Attack += damage;
        Debug.Log("created " + weapon.Name + " with attack " + weapon.Attack);
    }
}
Weapon class:
public class Weapon : Item {
    public int Attack { get; set; }
}
Sword class (Dagger class is essentially the same):
public class Sword : Weapon {
    public Sword() {
        Attack += 3;
    }
}
This is working as is, but I was curious if there's a more dynamic way to do this for when I implement more weapon types and qualities.
 
     
     
    