// Start is called before the first frame update void Start() { em = GetComponent <EntityManager>(); pm = GetComponent <PlayerManager>(); cc = ClientController.Instance; kzc = FindObjectOfType <KillzoneController>(); }
// Start is called before the first frame update void Start() { GameController.score = 0; GameController.playerDied = false; TextAsset level = (TextAsset)Resources.Load(levelFile); if (level == null) { /* * Debug.LogError("Error (LoadPlayBoard): 'Using Specific Game Board' is checked but the file '" + specificGridFileName + "' doesn't exist in the Resources Folder -- Filling Board Randomly"); * SetUpGridEdgePieces(true); * FillHalfBoardRandom(); */ tcArray = new TileController[(int)gridSize.x, (int)gridSize.y]; for (int i = 0; i < gridSize.x; i++) { for (int j = 0; j < gridSize.y; j++) { GameObject go = Instantiate(tile); TileController cont = go.GetComponent <TileController>(); tcArray[i, j] = cont; cont.loc.x = i; cont.loc.y = j; } } } else { // required... string boardString = level.text.Trim(); char[] lineDelimiter = { '\n' }; char[] columnDelimiter = { ',' }; string[] rowStrings = boardString.Split(lineDelimiter); // Get the number of rows and columns int numRows = rowStrings.Length; int numColumns = rowStrings[0].Split(columnDelimiter).Length; // assuming data structure is not jaggy GameController.rows = numRows; GameController.columns = numColumns; // START tcArray = new TileController[numColumns, numRows]; for (int i = numRows - 1; i >= 0; i--) { string row = rowStrings[numRows - (i + 1)]; string[] elements = row.Split(columnDelimiter); for (int j = 0; j < numColumns; j++) { string element = elements[j]; GameObject go = Instantiate(tile); TileController cont = go.GetComponent <TileController>(); tcArray[j, i] = cont; cont.loc.x = j; cont.loc.y = i; cont.type = int.Parse(element); int itemType = (int)(cont.type / 10); if (itemType > 0) { itemLocationsScores.Add(new Vector4(cont.loc.x, cont.loc.y, 0, itemType)); } } } //Bring in the... Kill Zoooone! GameController.killzone = Instantiate(killzonePrefab).GetComponent <KillzoneController>(); GameController.killzone.transform.position = new Vector3(0, 7.5f, GameController.killzone.transform.position.z); } }