Beispiel #1
0
        public void SavePots()
        {
            List <SavablePot> savablePots = new List <SavablePot>();

            foreach (Pot pot in potsList)
            {
                SavablePot savablePot = new SavablePot()
                {
                    id        = pot.potId,
                    potStatus = (int)pot.potState
                };
                savablePots.Add(savablePot);
            }

            Settings.Instance.savableBoard.savablePots = savablePots;
        }
        private void LoadSave()
        {
            SavableBoard savableBoard = Settings.Instance.GetSaveFile(Application.persistentDataPath +
                                                                      Settings.PATH_TO_BOARD + "/" +
                                                                      SceneLoader.saveNameToLoad + ".json");

            #region Balls

            foreach (Ball ball in BallsManager.Instance.balls)
            {
                if (!savableBoard.savableBalls.Any(x => x.id == ball.ballId))
                {
                    BallsManager.Instance.RemoveBall(ball);
                    continue;
                }

                SavableBall savableBall = savableBoard.savableBalls.FirstOrDefault(x => x.id == ball.ballId);
                if (savableBall == null)
                {
                    continue;
                }
                ball.LoadBall(savableBall);
            }

            #endregion

            #region Pots

            foreach (Pot pot in PotManager.Instance.potsList)
            {
                SavablePot savablePot = savableBoard.savablePots.FirstOrDefault(x => x.id == pot.potId);
                pot.LoadPot(savablePot);
            }


            #endregion
        }
Beispiel #3
0
 public void LoadPot(SavablePot _savablePot)
 {
     potState = (PotState)_savablePot.potStatus;
 }