public static void Load() { if (ES2.Exists("PVState")) { SavedState loaded = ES2.Load <SavedState> ("PVState"); GameControl.Level = loaded.Level; gameControl.BeginGame(true); int[][] positions = new int[loaded.ObstacleXPositions.Count][]; for (int i = 0; i < loaded.ObstacleXPositions.Count; i++) { positions[i] = new int[] { loaded.ObstacleXPositions[i], loaded.ObstacleYPositions[i] }; AddObstacle(loaded.ObstacleXPositions[i], loaded.ObstacleYPositions[i]); } obstacleLibrary.LoadObstaclesFromState(loaded.ObstacleLevelType, positions); foreach (LibraryCard lc in loaded.CardsInHand) { Card card = gameControl.Create(lc.CardName); gameControl.DrawIntoHand(card, true); } foreach (LibraryCard lc in loaded.CardsInDiscard) { Card card = gameControl.Create(lc.CardName, true); card.InvisibleDiscard(); } gameControl.Deck = loaded.CardsInDeck; S.GameControlInst.CheckDeckCount(); shopControl.Goals = loaded.Goals; if (loaded.ShopMode) { Debug.Log("shop mode!"); shopControl.CardsToBuyFrom = new List <LibraryCard> [3]; shopControl.CardsToBuyFrom[0] = loaded.ShopCardList1; shopControl.CardsToBuyFrom[1] = loaded.ShopCardList2; shopControl.CardsToBuyFrom[2] = loaded.ShopCardList3; S.GameControlGUIInst.ForceDim(); S.ShopControlInst.ProduceCards(); } else { for (int i = 0; i < loaded.Enemies.Count; i++) { Enemy newEnemy = enemyLibrary.LoadEnemy(loaded.Enemies[i], loaded.EnemyXPositions[i], loaded.EnemyYPositions[i], loaded.EnemyHealths[i]); newEnemy.CurrentPlays = loaded.EnemyPlays[i]; } gridControl.EnemiesFindGridUnits(); shopControlGUI.NewLevelNewGoals(loaded.Goals.Length, loaded.Goals); gameControl.BleedingTurns = loaded.BleedingTurns; gameControl.SwollenTurns = loaded.SwollenTurns; gameControl.HungerTurns = loaded.HungerTurns; EventControl.LoadTriggerListState(loaded.TriggerList); } player.transform.position = new Vector3(loaded.PlayerPosition[0], loaded.PlayerPosition[1], 1); player.playerGU.xPosition = loaded.PlayerPosition[0]; player.playerGU.yPosition = loaded.PlayerPosition[1]; player.currentHealth = loaded.PlayerHealth; gameControl.SetMoves(loaded.PlayerPlays); gameControl.SetMoves(loaded.PlayerMoves); gameControl.SetDollars(loaded.Dollars); clickControl.AllowForfeitButtonInput = true; } }