Building Socket

You can find all the information about Building Socket here.

Handles the snapping of Building Parts according they offset position, rotation or scale.

It is possible to create new snapping points within each socket to enable snapping of a specific Building Part onto it.

When a Building Socket is occupied by a Building Part, it becomes reserved for that "Type". This meaning that no other Building Parts of the same type can be attached to it as long as the Building Part is present on the socket.

Explore fields description in the Inspector by hovering your cursor over them. You can find more information about this here: Tooltip Attribute.


API

You can access this class by including the following namespace:

using EasyBuildSystem.Features.Runtime.Buildings.Socket;

Here is a list of all the events and methods of this component that can be called:

Methods

/// <summary>
/// Get the snapping point settings that can fit the specified Building Part.
/// </summary>
/// <param name="part">The Building Part to check for snapping points.</param>
/// <returns>The snapping point settings that can fit the Building Part.</returns>
SnappingPointSettings snapSettings = GetOffset(BuildingPart part);

/// <summary>
/// Snap a preview to a specified snapping point settings with an offset rotation.
/// </summary>
/// <param name="buildingPart">The Building Part to be snapped.</param>
/// <param name="offsetSettings">The snapping point settings to snap to.</param>
/// <param name="offsetRotation">The offset rotation to apply to the snapped Building Part.</param>
/// <returns>True if the snap operation is successful, false otherwise.</returns>
Snap(BuildingPart buildingPart, SnappingPointSettings offsetSettings, Vector3 offsetRotation);

/// <summary>
/// Check if this Building Part can fit with the specified Building Part.
/// </summary>
/// <param name="buildingPart">The Building Part to check for fit.</param>
/// <returns>True if the Building Part can fit, false otherwise.</returns>
bool canFit = IsFitting(BuildingPart buildingPart);

/// <summary>
/// Check if the socket is busy with the specified Building Part.
/// </summary>
/// <param name="part">The Building Part to check for occupancy.</param>
/// <returns>True if the socket is busy, false otherwise.</returns>.
bool isBusy = IsBusy(BuildingPart buildingPart);

All of the methods related to this component can be found in the file "BuildingSocket.cs". If you have any specific questions about the API, feel free to contact us.

Last updated