AndNode.cs 783 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Reflection;
  2. using UnityEngine;
  3. namespace UnityEditor.ShaderGraph
  4. {
  5. [Title("Utility", "Logic", "And")]
  6. class AndNode : CodeFunctionNode
  7. {
  8. public AndNode()
  9. {
  10. name = "And";
  11. }
  12. public override bool hasPreview
  13. {
  14. get { return false; }
  15. }
  16. protected override MethodInfo GetFunctionToConvert()
  17. {
  18. return GetType().GetMethod("Unity_And", BindingFlags.Static | BindingFlags.NonPublic);
  19. }
  20. static string Unity_And(
  21. [Slot(0, Binding.None)] Boolean A,
  22. [Slot(1, Binding.None)] Boolean B,
  23. [Slot(2, Binding.None)] out Boolean Out)
  24. {
  25. return
  26. @"
  27. {
  28. Out = A && B;
  29. }
  30. ";
  31. }
  32. }
  33. }