Ejemplo n.º 1
0
        protected void ReadBlock(SBR block, int tileX, int tileZ)
        {
            PositionHolder holder = new PositionHolder()
            {
                TileX = tileX,
                TileZ = tileZ,
            };

            while (!block.EndOfBlock())
            {
                using (var subBlock = block.ReadSubBlock())
                {
                    if (subBlock.ID == TokenID.UiD)
                    {
                        UiD = subBlock.ReadUInt();
                    }
                    else
                    {
                        AddOrModifyObj(subBlock, holder);
                    }
                }
            }
            worldPosition = PositionHolder.WorldPositionFromMSTSLocation(holder, UiD);
            if (this is HazardObject hazard)  //remember the Quaternation component
            {
                hazard.Direction = holder.Direction;
            }
        }
Ejemplo n.º 2
0
        internal void AddOrModifyObj(SBR subBlock)
        {
            PositionHolder holder = new PositionHolder()
            {
                TileX = worldPosition.TileX,
                TileZ = worldPosition.TileZ,
            };

            AddOrModifyObj(subBlock, holder);

            if (holder.LocationSet && (holder.PositionSet || holder.DirectionSet))
            {
                worldPosition = PositionHolder.WorldPositionFromMSTSLocation(holder, UiD);
            }
        }