DialogueNode.ts 826 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. enum NodeType {
  2. Node, Tree, Text, Set, Choice, Branch
  3. }
  4. class DialogueNode {
  5. public type : NodeType = NodeType.Node;
  6. // End nodes are not necessary. If next is undefined, then that's the end.
  7. //public static END_NODE = "End";
  8. public id : string;
  9. public name : string;
  10. protected next : string;
  11. public choices : Array<string>;
  12. public constructor (id : string) {
  13. this.id = id;
  14. }
  15. public setName (name : string) {
  16. this.name = name;
  17. }
  18. public setNext (next : string) {
  19. this.next = next;
  20. }
  21. public getNext () : string {
  22. return this.next;
  23. }
  24. public setChoices (choices : Array<string>) {
  25. this.choices = choices;
  26. }
  27. public hasChoices () {
  28. return this.choices != undefined && this.choices.length > 0;
  29. }
  30. }