void GridSetup(string [] gridInput) { int y = 0; while (y < 6) { int x = 0; foreach (char s in gridInput[y]) { if (s == 'X') { grid[x, y] = Instantiate(floor_noBoxes, new Vector3(x, y * -1, 0), this.transform.rotation); } else if (s == 'O') { Instantiate(floor, new Vector3(x, y * -1, 0), this.transform.rotation); } else if (s == 'B') { Instantiate(floor, new Vector3(x, y * -1, 0), this.transform.rotation); grid[x, y] = Instantiate(permanentBox, new Vector3(x, y * -1, 0), this.transform.rotation); } else if (s == 'I') { import = Instantiate(floor_imports, new Vector3(x, y * -1, 0), this.transform.rotation); } else if (s == 'E') { export = Instantiate(floor_exports, new Vector3(x, y * -1, 0), this.transform.rotation); } else { Debug.LogError("Grid setup error."); } x++; } y++; } et = Instantiate(exportDoorPrefab, new Vector3(export.transform.position.x, 1, 0), this.transform.rotation).GetComponent <exportTruck>(); Instantiate(importDoorPrefab, new Vector3(import.transform.position.x, 1, 0), this.transform.rotation); }
// Use this for initialization void Start() { gm = GameObject.Find("Main Camera").GetComponent <gameManager>(); if (unMovable) { this.GetComponent <SpriteRenderer>().color = new Color(0.48f, 0.27f, 0f); lable.text = "Do not move!"; } else { this.GetComponent <SpriteRenderer>().color = boxColors[Random.Range(0, boxColors.Length)]; exportTime = gm.GetTimeUnformatted() + Random.Range(10, 45); Debug.Log(exportTime); createID(); } importTime = gm.GetTimeUnformatted(); et = GameObject.Find("exports_Truck(Clone)").GetComponent <exportTruck>(); }