17 lines
331 B
C#
17 lines
331 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
public sealed class SquareRootBehavior : GuardedValueNodeBehavior
|
|
{
|
|
protected override void RecomputeCore()
|
|
{
|
|
double num = GetInputNumber("Value");
|
|
if (num < 0.0)
|
|
{
|
|
num = 0.0;
|
|
}
|
|
SetOutputValueIfChanged("Output", BSValue.FromNumber(Math.Sqrt(num)));
|
|
}
|
|
}
|