예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 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);
     }
 }