Beispiel #1
0
        public MapView(string n, GraphicsDevice gd)
            : base(n)
        {
            // This would be where to create the map of whatever size. We are starting with 5 by 5, but the gate is out of that.
            // So we need an extra one on both sides. The other extras will just be marked as filled by something.
            map = new CardClass[7, 7];

            turns.Add(new Turn1(map.GetLength(1), map.GetLength(0)));
            if (type == GameType.Player1)
                turns.Add(new AITurn(map.GetLength(1), map.GetLength(0), this));
            else
                turns.Add(new Turn2(map.GetLength(1), map.GetLength(0)));

            cardTypes = new List<CardType>();

            activeTurn = turns[0];
            winner = 0;

            moveStack = new Stack<MoveList>();
            movementSteps = new Stack<MoveSteps>(3);

            SetCenter(new Vector2((gd.Viewport.Width - CardClass.cardWidth * map.GetLength(1)) / 2, (gd.Viewport.Height - CardClass.cardHeight * map.GetLength(1)) / 2));
        }
Beispiel #2
0
        public void StartGame(GameType gt)
        {
            for (int i = 0; i < map.GetLength(0); i++)
            {
                for (int j = 0; j < map.GetLength(1); j++)
                {
                    map[i, j] = null;
                }
            }
            type = gt;

            if (type == GameType.Player1)
                turns[1] = new AITurn(map.GetLength(0), map.GetLength(1), this);
            else
                turns[1] = new Turn2(map.GetLength(0), map.GetLength(1));

            turns[1].LoadTexture(content);

            deploy = 6;
            currState = GameState.GameRunning;

            SetCenter(center);
            LoadDecks();

            foreach (Turn t in turns)
            {
                t.ClearHand();
                t.ShuffleDeck();

                for (int i = 0; i < 5; i++)
                {
                    t.AddToHand();
                }
            }

            Random rand = new Random();
            activeTurn = turns[rand.Next(turns.Count -1)];

            moveStack.Clear();
        }
Beispiel #3
0
        private void SwitchTurns()
        {
            CheckWin();
            if (activeTurn.HandCount() < 3)
                activeTurn.AddToHand();

            if (deploy > 0)
                deploy--;

            activeTurn = (turns[0] == activeTurn ? turns[1] : turns[0]);
            ResetSelectedCard();
        }
Beispiel #4
0
        public MapView()
            : base()
        {
            // This would be where to create the map of whatever size. We are starting with 5 by 5, but the gate is out of that.
            // So we need an extra one on both sides. The other extras will just be marked as filled by something.
            map = new CardClass[7,7];

            turns[0] = new Turn1(map.GetLength(0), map.GetLength(1));
            if (type == GameType.Player1)
                turns[1] = new AITurn(map.GetLength(0), map.GetLength(1), this);
            else
                turns[1] = new Turn2(map.GetLength(0), map.GetLength(1));

            cardTypes = new List<CardType>();
            moveStack = new Stack<MoveList>();

            activeTurn = turns[0];
            winner = 0;
        }