Added Furnance and smelting
This commit is contained in:
@@ -123,7 +123,10 @@ public sealed class NetworkPhysicalLeverInteractable :
|
||||
}
|
||||
|
||||
if (TryCalculateTargetValue(playerObject, out float targetValue))
|
||||
{
|
||||
MoveTowardsValue(targetValue);
|
||||
UpdateActivationAtEndpoint();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -198,8 +201,7 @@ public sealed class NetworkPhysicalLeverInteractable :
|
||||
hasSnapTarget = false;
|
||||
bool snappedToMaximum = snapTargetValue >= 0.5f;
|
||||
|
||||
if (isActivated.Value != snappedToMaximum)
|
||||
isActivated.Value = snappedToMaximum;
|
||||
SetActivation(snappedToMaximum);
|
||||
|
||||
bool movedAwayFromInitialPosition =
|
||||
!Mathf.Approximately(snapTargetValue, InitialPositionValue);
|
||||
@@ -209,6 +211,22 @@ public sealed class NetworkPhysicalLeverInteractable :
|
||||
: -1f;
|
||||
}
|
||||
|
||||
private void UpdateActivationAtEndpoint()
|
||||
{
|
||||
const float endpointTolerance = 0.001f;
|
||||
|
||||
if (synchronizedValue.Value >= 1f - endpointTolerance)
|
||||
SetActivation(true);
|
||||
else if (synchronizedValue.Value <= endpointTolerance)
|
||||
SetActivation(false);
|
||||
}
|
||||
|
||||
private void SetActivation(bool activated)
|
||||
{
|
||||
if (isActivated.Value != activated)
|
||||
isActivated.Value = activated;
|
||||
}
|
||||
|
||||
private bool IsPlayerWithinControlDistance(NetworkObject playerObject)
|
||||
{
|
||||
float maximumDistanceSquared = maximumControlDistance * maximumControlDistance;
|
||||
|
||||
Reference in New Issue
Block a user