Program.cs 929 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using AtomicSharp;
  3. using Light = AtomicSharp.Light;
  4. using Node = AtomicSharp.Node;
  5. namespace AtomicSharpTest
  6. {
  7. class MainClass
  8. {
  9. static Node CreateNode() {
  10. return new AtomicSharp.Node ();
  11. }
  12. static void AddLight(Node node) {
  13. node.AddComponent (new Light (), 0, CreateMode.REPLICATED);
  14. }
  15. static private Node parent;
  16. static private Node child;
  17. static void setup()
  18. {
  19. parent = CreateNode ();
  20. AddLight (parent);
  21. parent.Name = "MyNode";
  22. child = parent.CreateChild ("Child", CreateMode.REPLICATED, 0);
  23. child = null;
  24. }
  25. public static void Main (string[] args)
  26. {
  27. AtomicSharp.AtomicSharp.Initialize ();
  28. setup ();
  29. while (AtomicSharp.AtomicSharp.RunFrame ()) {
  30. child = parent.GetChild ("Child", false);
  31. if (child.Parent.HasComponent("Light"))
  32. Console.Write (child.Parent.Name + " has a light\n");
  33. child = null;
  34. }
  35. }
  36. }
  37. }