void InitGrid() { CurrentGridDensity = GridDensity; ParentPos = anchor.position; ParentPos.z += ((GridDensity / 2) * m_Spacing) - (m_Spacing / 2); ParentPos.x += ((GridDensity / 2) * m_Spacing) - (m_Spacing / 2); CurrentPos = ParentPos; for (int y = 0; y < GridDensity; y++) { for (int x = 0; x < GridDensity; x++) { EQSNode temp = new EQSNode(); temp.Position = CurrentPos; eqsNodes.Add(temp); } } }
void InitCircle() { CurrentCircleNodeDensity = CircleNodeDensity; ParentPos = anchor.position; for (int y = 0; y < CircleNodeDensity; y++) { EQSNode temp = new EQSNode(); float degrees = 360f / CircleNodeDensity; // total nodes degrees *= (float)y; // num nodes degrees += 90; CurrentPos.x = Mathf.Cos(Mathf.Deg2Rad * degrees); CurrentPos.x *= CircleRadius; // radius CurrentPos.z = Mathf.Sin(Mathf.Deg2Rad * degrees); CurrentPos.z *= CircleRadius; // radius CurrentPos.z += ParentPos.z; CurrentPos.x += ParentPos.x; temp.Position = CurrentPos; eqsNodes.Add(temp); } }
void InitDonut() { CurrentDonutNodeDensity = DonutNodeDensity; CurrentDonutNumberOfRings = DonutNumberOfRings; ParentPos = anchor.position; for (int i = 0; i < DonutNumberOfRings; i++) { for (int y = 0; y < DonutNodeDensity; y++) { EQSNode temp = new EQSNode(); float degrees = 360f / DonutNodeDensity; // total nodes degrees *= (float)y; // num nodes degrees += 90; if (i > 0) { CurrentPos.x = Mathf.Cos(Mathf.Deg2Rad * degrees); CurrentPos.x *= DonutRadius + DonutInnerSpacing + i; // radius CurrentPos.z = Mathf.Sin(Mathf.Deg2Rad * degrees); CurrentPos.z *= DonutRadius + DonutInnerSpacing + i; // radius } else { CurrentPos.x = Mathf.Cos(Mathf.Deg2Rad * degrees); CurrentPos.x *= DonutRadius; // radius CurrentPos.z = Mathf.Sin(Mathf.Deg2Rad * degrees); CurrentPos.z *= DonutRadius; // radius } CurrentPos.z += ParentPos.z; CurrentPos.x += ParentPos.x; temp.Position = CurrentPos; eqsNodes.Add(temp); } } }