Config.cs 649 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections.Generic;
  2. using MongoDB.Bson.Serialization.Attributes;
  3. namespace BehaviorTree
  4. {
  5. public class Config
  6. {
  7. public uint Id { get; set; }
  8. public string Name { get; set; }
  9. [BsonIgnoreIfNull]
  10. public List<string> Args { get; set; }
  11. [BsonIgnoreIfNull]
  12. public List<Config> SubConfigs { get; set; }
  13. public void AddArgs(string arg)
  14. {
  15. if (this.Args == null)
  16. {
  17. this.Args = new List<string>();
  18. }
  19. this.Args.Add(arg);
  20. }
  21. public void AddSubConfig(Config subConfig)
  22. {
  23. if (this.SubConfigs == null)
  24. {
  25. this.SubConfigs = new List<Config>();
  26. }
  27. this.SubConfigs.Add(subConfig);
  28. }
  29. }
  30. }