// Update is called once per frame void Update() { // Update position (x,y) if (_move_left) { x -= moveSpeed; } if (_move_right) { x += moveSpeed; } if (_move_top) { y += moveSpeed; } if (_move_bottom) { y -= moveSpeed; } // Check position (x,y) if (x < -hw) { x = -hw; } else if (x > hw) { x = hw; } if (y < -hh) { y = -hh; } else if (y > hh) { y = hh; } // Update transform view viewTrans.localPosition = new Vector3(x, y, 0); float lt_x = x + hw; float lt_y = y + hh; kit.UpdateRange((int)lt_x, (int)lt_y, view_r); /// 为了测试,令视野大小等于地图大小,且固定视野最小点为(0,0)点 kit.UpdateView(maskPic.material, 0, 0); kit.RefreshView(); kit.RefreshMaskTexture2D(fogTexture); kit.CleanData(); }
public void ApplyFog() { kit.RefreshView(); kit.RefreshMaskTexture2D(fogTexture); kit.CleanData(); }