public void CheckSectionClear()
{
// This is certainly not the most efficient way to do this,
// but it's easy to understand and maintain, and didn't require
// refactoring half the dungeon system.
for (int i = 0; i < this.Regions.Count; ++i)
{
var floorRegion = this.Regions[i] as DungeonFloorRegion;
if (floorRegion == null)
continue;
for (int j = 1; j <= floorRegion.Floor.Sections.Count; ++j)
{
var id = i * 1000 + j;
// Already called clear?
if (_clearedSections.Contains(id))
continue;
// If clear hasn't been called yet, but the section has
// been cleared, call the event.
if (floorRegion.Floor.Sections[j - 1].HasBeenCleared)
{
_clearedSections.Add(id);
this.Script.OnSectionCleared(this, i, j);
}
}
}
}