// Runs when the object if first instantiated, because this object will occur once through the game, // these values are the beginning of game values // Note: Values should be updated at the EndTurn State void Start() { // Get the reference to the tile manager tileManager = GameObject.Find("TileManager").GetComponent<TileManager>(); // Generate the map tileManager.GenerateMap(); // Get HUD elements CurrentPlayer = GameObject.Find ("Canvas/CurrentPlayer"); AllPlayers = GameObject.Find("Canvas/AllPlayers"); BKG = GameObject.Find ("Canvas/Background"); guiPlayerName = GameObject.Find("CurrentPlayer/PlayerNamePanel/PlayerName").GetComponent<Text>(); guiTurnText = GameObject.Find("CurrentPlayer/TurnPhasePanel/TurnPhase").GetComponent<Text>(); guiGold = GameObject.Find("CurrentPlayer/WeightGold/Gold").GetComponent<Text>(); guiWeight = GameObject.Find("CurrentPlayer/WeightGold/Weight").GetComponent<Text>(); actionButton = GameObject.Find("CurrentPlayer/ActionButton").GetComponent<Button>(); actionButtonText = GameObject.Find("CurrentPlayer/ActionButton").GetComponentInChildren<Text>(); acceptPanel = GameObject.Find("Accept"); pauseMenu = GameObject.Find ("PauseMenu"); instructionsSet = GameObject.Find ("Instructions"); audioSet = GameObject.Find ("Options"); imageParent = GameObject.Find("AllPlayers/ImageOrganizer"); textParent = GameObject.Find("AllPlayers/TextOrganizer"); inventory = GameObject.Find("PlayerInventory").GetComponent<PlayerInventory>(); allyInventory = GameObject.Find("AllyInventory").GetComponent<AllyInventory>(); recycleInventory = GameObject.Find("RecycleBin").GetComponent<RecycleBin>(); allyTable = GameObject.Find("Allies").GetComponent<AllyTable>(); GameObject.Find ("Canvas").transform.Find ("Instructions").gameObject.SetActive (false); HUDToggle = true; actionButtonActive = true; isPaused = false; instructionsProgress = 1; // Disable the other panels by default acceptPanel.SetActive(false); pauseMenu.SetActive (false); audioSet.SetActive (false); inventory.gameObject.SetActive(false); allyInventory.gameObject.SetActive(false); recycleInventory.gameObject.SetActive(false); allyTable.gameObject.SetActive(false); // Running the end stuff defaults to true canRunEndStuff = true; // The movement class is not initialised isMovementInitialized = false; // The ally window are closed by default isAlliesOpen = false; // Get the number of players guiNumOfPlayers = GameMaster.Instance.NumPlayers; // Set the turn guiPlayerTurn = GameMaster.Instance.Turn; // Set starting values guiDiceDistVal = 0; movementCooldown = 0.0f; // The player is not an AI by default isPlayerAI = false; // Create a die die = new Die(); // Get movement and map event components guiMovement = GameObject.Find("Canvas").GetComponent<GUIMovement> (); guiMapEvent = GameObject.Find("Canvas").GetComponent<MapEvent> (); // There isn't a map event in the beginning mapEventResultString = string.Empty; // Initialise other things after Start() runs canInitAfterStart = true; // Set the state to the BeginTurn state gamePlayState = GamePlayState.BeginTurn; }
// Runs when the object if first instantiated, because this object will occur once through the game, // these values are the beginning of game values // Note: Values should be updated at the EndTurn State void Start() { //TODO: Damien: Replace Tile stuff later // Clear the tile dictionary TileDictionary.Clean(); // Set the dimensions and generate/add the tiles TileManager.SetDimensions(64, 20, 16); TileManager.GenerateAndAddTiles(); // Get HUD elements guiPlayerName = GameObject.Find("CurrentPlayer/PlayerName").GetComponent<Text>(); guiTurnText = GameObject.Find("CurrentPlayer/TurnPhase").GetComponent<Text>(); guiGold = GameObject.Find("CurrentPlayer/WeightGold/Gold").GetComponent<Text>(); guiWeight = GameObject.Find("CurrentPlayer/WeightGold/Weight").GetComponent<Text>(); actionButton = GameObject.Find("CurrentPlayer/ActionButton").GetComponent<Button>(); actionButtonText = GameObject.Find("CurrentPlayer/ActionButton").GetComponentInChildren<Text>(); acceptPanel = GameObject.Find("Accept"); pauseMenu = GameObject.Find ("PauseMenu"); imageParent = GameObject.Find("AllPlayers/ImageOrganizer"); textParent = GameObject.Find("AllPlayers/TextOrganizer"); inventory = GameObject.Find("Inventory").GetComponent<Inventory>(); allyTable = GameObject.Find("Allies").GetComponent<AllyTable>(); GameObject.Find ("Canvas").transform.Find ("Instructions").gameObject.SetActive (false); actionButtonActive = true; isPaused = false; // Disable the accept panel by default acceptPanel.SetActive(false); // Disable the pause menu by default pauseMenu.SetActive (false); // Disable the inventory by default inventory.gameObject.SetActive(false); // Disable the ally window by default allyTable.gameObject.SetActive(false); // Running the end stuff defaults to true canRunEndStuff = true; // The inventory is closed by default isInventoryOpen = false; // The ally window is closed by default isAlliesOpen = false; // Get the number of players guiNumOfPlayers = GameMaster.Instance.NumPlayers; // Set the turn guiPlayerTurn = GameMaster.Instance.Turn; // Set starting values guiDiceDistVal = 0; // Create a die die = new Die(); // Reseed the random number generator die.Reseed(Environment.TickCount); // Get movement and map event components guiMovement = GameObject.Find("Canvas").GetComponent<GUIMovement> (); guiMapEvent = GameObject.Find("Canvas").GetComponent<MapEvent> (); // There isn't a map event in the beginning mapEventResultString = string.Empty; // Initialise other things after Start() runs canInitAfterStart = true; // Set the state to the BeginTurn state gamePlayState = GamePlayState.BeginTurn; }