Exemplo n.º 1
0
 public LevelState(JSONTable template)
 {
     unlocked = true;// false;
     //done = true;
     //starred = true;
     script = new LevelScript(template);
 }
Exemplo n.º 2
0
        public GameState(LevelScript levelScript)
        {
            this.levelScript = levelScript;
            spawnIndices = new List<int>();
            for (int Idx = this.levelScript.spawnPoint.Count; Idx > 0; --Idx)
            {
                spawnIndices.Add(0);
            }

            parentState = null;
            minions = new Dictionary<Point, Minion>();
            ongoingEffects = new Dictionary<Point, Ongoing>();
            resources = new Dictionary<ResourceType, int>();
            turnNumber = 1;
            playableCards = new HashSet<Card>();
            gameEndState = GameEndState.GameRunning;
            cardTextChanges = new Dictionary<Card, TextChanges>();

            levelScript.InitState(this);
        }
Exemplo n.º 3
0
        public GameState(GameState parentState)
        {
            this.gameEndState = parentState.gameEndState;
            this.parentState = parentState;
            this.levelScript = parentState.levelScript;
            turnNumber = parentState.turnNumber;

            spawnIndices = new List<int>();
            foreach (int spawnIndex in parentState.spawnIndices)
            {
                spawnIndices.Add(spawnIndex);
            }

            minions = new Dictionary<Point, Minion>();
            foreach (KeyValuePair<Point, Minion> kv in parentState.minions)
            {
                Minion newP = new Minion(kv.Value);
                minions[newP.position] = newP;

                if (kv.Value == parentState.wizard)
                {
                    wizard = newP;
                }
            }
            UpdateSpellSets();

            ongoingEffects = new Dictionary<Point, Ongoing>();
            foreach (KeyValuePair<Point, Ongoing> kv in parentState.ongoingEffects)
            {
                ongoingEffects.Add(kv.Key, new Ongoing(kv.Value));
            }

            resources = new Dictionary<ResourceType, int>(parentState.resources);
            cardTextChanges = new Dictionary<Card, TextChanges>();
            foreach (KeyValuePair<Card, TextChanges> kv in parentState.cardTextChanges)
            {
                cardTextChanges.Add(kv.Key, kv.Value);
            }
            playableCards = new HashSet<Card>();
        }