// Use this for initialization void Start() { hexGrid = GetComponent <HexGrid>(); turnScript = GetComponent <TurnScript>(); generatorScript = GetComponent <GeneratorScript>(); selected = noSelection; }
public void LoadGame(int level) { TileType[,] tileTypes; #if UNITY_EDITOR if (cache && File.Exists(CACHE_PATH)) { tileTypes = LoadTilesEditor(); Debug.Log("Loaded tile info from cache"); } else { tileTypes = GenerateTiles(); Debug.Log("Generated tile info"); } CacheTilesEditor(tileTypes); #else tileTypes = LoadTilesRelease(); #endif HexGrid hexGrid = gameObject.GetComponent <HexGrid>(); hexGrid.GenerateGrid(tileTypes, level); mainMenu.SetActive(false); menuMusic.Stop(); gameMusic.Play(); int pixWidth = rivers.texture.width; int pixHeight = rivers.texture.height; Vector3 backgroundScale = new Vector3( 1.0f / (2.0f * radius), 1.0f / (2.0f * radius), 1.0f ); Vector3 backgroundPos = new Vector3( -start.x * backgroundScale.x, -start.y * backgroundScale.y, 0.0f ); backgroundPos.x += pixWidth * backgroundScale.x / 2.0f; backgroundPos.y += pixHeight * backgroundScale.y / 2.0f; background.transform.position = backgroundPos; background.transform.localScale = backgroundScale; background.SetActive(true); TurnScript turnScript = gameObject.GetComponent <TurnScript>(); StartCoroutine(turnScript.PlaceCamps(level)); if (level == 1) { turnScript.money = 500 * level; } else if (level == 2) { turnScript.money = 500 * level; } else if (level == 3) { turnScript.money = 2000; } loaded = true; }
// Use this for initialization void Start() { ourGlobalScript = this; ourUnitScripts = Object.FindObjectsOfType <UnitScript>(); ourPlayerScripts = Object.FindObjectsOfType <PlayerScript>(); ourCursorScript = Object.FindObjectOfType <CursorScript>(); ourTurnScript = Object.FindObjectOfType <TurnScript>(); ourPhaseScript = Object.FindObjectOfType <PhaseScript>(); }
// Use this for initialization void Start() { ourGlobalScript = this; ourUnitScripts = Object.FindObjectsOfType<UnitScript>(); ourPlayerScripts = Object.FindObjectsOfType<PlayerScript>(); ourCursorScript = Object.FindObjectOfType<CursorScript>(); ourTurnScript = Object.FindObjectOfType<TurnScript>(); ourPhaseScript = Object.FindObjectOfType<PhaseScript>(); }
private void Awake() { turnScript = GetComponent <TurnScript>(); turnScript.turnTime = true; }
// Use this for initialization void Start() { turnScript = GetComponent <TurnScript>(); }