//Calls map event and returns string public string DetermineEvent(GameObject player) { //Set up player script m_player = player; m_playerCharScript = m_player.GetComponent <Character>(); //Gather tile Vector3 tmp = m_player.transform.localPosition; // Change by Damien to get tiles to work again. tmp.z = -0.01f; // Original: tmp.z = 0.0f; Tile currentTile = TileDictionary.GetTile(TileManager.ToPixels(tmp)); //If no tile found if (currentTile == null) { //return "This is not a valid \ntile. No event occured."; m_GUIResult = "This is not a valid \ntile. No event occured."; return("NOTHING"); } //end if //If no resource at tile else if (currentTile.ResourceType == ResourceType.NONE) { int dieResult = m_die.Roll(1, 100); if (dieResult < m_enemyChance) { return("ENEMY"); } //end if ENEMY else if (dieResult < m_allyChance + m_enemyChance && dieResult >= m_enemyChance) { return("ALLY"); } //end else if ALLY else if (dieResult < m_itemChance + m_allyChance + m_enemyChance && dieResult >= m_allyChance + m_enemyChance) { return("ITEM"); } //end else if ITEM else { //return "Die roll was " + dieResult + ".\nNo map event occured."; m_GUIResult = "No map event occured."; return("NOTHING"); } //end else if NOTHING } //end if NORMAL TILE //If resource at tile else { //Create temp resource Resource temp = new Resource(); // Turn temp into type of resource temp.SetResource(currentTile.ResourceType.ToString()); //Pick up resource m_playerCharScript.PickupResource(temp, 1); //Declare what was landed on m_GUIResult = "You got a resource:\n" + temp.ResourceName; //Play found for what was landed on if (temp.ResourceName == "Fish") { audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxFishing); //Play fish sound } //end if else if (temp.ResourceName == "Wood") { audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxWoodcutting); //Play wood sound } //end else if else if (temp.ResourceName == "Wool") { audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxShearing); //Play wool sound } //end else if else { audioSrc.audio.PlayOneShot(GSP.AudioReference.sfxMining); //Play ore sound } //end else return("RESOURCE"); } //end else if RESOURCE TILE } //end DetermineEvent(GameObject player)