private MaskCalcluatorBase CreateCalculator(FogOfWarEffect.FogMaskType maskType) { switch (maskType) { case FogOfWarEffect.FogMaskType.AccurateFOV: return(new FOVAccurate()); case FogOfWarEffect.FogMaskType.BasicFOV: return(new FOVSimple()); case FogOfWarEffect.FogMaskType.Circular: return(new CircularMask()); default: return(null); } }
public FOWMap(FogOfWarEffect.FogMaskType fogMaskType, Vector3 begionPosition, float xSize, float zSize, int texWidth, int texHeight, float heightRange) { m_FOVCalculator = new WaitCallback(this.CalculateFOV); m_MapData = new byte[texWidth, texHeight]; m_MaskTexture = new FOWMaskTexture(texWidth, texHeight); m_DeltaX = xSize / texWidth; m_DeltaZ = zSize / texHeight; m_BeginPosition = begionPosition; m_TexWidth = texWidth; m_TexHdight = texHeight; m_CalculaterBase = CreateCalculator(fogMaskType); GenerateMapData(heightRange); m_Lock = new object(); }