EVERYTHING
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[DisallowMultipleComponent]
|
||||
public sealed class ForceBehavior : NodeBehavior
|
||||
{
|
||||
public override void OnRun(string inputPortName)
|
||||
{
|
||||
if (!base.IsAuthoritative || !string.Equals(inputPortName, "Force", StringComparison.Ordinal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int inputPlayerId = GetInputPlayerId("Player");
|
||||
if (inputPlayerId <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Vector3 vector = new Vector3((float)GetInputNumber("X"), (float)GetInputNumber("Y"), (float)GetInputNumber("Z"));
|
||||
float num = Mathf.Max(0f, (float)GetInputNumber("Strength"));
|
||||
if (!(vector.sqrMagnitude <= 0.0001f) && !(num <= 0.0001f))
|
||||
{
|
||||
Transform transform = NodePlayerUtility.ResolveHeadTransform(NodePlayerUtility.ResolvePlayer(inputPlayerId));
|
||||
if (!(transform == null))
|
||||
{
|
||||
Vector3 vector2 = vector.normalized * num * NodePlayerUtility.GetVoxelSize();
|
||||
Vector3 position = transform.position + vector2;
|
||||
NodePlayerTransformRpc.Ensure()?.TryMovePlayer(inputPlayerId, position);
|
||||
TriggerOutput("Done");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user