/// <summary>
        /// Adds a new line segment to the flow graph. A line segment represents one or more rooms in a path between two nodes
        /// </summary>
        /// <param name="archetypes">A list of archetypes to pull rooms from</param>
        /// <param name="length">The length of this line segment. The entire path length will be automatically normalized. Must be greater than zero</param>
        /// <param name="locks">An optional list of the locks that can be applied to this segment</param>
        /// <param name="keys">An optional list of the keys that can be placed in this segment</param>
        /// <returns></returns>
        public DungeonFlowBuilder AddLine(IEnumerable <DungeonArchetype> archetypes, float length = 1f, IEnumerable <KeyLockPlacement> locks = null, IEnumerable <KeyLockPlacement> keys = null)
        {
            if (length <= 0f)
            {
                throw new ArgumentOutOfRangeException("Length must be grater than zero");
            }

            var line = new GraphLine(Flow);

            line.Position = currentPosition;
            line.Length   = length;

            if (archetypes != null && archetypes.Any())
            {
                line.DungeonArchetypes.AddRange(archetypes);
            }

            if (locks != null && locks.Any())
            {
                line.Locks.AddRange(locks);
            }
            if (keys != null && keys.Any())
            {
                line.Keys.AddRange(keys);
            }

            lines.Add(line);
            currentPosition += length;

            return(this);
        }
Exemplo n.º 2
0
        public FlowLineReference(DungeonFlow flowGraph, GraphLine line)
        {
            Debug.Assert(flowGraph != null);
            Debug.Assert(line != null);

            flow = flowGraph;
            Line = line;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the default graph
        /// </summary>
        public void Reset()
        {
            Nodes.Clear();
            Lines.Clear();

            var start = new GraphNode(this);
            var line  = new GraphLine(this);
            var goal  = new GraphNode(this);

            start.NodeType = NodeType.Start;
            start.Label    = "Start";

            line.Length = 1.0f;

            goal.NodeType = NodeType.Goal;
            goal.Label    = "Goal";
            goal.Position = 1.0f;


            Nodes.Add(start);
            Nodes.Add(goal);
            Lines.Add(line);
        }
Exemplo n.º 4
0
 public FlowLineReference(DungeonFlow flowGraph, GraphLine line)
 {
     flow = flowGraph;
     Line = line;
 }