A game about forced loneliness, made by TACStudios
at master 33 lines 893 B view raw
1using UnityEngine; 2using System.Reflection; 3 4namespace UnityEditor.ShaderGraph 5{ 6 [Title("Math", "Range", "Random Range")] 7 class RandomRangeNode : CodeFunctionNode 8 { 9 public RandomRangeNode() 10 { 11 name = "Random Range"; 12 } 13 14 protected override MethodInfo GetFunctionToConvert() 15 { 16 return GetType().GetMethod("Unity_RandomRange", BindingFlags.Static | BindingFlags.NonPublic); 17 } 18 19 static string Unity_RandomRange( 20 [Slot(0, Binding.None)] Vector2 Seed, 21 [Slot(1, Binding.None)] Vector1 Min, 22 [Slot(2, Binding.None, 1, 1, 1, 1)] Vector1 Max, 23 [Slot(3, Binding.None)] out Vector1 Out) 24 { 25 return 26@" 27{ 28 $precision randomno = frac(sin(dot(Seed, $precision2(12.9898, 78.233)))*43758.5453); 29 Out = lerp(Min, Max, randomno); 30}"; 31 } 32 } 33}