A game about forced loneliness, made by TACStudios
1using System.Reflection;
2
3namespace UnityEditor.ShaderGraph
4{
5 [Title("Math", "Wave", "Square Wave")]
6 class SquareWaveNode : CodeFunctionNode
7 {
8 public SquareWaveNode()
9 {
10 name = "Square Wave";
11 }
12
13 protected override MethodInfo GetFunctionToConvert()
14 {
15 return GetType().GetMethod("SquareWave", BindingFlags.Static | BindingFlags.NonPublic);
16 }
17
18 static string SquareWave(
19 [Slot(0, Binding.None)] DynamicDimensionVector In,
20 [Slot(1, Binding.None)] out DynamicDimensionVector Out)
21 {
22 return
23@"
24{
25 Out = 1.0 - 2.0 * round(frac(In));
26}
27";
28 }
29 }
30}