August 2018
Beginner
334 pages
10h 19m
English
We will need to create two different classes: one for handling the nodes, and one for handling the whole tree and high-level operations.
Let's start with the node file:
using UnityEngine;using System.Collections.Generic;[System.Serializable]public class DungeonNode2D{ // next steps }
public Rect area;public Rect block;public Dungeon2D root;public DungeonNode2D left;public DungeonNode2D right;protected int depth;
public DungeonNode2D (Rect area, Dungeon2D root, int depth = 0){this.area = area;this.root = root;this.depth = depth;this.root.leaves.Add(this);if (!this.root.tree.ContainsKey(depth)) this.root.tree.Add(depth, ...Read now
Unlock full access