Vector2 EvaluateCDFAndGetPos(CDFdistrib distrib) { Vector2 pixel = distrib.Evaluate().ToVector2(); Vector2 normalizedCoords = Vector2.Divide(new Vector2(pixel.Y, pixel.X), new Vector2(distribWidth, distribHeight)); return(PlayArea.MapArea.Evaluate(normalizedCoords) + MyRandom.InsideUnitCircle() * pixelSize); }
public override void Start() { //DISTRIB int idx = GameManager.LvlScene; Texture2D moneyPic = BRS.Engine.File.Load <Texture2D>("Images/heatmap/level" + idx + "_green"); Texture2D goldPic = BRS.Engine.File.Load <Texture2D>("Images/heatmap/level" + idx + "_yellow"); Texture2D uniformPic = BRS.Engine.File.Load <Texture2D>("Images/heatmap/level" + idx + "_white"); green = new CDFdistrib(moneyPic, 1); yellow = new CDFdistrib(goldPic, 1); white = new CDFdistrib(uniformPic, 1); distribWidth = moneyPic.Width; distribHeight = moneyPic.Height; pixelSize = (float)PlayArea.SpawnArea.Width / moneyPic.Width; //HEATMAP heatmapPic = BRS.Engine.File.Load <Texture2D>("Images/heatmap/saved_heatmap"); //playerHeatmap = new int[distribWidth, distribHeight]; StartComputingHeatmap(); }