Last active
October 31, 2018 02:54
-
-
Save akirayou/9e273ce2fd437d9c2fd8f415bd301a7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void FillDummyLED() | |
{ | |
Units = new UnitData[4]; | |
float width = 9; | |
float height = 6; | |
if (false) | |
{ | |
Units[0] = new UnitData("127.0.0.1", 1250); | |
Units[1] = new UnitData("127.0.0.1", 1250); | |
Units[2] = new UnitData("127.0.0.1", 1250); | |
Units[3] = new UnitData("127.0.0.1", 1250); | |
} | |
else | |
{ | |
Units[0] = new UnitData("192.168.10.31", 1250); | |
Units[1] = new UnitData("192.168.10.32", 1250); | |
Units[2] = new UnitData("192.168.10.33", 1250); | |
Units[3] = new UnitData("192.168.10.34", 1250); | |
} | |
for (int i = 0; i < Units.Length; i++) | |
{ | |
//LED unit layout | |
// ↑Z+ | |
// ||||||| ||||||| | |
// || 1 || || 3 || | |
// 0|||||| ||||||0 | |
// | |
// 0|||||| ||||||0 | |
// || 2 || || 4 || | |
// ||||||| ||||||| | |
// → X+ | |
const float xmargin = 0.05f; | |
const float ymargin = 0.05f; | |
for (int j = 0; j < 1250; j++) | |
{ | |
float x = 1.0f - (j / 25) / 49.0f; | |
float y = (j % 25) / 24.0f; | |
if ((j / 25) % 2 == 1) y = 1 - y; | |
x *= width / 2; | |
y *= height / 2; | |
Vector3 pos = new Vector3(); | |
pos.x = x + xmargin; | |
//pos.y = j * 0.01f+i; | |
pos.z = y + ymargin; | |
switch (i) | |
{ | |
case 0: | |
pos.x *= -1; | |
break; | |
case 1: | |
pos.x *= -1; | |
pos.z *= -1; | |
break; | |
case 2: | |
break; | |
default: | |
pos.z *= -1; | |
break; | |
} | |
//pos.x += Random.Range(-0.1f, 0.1f); | |
//pos.z += Random.Range(-0.1f, 0.1f); | |
GameObject o = Instantiate(prefLED); | |
o.transform.parent = this.transform; | |
o.transform.localPosition = pos; | |
Vector2 pos2 = new Vector2(pos.x, pos.z); | |
Leds.Add(new Led(Units[i], j, pos2, o, 1)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment