private void SetupMap()
        {
            if (!PlayerPrefs.HasKey(PlayerPrefsKeys.MapData))
            {
                SceneChanger.LoadScene(SceneNames.MainMenu);
                return;
            }
            map = JsonUtility.FromJson <Map>(PlayerPrefs.GetString(PlayerPrefsKeys.MapData));
            if (map == null)
            {
                SceneChanger.LoadScene(SceneNames.MainMenu);
                return;
            }
            contentGameObjects = new List <GameObject>();
            for (int i = 0; i < (map.width * map.height); i++)
            {
                contentGameObjects.Add(null);
            }
            for (int y = 0; y < map.height; y++)
            {
                for (int x = 0; x < map.width; x++)
                {
                    var tilePosition = new Vector3(-x, 0.5f, y);

                    // Instantiate tile:
                    var tileID = map.GetTileID(x, y);
                    var tile   = MapAssets.instance.tiles[tileID];
                    var square = Instantiate(tile.model, tilePosition, tile.model.transform.rotation);
                    square.transform.SetParent(mapContainer.transform);

                    // Instantiate content:
                    var tileContentID = map.GetTileContentID(x, y);
                    var tileContent   = (tileContentID != -1) ? MapAssets.instance.tileContents[tileContentID] : null;
                    if (tileContent != null)
                    {
                        if (tileContent == MapAssets.instance.startTileContent)
                        {
                            Camera.main.transform.position = tilePosition + new Vector3(0, 0.5f, 0);
                            Camera.main.transform.rotation = Quaternion.Euler(0, 180, 0);
                            Avatar.instance.mapPosition    = new Vector2(x, y);
                        }
                        var content = Instantiate(tileContent.model, tilePosition, tileContent.model.transform.rotation);
                        content.transform.SetParent(square.transform);
                        contentGameObjects[map.GetIndex(x, y)] = content;
                    }
                }
            }
        }
 public void LoadMainMenu()
 {
     SceneChanger.LoadScene(SceneNames.MainMenu);
 }
 public void LoadMap(string data)
 {
     PlayerPrefs.SetString(PlayerPrefsKeys.MapData, data);
     SceneChanger.LoadScene(SceneNames.Gameplay);
 }
 public void OpenMapEditor()
 {
     SceneChanger.LoadScene(SceneNames.MapEditor);
 }
 public void ReturnToMainMenu()
 {
     SceneChanger.LoadScene(SceneNames.MainMenu);
 }
 private void GotoMainMenu()
 {
     SceneChanger.LoadScene(SceneNames.MainMenu);
 }
 public void ExitMap()
 {
     SceneChanger.LoadScene(SceneNames.MainMenu);
 }
 public void RunAway()
 {
     party.currency /= 2;
     SceneChanger.LoadScene(SceneNames.MainMenu);
 }