18 lines
499 B
C#
18 lines
499 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
public sealed class SetPlayerJumpBehavior : NodeBehavior
|
|
{
|
|
public override void OnRun(string inputPortName)
|
|
{
|
|
if (base.IsAuthoritative && string.Equals(inputPortName, "Set", StringComparison.Ordinal))
|
|
{
|
|
int inputPlayerId = GetInputPlayerId("Player");
|
|
float height = Mathf.Max(0f, (float)GetInputNumber("Jump"));
|
|
NodePlayerLocomotionRpc.Ensure()?.TrySetJumpHeight(inputPlayerId, height);
|
|
TriggerOutput("Done");
|
|
}
|
|
}
|
|
}
|