示例#1
0
 public Possibility AddPossibility(Possibility pos)
 {
     if (pos.Weight > 0)
     {
         pos.Offset   = TotalWeight;//offset at end of last choice
         TotalWeight += pos.Weight;
         possibilities.Add(pos);
     }
     return(pos);
 }
示例#2
0
        public static bool SingleChoice(Possibility pos)
        {
            float val = (float)(GenericsClass.Random.NextDouble() * 1);

            return(val < pos.Weight);
        }
示例#3
0
        public Possibility AddPossibility(float weight, string name)
        {
            Possibility pos = new Possibility(weight, name);

            return(AddPossibility(pos));
        }
示例#4
0
 public Choice(Possibility pos)
     : base()
 {
     AddPossibility(pos);
 }