Ejemplo n.º 1
0
 public void save(Stream myStream, Square[,] GameGrid)
 {
     using (myStream)
     {
         BinaryFormatter formatter = new BinaryFormatter();
         formatter.Serialize(myStream, SetupSave(GameGrid));
     }
 }
Ejemplo n.º 2
0
        private void SetupEntityGrid()
        {
            GameUniformGrid.Children.Clear();
            GameBoard = new Square[25, 25];

            for (int x = 0; x < 25; x++)
            {
                for (int y = 0; y < 25; y++)
                {
                    Square r = new Square { Background = Brushes.MintCream };
                    GameBoard[x, y] = r;
                    GameBoard[x, y].Margin = new Thickness(1);
                    GameUniformGrid.Children.Add(GameBoard[x, y]);
                    Console.WriteLine(GameBoard[x,y]);

                }
            }
        }
Ejemplo n.º 3
0
        private SaveClass SetupSave(Square[,] GameBoard)
        {
            SaveableSquare[,] testBoard = new SaveableSquare[25, 25];
            foreach (Square s in GameBoard)
            {
                SaveableSquare square = new SaveableSquare();
                square.Items = s.Items;
                square.IsOpen = s.IsOpen;
                square.Token = s.Token;
                //square.PassCharacter = s.PassCharacter;
                square.imagePath = s.imagePath;
                square.X = s.X;
                square.Y = s.Y;
                testBoard[s.X, s.Y] = square;
            }

            SaveClass save = new SaveClass(testBoard);
            return save;
        }
Ejemplo n.º 4
0
        private void SetupEntityGrid()
        {
            GameUniformGrid.Children.Clear();
            GameBoard = new Square[25, 25];

            for (int x = 0; x < 25; x++)
            {
                for (int y = 0; y < 25; y++)
                {
                    Square r = new Square(AddCharacter, x, y);
                    r.Background = new SolidColorBrush(Color.FromArgb(255, 225, 225, 255));
                    GameBoard[x, y] = r;
                    GameBoard[x, y].Margin = new Thickness(1);
                }
            }
            createGridDisplay();
        }
Ejemplo n.º 5
0
 private void LoadGame(SaveableSquare[,] savedCampaign)
 {
     foreach (SaveableSquare s in savedCampaign)
     {
         Square tempSquare = new Square(AddCharacter, s.X, s.Y);
         tempSquare.Background = new SolidColorBrush(Color.FromArgb(255, 225, 225, 255));
         tempSquare.IsOpen = s.IsOpen;
         tempSquare.Items = s.Items;
         tempSquare.Token = s.Token;
         tempSquare.imagePath = s.imagePath;
         tempSquare.Margin = new Thickness(1);
         tempSquare.RedrawImage();
         GameBoard[s.X, s.Y] = tempSquare;
     }
     createGridDisplay();
 }
Ejemplo n.º 6
0
 public void fireDamage(Square s)
 {
     if (s.Token != null)
     {
         s.Token.HP -= 4;
         s.Token.SCD -= 2;
     }
     if (GameBoard[s.X - 1, s.Y].Token != null)
     {
         GameBoard[s.X - 1, s.Y].Token.HP -= 2;
     }
     if (GameBoard[s.X + 1, s.Y].Token != null)
     {
         GameBoard[s.X + 1, s.Y].Token.HP -= 2;
     }
     if (GameBoard[s.X,s.Y - 1].Token != null)
     {
         GameBoard[s.X, s.Y - 1].Token.HP -= 2;
     }
     if (GameBoard[s.X, s.Y + 1].Token != null)
     {
         GameBoard[s.X, s.Y + 1].Token.HP -= 2;
     }
 }