Ejemplo n.º 1
0
        public override InstanceState GetState()
        {
            ushort node = id.NetNode;

            NodeState state = new NodeState();

            state.instance = this;
            state.Info     = Info;

            state.position      = nodeBuffer[node].m_position;
            state.terrainHeight = TerrainManager.instance.SampleOriginalRawHeightSmooth(state.position);

            state.flags = nodeBuffer[node].m_flags;

            MoveableBuilding pillarInstance = Pillar;

            if (Pillar != null)
            {
                state.pillarState = Pillar.GetState() as BuildingState;
            }

            for (int i = 0; i < 8; i++)
            {
                ushort segment = nodeBuffer[node].GetSegment(i);
                if (segment != 0)
                {
                    state.segmentsSave[i].startDirection = segmentBuffer[segment].m_startDirection;
                    state.segmentsSave[i].endDirection   = segmentBuffer[segment].m_endDirection;
                }
            }

            return(state);
        }