bool ContainsType(int x, int y, RLCharacter.RLTypes t) { for (int i = objects.Count - 1; i >= 0; i--) { if (objects[i].positionI.x == x && objects[i].positionI.y == y && objects [i].hasTypes.Contains(t)) { return(true); } } return(false); }
// should add support for muliple types eventually // perhaps it would be better for types to nest themselves? // also, the map should really contain multiple layers, // all of which are expressed / exposed through these interfaces void OverlapCheck(OverlapCallback fn, RLCharacter.RLTypes ta, RLCharacter.RLTypes tb) { if (objects.Count > 0) { for (int i = objects.Count - 1; i >= 0; i--) { if (objects.Count > i && objects [i].hasTypes.Contains(ta)) { for (int j = i; j >= 0; j--) { if (objects.Count >= j && objects.Count >= i) { if (i != j && objects.Count > j && objects [j].hasTypes.Contains(tb) && objects [i].positionI.Equals(objects [j].positionI)) { fn(objects [i], objects [j]); } } } } } } }