Пример #1
0
        public bool TrySet(IPlaceable <T> placeable, Vector2Int worldPos)
        {
            List <Vector2Int> positions = CalculatePositionWithOffset(placeable.GetOffsetPositions(), worldPos);

            if (!IsPlaceable(positions))
            {
                return(false);
            }
            foreach (var position in positions)
            {
                buildings[position.x, position.y] = placeable.GetT();
            }
            return(true);
        }
Пример #2
0
        public void Remove(IPlaceable <T> placeable)
        {
            var t = placeable.GetT();

            for (int x = 0; x < buildings.GetLength(0); x++)
            {
                for (int y = 0; y < buildings.GetLength(1); y++)
                {
                    if (buildings[x, y] != null && buildings[x, y].Equals(t))
                    {
                        buildings[x, y] = null;
                    }
                }
            }
        }