public AbstractGameplay getNext(AbstractGameplay current, ResourceState resourceState) { List<AbstractGameplay> possibleGameplays = new List<AbstractGameplay>(); foreach (AbstractGameplay ag in gameplays) { if (ag.getPredecessors().Contains(current) && ag.getConstraint().isSatisfied(resourceState)) { possibleGameplays.Add(ag); } } if (possibleGameplays.Count == 0) { return null; } return possibleGameplays[rndGen.Next(possibleGameplays.Count)]; }
public void registerGameplay(AbstractGameplay gameplay) { gameplays.Add(gameplay); }