Park/Paths/IPathBlocker.cs
using System;
namespace HC3;
/// <summary>
/// Interface for components that can block path connections and navigation
/// </summary>
public interface IPathBlocker
{
/// <summary>
/// The game object this component is attached to
/// </summary>
GameObject GameObject { get; }
/// <summary>
/// Which directions should block path connections
/// </summary>
[Property, Feature( "Navigation" )]
PathMask BlockedDirections { get; set; }
/// <summary>
/// Which directions should block AI navigation (for one-way paths etc)
/// </summary>
[Property, Feature( "Navigation" )]
PathMask BlockedNavigation { get; set; }
/// <summary>
/// Helper method to get rotated mask based on component's rotation
/// </summary>
PathMask GetRotatedMask( PathMask mask )
{
var yaw = (int)MathF.Round( GameObject.WorldRotation.Yaw() / 90f );
while ( yaw < 0 ) yaw += 4;
yaw %= 4;
for ( int i = 0; i < yaw; i++ )
mask = mask.Rotate90DegreesClockwise();
return mask;
}
}