public void DeInit() { if (m_MapDataTexture != null) { Object.DestroyImmediate(m_MapDataTexture); m_MapDataTexture = null; } m_MapData = null; m_MapDataColorBuffer = null; m_MapDataObstacleBuffer = null; m_FOWData = null; }
public void Init(FOWData data = null) { if (data != null) { m_FOWData = data; } int length = texWidth * texHeight; // regenerate when attributes changed if (m_MapDataColorBuffer == null || m_MapDataColorBuffer.Length != length) { m_MapDataColorBuffer = new Color[texWidth * texHeight]; } if (m_MapDataObstacleBuffer == null) { m_MapDataObstacleBuffer = new List <Vector2>(); } if (m_MapDataTexture == null || m_MapDataTexture.width != texWidth || m_MapDataTexture.height != texHeight) { if (m_MapDataTexture != null) { Object.DestroyImmediate(m_MapDataTexture); m_MapDataTexture = null; } m_MapDataTexture = new Texture2D(texWidth, texHeight, TextureFormat.ARGB32, false); m_MapDataTexture.wrapMode = TextureWrapMode.Clamp; m_MapDataTexture.filterMode = FilterMode.Bilinear; } if (m_MapData == null || m_MapData.Length != length) { m_MapData = new bool[texWidth, texHeight]; } }