public RMGRiverNode(RMGRiver river, float facing, float x, float y) { this.river = river; this.facing = facing; this.x = x; this.y = y; this.river.nodeCount += 1; this.w = 4 + (this.river.resizeFactor / 2); }
public RMGRiverNode(RMGRiverNode parent, float dir, bool doubleSplit) { this.parent = parent; this.river = parent.river; this.river.nodeCount += 1; this.facing = parent.facing + (Funcs.Random(0.01f, Mathf.PI / 4) * dir); this.facing = Mathf.Clamp(this.facing, this.river.minAngle, this.river.maxAngle); this.deathChance = parent.deathChance * Funcs.Random(0.99f, 1.01f); this.splitChance = parent.splitChance * Funcs.Random(0.99f, 1.01f); this.narrowChance = parent.narrowChance * Funcs.Random(0.99f, 1.01f); this.widenChance = parent.widenChance * Funcs.Random(0.99f, 1.01f); this.w = parent.w; if (Funcs.fChance(narrowChance)) { this.w -= 1; } else if (Funcs.fChance(widenChance)) { this.w += 0.5f; } if (doubleSplit) { this.w -= 1; deathChance += 0.01f; splitChance -= 0.1f; } Vector2 p = new Vector2(parent.x, parent.y); Vector2 pa = Funcs.RadianToVector2(this.facing); pa *= 3; p += pa; this.x = p.x; this.y = p.y; }