public System.Enum RandSubType(BaseBlockType baseType) { int subEnumLength; int subRand; switch (baseType) { case BaseBlockType.Animals: subEnumLength = System.Enum.GetValues(typeof(AnimalType)).Length; subRand = Random.Range(0, subEnumLength); return((AnimalType)subRand); case BaseBlockType.Geometry: subEnumLength = System.Enum.GetValues(typeof(GeometaryType)).Length; subRand = Random.Range(0, subEnumLength); return((GeometaryType)subRand); case BaseBlockType.Letters: subEnumLength = System.Enum.GetValues(typeof(LetterBlockType)).Length; subRand = Random.Range(0, subEnumLength); return((LetterBlockType)subRand); default: Debug.WriteLine("Block Sub Type Selection not working"); return(null); } }
public BlockType(BaseBlockType baseT) { //Set base type baseType = baseT; //Set sub type subType = RandSubType(baseType); }
public BlockType(BaseBlockType baseT, System.Enum subT) { //Set base type baseType = baseT; //Set sub type subType = subT; //possibly need to perform checks that sub-type is acceptable }
public BlockType(bool random) { if (random) { //Set base type int enumLength = System.Enum.GetValues(typeof(BaseBlockType)).Length; int rand = Random.Range(0, enumLength); baseType = (BaseBlockType)rand; //Set sub type subType = RandSubType(baseType); } }