Newer
Older
TheVengeance-Project-IADE-Unity2D / Assets / Ink / InkLibs / InkCompiler / ParsedHierarchy / Gather.cs
  1. namespace Ink.Parsed
  2. {
  3. public class Gather : Parsed.Object, IWeavePoint, INamedContent
  4. {
  5. public string name
  6. {
  7. get { return identifier?.name; }
  8. }
  9. public Identifier identifier { get; set; }
  10. public int indentationDepth { get; protected set; }
  11. public Runtime.Container runtimeContainer { get { return (Runtime.Container) runtimeObject; } }
  12. public Gather (Identifier identifier, int indentationDepth)
  13. {
  14. this.identifier = identifier;
  15. this.indentationDepth = indentationDepth;
  16. }
  17. public override Runtime.Object GenerateRuntimeObject ()
  18. {
  19. var container = new Runtime.Container ();
  20. container.name = name;
  21. if (this.story.countAllVisits) {
  22. container.visitsShouldBeCounted = true;
  23. }
  24. container.countingAtStartOnly = true;
  25. // A gather can have null content, e.g. it's just purely a line with "-"
  26. if (content != null) {
  27. foreach (var c in content) {
  28. container.AddContent (c.runtimeObject);
  29. }
  30. }
  31. return container;
  32. }
  33. public override void ResolveReferences (Story context)
  34. {
  35. base.ResolveReferences (context);
  36. if( identifier != null && identifier.name.Length > 0 )
  37. context.CheckForNamingCollisions (this, identifier, Story.SymbolType.SubFlowAndWeave);
  38. }
  39. }
  40. }