public HashSet <Vector2Int> GetShape(int seed) { int y = 5 + seed % 10; int r = 3 + seed % 3; HashSet <Vector2Int> dick = new HashSet <Vector2Int>(); for (int i = 0; i < y; i++) { dick.Add(new Vector2Int(-r, i + r)); dick.Add(new Vector2Int(r, i + r)); } for (int i = -r; i < r; i++) { dick.Add(new Vector2Int(i, y + r)); dick.Add(new Vector2Int(i, y + r - 2)); } var eggLeft = CircleOutline.MidPointCircleDraw(-r, 0, r); var eggRight = CircleOutline.MidPointCircleDraw(r, 0, r); dick.UnionWith(eggLeft); dick.UnionWith(eggRight); return(dick); }
public HashSet <Vector2Int> GetShape(int seed) { int treeHeight = 5 + seed % 10; int treeRadius = 2 + seed % 2; int leafsRadius = 5 + seed % 3; int smallLeafsRadius = 1 + seed % 2; int center_y = treeHeight + leafsRadius; var leafs = CircleOutline.MidPointCircleDraw(0, center_y, leafsRadius); int treeWoodStart = 0; foreach (Vector2Int leaf in leafs) { if (leaf.x == treeRadius || leaf.x == -treeRadius) { treeWoodStart = center_y - UnityEngine.Mathf.Abs(leaf.y - center_y) + 1; break; } } HashSet <Vector2Int> tree = new HashSet <Vector2Int>(); for (int i = 0; i < treeWoodStart; i++) { tree.Add(new Vector2Int(-treeRadius, i)); tree.Add(new Vector2Int(treeRadius, i)); } tree.UnionWith(leafs); var smallLeafs = CircleOutline.MidPointCircleDraw(treeRadius + smallLeafsRadius, treeWoodStart / 2, smallLeafsRadius); tree.UnionWith(leafs); tree.UnionWith(smallLeafs); return(tree); }
public void Train() { ShapeGenerator generator; switch (dropdown.value) { case 0: generator = new DefaultShape(); break; case 1: generator = new SquareShape(); break; case 2: generator = new SquareOutline(); break; case 3: generator = new CircleOutline(); break; case 4: generator = new TreeShape(); break; default: generator = new DickShape(); break; } trainer.initialWaspsPoints = Int32.Parse(initialHealth.text); trainer.waspReward = Int32.Parse(healthReward.text); trainer.waspPunishment = Int32.Parse(healthPunishment.text); trainer.maxWasps = Int32.Parse(waspMax.text); trainer.StartTrain(generator); }
public void Awake() { _circleOutline = txtTalk.GetComponent <CircleOutline>(); }