RuntimeGraph.cs 622 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using GraphProcessor;
  5. public class RuntimeGraph : MonoBehaviour
  6. {
  7. public BaseGraph graph;
  8. public ProcessGraphProcessor processor;
  9. public GameObject assignedGameObject;
  10. private void Start()
  11. {
  12. if (graph != null)
  13. processor = new ProcessGraphProcessor(graph);
  14. }
  15. int i = 0;
  16. void Update()
  17. {
  18. if (graph != null)
  19. {
  20. graph.SetParameterValue("Input", (float)i++);
  21. graph.SetParameterValue("GameObject", assignedGameObject);
  22. processor.Run();
  23. Debug.Log("Output: " + graph.GetParameterValue("Output"));
  24. }
  25. }
  26. }