public void DoAction() { controlValue = new Condition(); boxerAction ba = null; if (r.Next(100) < 90) { foreach (var cond in conditions) { ba = cond.GetAction(enemy.bs.BS); controlValue = cond; if (ba != null) { ba.Invoke(); return; } } if (ba == null) { CreateNewCondition(); ba = conditions[conditions.Count - 1].GetAction(enemy.bs.BS); controlValue = conditions[conditions.Count - 1]; ba.Invoke(); return; } } else { CreateNewCondition(); SortConditions(); foreach (var cond in conditions) { ba = cond.GetAction(enemy.bs.BS); controlValue = cond; if (ba != null) { ba.Invoke(); return; } } if (ba == null) { CreateNewCondition(); ba = conditions[conditions.Count - 1].GetAction(enemy.bs.BS); controlValue = conditions[conditions.Count - 1]; ba.Invoke(); return; } } }
public Condition(BoxerStates _bs, boxerAction _ba) { bs = _bs; ba = _ba; }