BehaviorTreeConfig.cs 574 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using UnityEngine;
  2. namespace Model
  3. {
  4. public class BehaviorTreeConfig: MonoBehaviour
  5. {
  6. public BehaviorNodeConfig RootNodeConfig;
  7. private int mAutoId = 1;
  8. public int AutoId
  9. {
  10. get
  11. {
  12. return mAutoId++;
  13. }
  14. }
  15. public int RootNodeId
  16. {
  17. get
  18. {
  19. return RootNodeConfig == null? 0 : RootNodeConfig.id;
  20. }
  21. }
  22. public NodeProto RootNodeProto
  23. {
  24. get
  25. {
  26. return RootNodeConfig == null? null : RootNodeConfig.ToNodeProto();
  27. }
  28. }
  29. public void Clear()
  30. {
  31. DestroyImmediate(RootNodeConfig, true);
  32. RootNodeConfig = null;
  33. }
  34. }
  35. }