public NinjaDescription GetLastDescription(NinjaDescription current) { currentDescriptions.Remove(current); var newDescription = ninjaBank.GetPreviousDescription(current); while (currentDescriptions.Contains(newDescription)) { newDescription = ninjaBank.GetPreviousDescription(newDescription); } currentDescriptions.Add(newDescription); return(newDescription); }
public NinjaDescription GetPreviousDescription(NinjaDescription current) { var index = Array.IndexOf(ninjaDescriptions, current); return(index == 0 ? ninjaDescriptions[Count - 1] : ninjaDescriptions[index - 1]); }
public NinjaDescription GetNextDescription(NinjaDescription current) { var index = Array.IndexOf(ninjaDescriptions, current); return(ninjaDescriptions[(index + 1) % Count]); }