clean up TreeNode constructor literals

This commit is contained in:
Colin McMillen 2020-07-16 15:34:22 -04:00
parent 013e4836fb
commit 9ac15e6d35

View File

@ -53,7 +53,20 @@ namespace SemiColinGames {
public Vector2 Position; public Vector2 Position;
public TreeNode(float orientation, float length, float inWidth, float outWidth) : public TreeNode(float orientation, float length, float inWidth, float outWidth) :
this(orientation, length, inWidth, outWidth, new List<TreeNode>()) {} this(orientation, length, inWidth, outWidth, new List<TreeNode>()) {
}
public TreeNode(float orientation, float length, float inWidth, float outWidth, TreeNode child) :
this(orientation, length, inWidth, outWidth, new List<TreeNode>() { child }) {
}
public TreeNode(float orientation, float length, float inWidth, float outWidth, TreeNode child1, TreeNode child2) :
this(orientation, length, inWidth, outWidth, new List<TreeNode>() { child1, child2 }) {
}
public TreeNode(float orientation, float length, float inWidth, float outWidth, TreeNode child1, TreeNode child2, TreeNode child3) :
this(orientation, length, inWidth, outWidth, new List<TreeNode>() { child1, child2, child3 }) {
}
public TreeNode(float orientation, float length, float inWidth, float outWidth, List<TreeNode> children) { public TreeNode(float orientation, float length, float inWidth, float outWidth, List<TreeNode> children) {
Orientation = orientation; Orientation = orientation;
@ -67,21 +80,18 @@ namespace SemiColinGames {
public void Draw(bool isRunningSlowly, IWorld iworld, bool paused) { public void Draw(bool isRunningSlowly, IWorld iworld, bool paused) {
var tree = var tree =
new TreeNode(0.0f, 100, 10, 6, new List<TreeNode>() { new TreeNode(-0.2f, 100, 10, 6,
new TreeNode(-0.1f, 100, 10, 6, new List<TreeNode>() { new TreeNode(-0.2f, 100, 10, 6,
new TreeNode(-0.1f, 100, 10, 6, new List<TreeNode>() { new TreeNode(-0.2f, 100, 10, 6,
new TreeNode(-0.3f, 100, 6, 4, new List<TreeNode>() { new TreeNode(-0.3f, 100, 6, 4,
new TreeNode(-0.1f, 100, 6, 4, new List<TreeNode>() { new TreeNode(-0.1f, 100, 6, 4,
new TreeNode(-0.3f, 150, 4, 2), new TreeNode(-0.3f, 150, 4, 2),
new TreeNode(0.2f, 200, 4, 2), new TreeNode(0.2f, 200, 4, 2),
new TreeNode(0.5f, 100, 4, 2) new TreeNode(0.5f, 100, 4, 2))),
})}), new TreeNode(0.5f, 100, 6, 4,
new TreeNode(0.5f, 100, 6, 4, new List<TreeNode>() { new TreeNode(-0.1f, 100, 6, 4,
new TreeNode(-0.1f, 100, 6, 4, new List<TreeNode>() {
new TreeNode(-0.1f, 150, 4, 2), new TreeNode(-0.1f, 150, 4, 2),
new TreeNode(0.2f, 200, 4, 2) new TreeNode(0.2f, 200, 4, 2))))));
})}),
})})});
graphics.Clear(backgroundColor); graphics.Clear(backgroundColor);