Example #1
0
	public void UpdateSuspendedRules(float dt, World world, List<int> toRemove, RuleTable ActiveRules) { if (ActiveRules.ActiveIndices.Top > 0 && frame == World.frame)
{
  for (int i = 0; i < ActiveRules.ActiveIndices.Top; i++)
  {
    var x = ActiveRules.ActiveIndices.Elements[i];
    switch (x)
    {case 0:
        if (this.Rule0(dt, world) == RuleResult.Done)
        {
          ActiveRules.ActiveSlots[i] = false;
          ActiveRules.ActiveIndices.Top--;
        }
        else{          
          ActiveRules.SupportSlots[0] = true;
          ActiveRules.SupportStack.Push(x);
        }
        break;
case 3:
        if (this.Rule3(dt, world) == RuleResult.Done)
        {
          ActiveRules.ActiveSlots[i] = false;
          ActiveRules.ActiveIndices.Top--;
        }
        else{          
          ActiveRules.SupportSlots[3] = true;
          ActiveRules.SupportStack.Push(x);
        }
        break;

      default:
        break;
    }
  }
  ActiveRules.ActiveIndices.Clear();
  ActiveRules.Clear();

  var tmp = ActiveRules.SupportStack;
  var tmp1 = ActiveRules.SupportSlots;

  ActiveRules.SupportStack = ActiveRules.ActiveIndices;
  ActiveRules.SupportSlots = ActiveRules.ActiveSlots;


  ActiveRules.ActiveIndices = tmp;
  ActiveRules.ActiveSlots = tmp1;

  if (ActiveRules.ActiveIndices.Top == 0)
    toRemove.Add(ID);
}else
{
  if (this.frame != World.frame)
    toRemove.Add(ID);
} }