Ejemplo n.º 1
0
        protected virtual void OnDeserialize(HashSet <Cell> all_cells, BinaryReader r)
        {
            using (new WriteLock(DataLock))
                using (new WriteLock(InputLock))
                {
                    m_ExploreCells.Clear();

                    m_Enabled = r.ReadBoolean();

                    int explore_cells_count = r.ReadInt32();

                    // pre-allocate explore cells
                    for (int i = 0; i < explore_cells_count; ++i)
                    {
                        ExploreCell explore_cell = new ExploreCell();
                        explore_cell.GlobalId = r.ReadInt32();
                        m_ExploreCells.Add(explore_cell);
                    }

                    foreach (ExploreCell explore_cell in m_ExploreCells)
                    {
                        explore_cell.Deserialize(m_ExploreCells, all_cells, r);
                    }

                    ExploreCell.LastExploreCellGlobalId = r.ReadInt32();

                    m_HintPos = new Vec3(r);
                }
        }
Ejemplo n.º 2
0
        internal virtual void Deserialize(List <Cell> all_cells, BinaryReader r)
        {
            using (new WriteLock(DataLock))
                using (new WriteLock(InputLock))
                {
                    m_ExploreCells.Clear();
                    m_ExploreCellsDistancer.Clear();

                    m_Enabled = r.ReadBoolean();

                    int explore_cells_count = r.ReadInt32();

                    // pre-allocate explore cells
                    for (int i = 0; i < explore_cells_count; ++i)
                    {
                        ExploreCell explore_cell = new ExploreCell();
                        explore_cell.GlobalId = r.ReadInt32();
                        m_ExploreCells.Add(explore_cell);
                    }

                    m_ExploreCells.Sort(new Cell.CompareByGlobalId());

                    foreach (ExploreCell explore_cell in m_ExploreCells)
                    {
                        explore_cell.Deserialize(m_ExploreCells, all_cells, r);
                    }

                    ExploreCell.LastExploreCellGlobalId = r.ReadInt32();

                    m_ExploreCellsDistancer.Deserialize(r);

                    m_HintPos = new Vec3(r);
                }
        }
Ejemplo n.º 3
0
        protected virtual void OnDeserialize(HashSet <Cell> all_cells, Dictionary <int, Cell> id_to_cell, BinaryReader r)
        {
            m_ExploreCells.Clear();

            m_Enabled = r.ReadBoolean();

            int explore_cells_count = r.ReadInt32();

            // pre-allocate explore cells
            for (int i = 0; i < explore_cells_count; ++i)
            {
                ExploreCell explore_cell = new ExploreCell();
                explore_cell.GlobalId = r.ReadInt32();
                m_ExploreCells.Add(explore_cell);
            }

            foreach (ExploreCell explore_cell in m_ExploreCells)
            {
                explore_cell.Deserialize(m_ExploreCells, all_cells, id_to_cell, r);
            }

            foreach (ExploreCell explore_cell in m_ExploreCells)
            {
                OnExploreCellAdded(explore_cell);
            }

            var dest_cell_global_id = r.ReadInt32();

            if (dest_cell_global_id >= 0)
            {
                m_DestCell = m_ExploreCells.FirstOrDefault(x => x.GlobalId == dest_cell_global_id);
            }

            ExploreCell.LastExploreCellGlobalId = r.ReadInt32();

            m_ExploredCellsCount  = r.ReadInt32();
            m_CellsToExploreCount = r.ReadInt32();

            var explore_constraints_count = r.ReadInt32();
            var exConstraints             = explore_constraints_count > 0 ? new List <AABB>() : null;

            if (exConstraints != null)
            {
                for (int i = 0; i < explore_constraints_count; ++i)
                {
                    exConstraints.Add(new AABB(r));
                }
            }
            m_ExploreConstraints = exConstraints;

            m_HintPos = new Vec3(r);
        }
Ejemplo n.º 4
0
        protected virtual void OnDeserialize(HashSet <Cell> all_cells, Dictionary <int, Cell> id_to_cell, BinaryReader r)
        {
            using (new WriteLock(DataLock))
                using (new WriteLock(InputLock))
                {
                    m_ExploreCells.Clear();

                    m_Enabled = r.ReadBoolean();

                    int explore_cells_count = r.ReadInt32();

                    // pre-allocate explore cells
                    for (int i = 0; i < explore_cells_count; ++i)
                    {
                        ExploreCell explore_cell = new ExploreCell();
                        explore_cell.GlobalId = r.ReadInt32();
                        m_ExploreCells.Add(explore_cell);
                    }

                    foreach (ExploreCell explore_cell in m_ExploreCells)
                    {
                        explore_cell.Deserialize(m_ExploreCells, all_cells, id_to_cell, r);
                    }

                    var dest_cell_global_id = r.ReadInt32();
                    if (dest_cell_global_id >= 0)
                    {
                        m_DestCell = m_ExploreCells.FirstOrDefault(x => x.GlobalId == dest_cell_global_id);
                    }

                    ExploreCell.LastExploreCellGlobalId = r.ReadInt32();

                    m_ExploredCellsCount  = r.ReadInt32();
                    m_CellsToExploreCount = r.ReadInt32();

                    m_HintPos = new Vec3(r);
                }
        }
Ejemplo n.º 5
0
        internal virtual void Deserialize(List<Cell> all_cells, BinaryReader r)
        {
            using (new WriteLock(DataLock))
            using (new WriteLock(InputLock))
            {
                m_ExploreCells.Clear();
                m_ExploreCellsDistancer.Clear();

                m_Enabled = r.ReadBoolean();

                int explore_cells_count = r.ReadInt32();

                // pre-allocate explore cells
                for (int i = 0; i < explore_cells_count; ++i)
                {
                    ExploreCell explore_cell = new ExploreCell();
                    explore_cell.GlobalId = r.ReadInt32();
                    m_ExploreCells.Add(explore_cell);
                }

                m_ExploreCells.Sort(new Cell.CompareByGlobalId());

                foreach (ExploreCell explore_cell in m_ExploreCells)
                    explore_cell.Deserialize(m_ExploreCells, all_cells, r);

                ExploreCell.LastExploreCellGlobalId = r.ReadInt32();

                m_ExploreCellsDistancer.Deserialize(r);

                m_HintPos = new Vec3(r);
            }
        }