Exemple #1
0
        protected virtual void Awake()
        {
            Environment.SetEnvironmentVariable("MONO_REFLECTION_SERIALIZER", "yes");
            assetsPath = Application.streamingAssetsPath;

            if (m_tileMeshSettings == null)
            {
                m_tileMeshSettings = new TileMeshSettings(2, 2, 16, 1f, MeshMode.SingleQuad);
            }

            if (m_tileSheet == null)
            {
                m_tileSheet = ScriptableObject.CreateInstance <TileSheet>();
            }

            if (m_chunkManager == null)
            {
                m_chunkManager = new TileChunkManager();
                m_chunkManager.Initialize(this, m_tileMeshSettings);
            }

            if (m_tileMapData == null)
            {
                m_tileMapData = new TileMapData();
                m_tileMapData.SetSize(m_tileMeshSettings.TilesX, m_tileMeshSettings.TilesY);
            }

            if (Application.isPlaying || m_activeInEditMode)
            {
                CreateMesh();
            }
        }
Exemple #2
0
        protected virtual void Awake()
        {
            if (m_tileMeshSettings == null)
            {
                m_tileMeshSettings = new TileMeshSettings(2, 2, 16, 1f, MeshMode.SingleQuad);
            }

            if (m_tileSheet == null)
            {
                m_tileSheet = ScriptableObject.CreateInstance <TileSheet>();
            }

            if (m_chunkManager == null)
            {
                m_chunkManager = new TileChunkManager();
                m_chunkManager.Initialize(this, m_tileMeshSettings);
            }

            if (m_tileMapData == null)
            {
                m_tileMapData = new TileMapData();
                m_tileMapData.SetSize(m_tileMeshSettings.TilesX, m_tileMeshSettings.TilesY);
            }

            if (Application.isPlaying || m_activeInEditMode)
            {
                CreateMesh();
            }
        }