public ColorInfo Color(ColoredObjectType type, ObjectColor color) { List <ColorInfo> list; if (this.colors.TryGetValue(type, out list)) { return(list.FirstOrDefault(c => c.color == color)); } return(null); }
public ColorInfo GenColor(ColoredObjectType type, float remapWeight = 0f) { float accum = 0f; float[] weights = new float[5]; weights[0] = Orange(type).prob; accum += weights[0]; weights[1] = Green(type).prob; accum += weights[1]; weights[2] = Yellow(type).prob; accum += weights[2]; weights[3] = Blue(type).prob; accum += weights[3]; weights[4] = 1f - accum; weights = RemapWeights(weights, remapWeight); int index = Rand.RandomIndex(weights); switch (index) { case 0: return(Orange(type)); case 1: return(Green(type)); case 2: return(Yellow(type)); case 3: return(Blue(type)); default: return(White(type)); } }
public ColorInfo Orange(ColoredObjectType type) { return(this.Color(type, ObjectColor.orange)); }
public ColorInfo Green(ColoredObjectType type) { return(this.Color(type, ObjectColor.green)); }
public ColorInfo Yellow(ColoredObjectType type) { return(this.Color(type, ObjectColor.yellow)); }
public ColorInfo Blue(ColoredObjectType type) { return(this.Color(type, ObjectColor.blue)); }
public ColorInfo White(ColoredObjectType type) { return(this.Color(type, ObjectColor.white)); }
public bool TryGetColorList(ColoredObjectType type, out List <ColorInfo> oColors) { return(colors.TryGetValue(type, out oColors)); }