예제 #1
0
        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);
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
 public ColorInfo Orange(ColoredObjectType type)
 {
     return(this.Color(type, ObjectColor.orange));
 }
예제 #4
0
 public ColorInfo Green(ColoredObjectType type)
 {
     return(this.Color(type, ObjectColor.green));
 }
예제 #5
0
 public ColorInfo Yellow(ColoredObjectType type)
 {
     return(this.Color(type, ObjectColor.yellow));
 }
예제 #6
0
 public ColorInfo Blue(ColoredObjectType type)
 {
     return(this.Color(type, ObjectColor.blue));
 }
예제 #7
0
 public ColorInfo White(ColoredObjectType type)
 {
     return(this.Color(type, ObjectColor.white));
 }
예제 #8
0
 public bool TryGetColorList(ColoredObjectType type, out List <ColorInfo> oColors)
 {
     return(colors.TryGetValue(type, out oColors));
 }