コード例 #1
0
        //Event Handler
        //---------------------------------------------------------------------------
        public void Handle_PlayerLeaveChunk(IEvent _event)
        {
            GSW.RestartTimer();
            //Interpret Event
            E_Player_LeaveChunk LeaveChunk = (_event as E_Player_LeaveChunk);

            AreaRect TempArea = m_CoverArea;

            TempArea.Move(LeaveChunk.Offset);

            int          i, j = 0;
            ChunkInWorld SpawnLoc;

            for (i = TempArea.left; i <= TempArea.right; ++i)
            {
                for (j = TempArea.bottom; j <= TempArea.top; ++j)
                {
                    SpawnLoc = new ChunkInWorld(new Vector2Int(i, j), m_World);

                    m_WorldEntity.Spawn(SpawnLoc);

                    m_CoveredLoc.Remove(SpawnLoc.Value);
                }
            }

            //remove not covered chunk
            foreach (var uncoverd in m_CoveredLoc)
            {
                m_WorldEntity.Remove(new ChunkInWorld(uncoverd, m_World));
            }
            //update cover area
            SetCoverArea(TempArea);
        }
コード例 #2
0
        public void SetLocation(ChunkInWorld chunkInWorld)
        {
            GSW.RestartTimer();
            //Set Location
            m_ChunkinWorld          = chunkInWorld;
            transform.localPosition = m_ChunkinWorld.ToCoord3D(m_World);

            //Set Name
            transform.name = "Chunk" + "[" + m_ChunkinWorld.Value.x + "]" + "[" + m_ChunkinWorld.Value.y + "]";

            //Compute Unity Position
            m_Coord = chunkInWorld.ToCoord2DInt(m_World);

            //create Height map

            m_HeightMap
                = MonoSingleton <GameSystem> .Instance.WorldMngIns.GetComponent <MapMaker>().GetBlendedHeightMap(m_ChunkinWorld.Value);

            // = MonoSingleton<GameSystem>.Instance.WorldMngIns.GetComponent<BiomeMng>().MakeHeightMap(m_ChunkinWorld.Value);
            //Create Sections
            InitAllSections();

            //StartCoroutine("CreCreateAllSections_Corou");
        }