// Call this whenever you change any of the size values of the map public void Reinitialize() { if (_fogValuesCurrent == null || _fogValuesCurrent.Length != mapResolution.x * mapResolution.y) { _fogValuesCurrent = new byte[mapResolution.x * mapResolution.y]; _fogValuesTotal = new byte[mapResolution.x * mapResolution.y]; } if (_drawer == null) { _drawer = new FogOfWarDrawerSoftware(); } _drawer.Initialise(new FogOfWarMap(this)); _drawer.Clear(255); for (int i = 0; i < _fogValuesCurrent.Length; ++i) { _fogValuesCurrent[i] = 255; _fogValuesTotal[i] = 255; } if (_material == null) { _material = new Material(fogOfWarShader); _material.name = "FogMaterial"; } }
public void Reinitialize() { if (_fogValuesCopy == null || _fogValuesCopy.Length != mapResolution.x * mapResolution.y) { _fogValuesCopy = new byte[mapResolution.x * mapResolution.y]; } if (_drawer == null) { _drawer = new FogOfWarDrawerSoftware(); } _drawer.Initialise(new FogOfWarMap(this)); _drawer.Clear(255); if (_material == null) { _material = new Material(fogOfWarShader); _material.name = "FogMaterial"; } }