public override bool Contains(IntVector2 position) { var containingRegions = Regions.FindAll(region => region.Contains(position)); foreach (var containingRegion in containingRegions) { foreach (var space in containingRegion.Spaces) { if (space.Contains(position)) { return(true); } else { foreach (var direction in Directions.Compass) { if (space.Contains(position + (direction * MetalThickness))) { return(true); } } } } } return(false); }
public override FeatureTypes GetFeatureType(IntVector2 position) { var containingRegions = Regions.FindAll(region => region.Contains(position)); foreach (var containingRegion in containingRegions) { var containingSpace = containingRegion.Spaces.Find(space => space.Contains(position)); if (containingSpace != null) { return(containingSpace.GetFeatureType(position)); } } return(FeatureTypes.None); }
public override Space GetContainingSpace(IntVector2 position) { var containingRegions = Regions.FindAll(region => region.Contains(position)); foreach (var containingRegion in containingRegions) { foreach (var space in containingRegion.Spaces) { if (space.Contains(position)) { return(space); } } } return(null); }
public override BlockTypes GetBlockType(IntVector2 position) { if (!Contains(position)) { throw new System.ArgumentOutOfRangeException($"{Name} does not contain {position}. Cannot get block."); } else if (_blockOverride.TryGetValue(position, out var overrideType)) { return(overrideType); } else { var containingRegions = Regions.FindAll(region => region.Contains(position)); foreach (var containingRegion in containingRegions) { var containingSpace = containingRegion.Spaces.Find(space => space.Contains(position)); if (containingSpace != null) { return(containingSpace.GetBlockType(position)); } } return(BlockTypes.SteelPlate); } }