Esempio n. 1
0
        public override InstanceState SaveToState(bool integrate = true)
        {
            ushort node = id.NetNode;

            NodeState state = new NodeState
            {
                instance        = this,
                Info            = Info,
                position        = nodeBuffer[node].m_position,
                flags           = nodeBuffer[node].m_flags,
                isCustomContent = Info.Prefab.m_isCustomContent
            };

            state.terrainHeight = TerrainManager.instance.SampleOriginalRawHeightSmooth(state.position);

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

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

            //state.SaveIntegrations(integrate);

            return(state);
        }