public bool MaskBy(int sx, int sy, float vault = 0.5f) { int indexX = this.tex.width * sx / (int)this.cam.pixelWidth; int indexY = this.tex.height * sy / (int)this.cam.pixelHeight; float mistAmt = TexSight.GetMistAmt(indexX, indexY, this.sightTexs.ToArray()); return(mistAmt < vault); }
public static TexSight ConvertUnitSight(UnitSight u, Camera cam) { TexSight result = default(TexSight); Vector3 vector = cam.WorldToScreenPoint(u.worldPos); result.texX = vector.x / cam.pixelWidth * (float)PostMist.texW; result.texY = vector.y / cam.pixelHeight * (float)PostMist.texH; result.sight = u.sight; result.fade = u.fade; return(result); }
private void SetTexel() { for (int i = 0; i < this.tex.width; i++) { for (int j = 0; j < this.tex.height; j++) { float mistAmt = TexSight.GetMistAmt(i, j, this.sightTexs.ToArray()); float a = (this.white * (1f - mistAmt)).a; this.tex.SetPixel(i, j, this.white * a); } } }
public void Pass_EnemyUnitSight(UnitSight[] sights) { if (sights == null || sights.Length < 1) { return; } for (int i = 0; i < sights.Length; i++) { UnitSight u = sights[i]; TexSight item = TexSight.ConvertUnitSight(u, this.cam); this.sightTexs.Add(item); } }
public static float GetMistAmt(int indexX, int indexY, TexSight[] points) { return(TexSight.GetNear(indexX, indexY, points)); }