Ejemplo n.º 1
0
        private ForExternalUse.Synchronization.ISynchronizer GetSynchronizationData(bool nullify)
        {
            List <Actor>            changedActors      = Actors.FindAll(x => x.Affected);
            List <ActiveDecoration> changedDecorations = Decorations.FindAll(x => x.Affected);
            List <SpecEffect>       changedEffects     = SpecEffects.FindAll(x => x.Affected);
            List <Tile>             changedTiles       = new List <Tile>();

            for (int x = 0; x < Tiles.Length; x++)
            {
                for (int y = 0; y < Tiles[x].Length; y++)
                {
                    if (Tiles[x][y].Affected)
                    {
                        changedTiles.Add(Tiles[x][y]);
                    }
                }
            }

            Synchronizer sync = new Synchronizer(
                TempTileObject,
                players,
                changedActors,
                changedDecorations,
                changedEffects,
                DeletedActors,
                DeletedDecorations,
                DeletedEffects,
                new Point(Tiles.Length, Tiles[0].Length),
                changedTiles,
                RandomCounter);

            if (nullify)
            {
                changedActors.ForEach(x => x.Affected = false);
                changedDecorations.ToList().ForEach(x => x.Affected = false);
                changedEffects.ToList().ForEach(x => x.Affected     = false);
                changedTiles.ToList().ForEach(x => x.Affected       = false);
                this.DeletedDecorations = new List <ActiveDecoration>();
                this.DeletedActors      = new List <Actor>();
                this.DeletedEffects     = new List <SpecEffect>();
            }

            return(sync);
        }