Beispiel #1
0
 public Lava(Lava origin)
 {
     this.LiveTime = origin.LiveTime;
     this.PlayerID = origin.PlayerID;
     this.X        = origin.X;
     this.Y        = origin.Y;
 }
Beispiel #2
0
        public object Clone()
        {
            GameBoard nGameBoard = new GameBoard();

            nGameBoard = (GameBoard)this.MemberwiseClone();


            nGameBoard.Cells = new Cell[nGameBoard.W, nGameBoard.H];

            for (int i = 0; i < nGameBoard.Cells.GetLength(0); i++)
            {
                for (int j = 0; j < nGameBoard.Cells.GetLength(1); j++)
                {
                    if (this.Cells[i, j] is Cell_destructible)
                    {
                        nGameBoard.Cells[i, j] = new Cell_destructible();
                    }
                    else if (this.Cells[i, j] is Cell_indestructible)
                    {
                        nGameBoard.Cells[i, j] = new Cell_indestructible();
                    }
                    else
                    {
                        nGameBoard.Cells[i, j] = new Cell_free();
                    }
                    nGameBoard.Cells[i, j].X = i;
                    nGameBoard.Cells[i, j].Y = j;
                }
            }

            nGameBoard.Bonuses = new List <Bonus>();

            for (int i = 0; i < this.Bonuses.Count; i++)
            {
                Bonus nbonus;
                if (this.Bonuses[i] is Bonus_big)
                {
                    nbonus = new Bonus_big(this.Bonuses[i].X, this.Bonuses[i].Y);
                }
                else
                {
                    nbonus = new Bonus_fast(this.Bonuses[i].X, this.Bonuses[i].Y);
                }
                nbonus.Visible = this.Bonuses[i].Visible;
                nbonus.Color   = this.Bonuses[i].Color;
                nGameBoard.Bonuses.Add(nbonus);
            }

            nGameBoard.Bombs = new List <Bomb>();

            for (int i = 0; i < this.Bombs.Count; i++)
            {
                Bomb nbomb;
                if (this.Bombs[i] is Bomb_big)
                {
                    nbomb = new Bomb_big();
                }
                else
                {
                    nbomb = new Bomb();
                }
                nbomb.X        = this.Bombs[i].X;
                nbomb.Y        = this.Bombs[i].Y;
                nbomb.Color    = this.Bombs[i].Color;
                nbomb.PlayerID = this.Bombs[i].PlayerID;
                nbomb.LiveTime = this.Bombs[i].LiveTime;

                nGameBoard.Bombs.Add(nbomb);
            }

            nGameBoard.Lavas = new List <Lava>();

            for (int i = 0; i < this.Lavas.Count; i++)
            {
                var  tlava = this.Lavas[i];
                Lava nlava = new Lava();
                nlava.Color    = tlava.Color;
                nlava.LiveTime = tlava.LiveTime;
                nlava.PlayerID = tlava.PlayerID;
                nlava.Radius   = tlava.Radius;
                nlava.X        = tlava.X;
                nlava.Y        = tlava.Y;
                nGameBoard.Lavas.Add(nlava);
            }


            nGameBoard.Players = new List <Player>();

            for (int i = 0; i < this.Players.Count; i++)
            {
                Player nplayer = new Player();

                nplayer.X          = this.Players[i].X;
                nplayer.Y          = this.Players[i].Y;
                nplayer.Health     = this.Players[i].Health;
                nplayer.ID         = this.Players[i].ID;
                nplayer.Name       = this.Players[i].Name;
                nplayer.Points     = this.Players[i].Points;
                nplayer.BombsCount = this.Players[i].BombsCount;
                nplayer.BonusType  = this.Players[i].BonusType;
                nplayer.Color      = this.Players[i].Color;
                nplayer.ACTION     = this.Players[i].ACTION;

                nGameBoard.Players.Add(nplayer);
            }

            nGameBoard.DeadPlayers = new List <Player>();

            for (int i = 0; i < this.DeadPlayers.Count; i++)
            {
                Player nplayer = new Player();
                nplayer.X          = this.DeadPlayers[i].X;
                nplayer.Y          = this.DeadPlayers[i].Y;
                nplayer.Health     = this.DeadPlayers[i].Health;
                nplayer.ID         = this.DeadPlayers[i].ID;
                nplayer.Name       = this.DeadPlayers[i].Name;
                nplayer.Points     = this.DeadPlayers[i].Points;
                nplayer.BombsCount = this.DeadPlayers[i].BombsCount;
                nplayer.BonusType  = this.DeadPlayers[i].BonusType;
                nplayer.Color      = this.DeadPlayers[i].Color;
                nplayer.ACTION     = this.DeadPlayers[i].ACTION;

                nGameBoard.DeadPlayers.Add(nplayer);
            }

            return(nGameBoard);
        }
Beispiel #3
0
        public object Clone()
        {
            GameBoard nGameBoard = new GameBoard();

            nGameBoard = (GameBoard)MemberwiseClone();

            nGameBoard.Cells = new Cell[nGameBoard.W, nGameBoard.H];

            for (int i = 0; i < nGameBoard.Cells.GetLength(0); i++)
            {
                for (int j = 0; j < nGameBoard.Cells.GetLength(1); j++)
                {
                    nGameBoard.Cells[i, j]      = new Cell();
                    nGameBoard.Cells[i, j].X    = i;
                    nGameBoard.Cells[i, j].Y    = j;
                    nGameBoard.cells[i, j].Type = Cells[i, j].Type;
                }
            }

            nGameBoard.Bonuses = new List <Bonus>();

            for (int i = 0; i < Bonuses.Count; i++)
            {
                if (Bonuses[i].Visible == false)
                {
                    continue;
                }
                Bonus nbonus = new Bonus(Bonuses[i]);
                nGameBoard.Bonuses.Add(nbonus);
            }

            nGameBoard.Bombs = new List <Bomb>();

            for (int i = 0; i < Bombs.Count; i++)
            {
                Bomb nbomb = new Bomb(Bombs[i]);
                nGameBoard.Bombs.Add(nbomb);
            }

            nGameBoard.Lavas = new List <Lava>();

            for (int i = 0; i < Lavas.Count; i++)
            {
                Lava nlava = new Lava(Lavas[i]);
                nGameBoard.Lavas.Add(nlava);
            }

            nGameBoard.Players = new List <Player>();

            for (int i = 0; i < Players.Count; i++)
            {
                Player nplayer = new Player(Players[i]);
                nGameBoard.Players.Add(nplayer);
            }

            nGameBoard.XYinfo = new XYInfo[15, 15];

            for (int i = 0; i < nGameBoard.XYinfo.GetLength(0); i++)
            {
                for (int j = 0; j < nGameBoard.XYinfo.GetLength(1); j++)
                {
                    nGameBoard.XYinfo[i, j] = new XYInfo(XYinfo[i, j]);
                }
            }

            return(nGameBoard);
        }