/// <summary> /// ------------ /// PSEUDO CODE: /// ------------ /// create array from data /// run 2xloops of x, y /// find location of item x,y /// store its location in new array /// create search 'window' around it: /// [x-n, x+n, y-n, y+n] /// if found Target item, measure Manhatten distance to it /// add distances to _varDist and create new array of [x,y,_varDist] /// loop through array, look for min, max of _varDist /// assign color/Y axis/other viz based on value /// /// </summary> public void HeatmapViz(HeatmapType heatmapType) { if (heatmapsParent == null) { return; } heatmapsParent.SetActive(true); // Toggle heatmap parents heatmaps[(int)heatmapType].SetParentActive(true); }
public void GenerateMap(HeatmapType type) { var dic = PlayerEventTrack.PositionData; int d = 0; switch (type) { case HeatmapType.Position: count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { positions[i] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[i] = new Vector4(1.0f, 0.5f, 0, 0); } break; case HeatmapType.Death: dic = PlayerEventTrack.EventData; count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { if ((string)dic[i]["Type"] == "Dead") { Debug.Log("YES"); positions[d] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[d++] = new Vector4(1.0f, 1.0f, 0, 0); } } count = d; break; case HeatmapType.Jump: dic = PlayerEventTrack.EventData; count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { if ((string)dic[i]["Type"] == "Jump") { positions[d] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[d++] = new Vector4(1.0f, 0.85f, 0, 0); } } count = d; break; case HeatmapType.OpenMenu: dic = PlayerEventTrack.EventData; count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { if ((string)dic[i]["Type"] == "OpenMenu") { positions[d] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[d++] = new Vector4(1.0f, 0.85f, 0, 0); } } count = d; break; case HeatmapType.Attack: dic = PlayerEventTrack.EventData; count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { if ((string)dic[i]["Type"] == "Attack") { positions[d] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[d++] = new Vector4(1.0f, 0.85f, 0, 0); } } count = d; break; case HeatmapType.Damaged: dic = PlayerEventTrack.EventData; count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { if ((string)dic[i]["Type"] == "Damaged") { positions[d] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[d++] = new Vector4(1.0f, 0.85f, 0, 0); } } count = d; break; case HeatmapType.EnemyKilled: dic = PlayerEventTrack.EventData; count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { if ((string)dic[i]["Type"] == "EnemyKilled") { positions[d] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[d++] = new Vector4(1.0f, 0.85f, 0, 0); } } count = d; break; case HeatmapType.EnemyDamaged: dic = PlayerEventTrack.EventData; count = dic.Count; positions = new Vector4[count]; properties = new Vector4[count]; for (int i = 0; i < count; ++i) { if ((string)dic[i]["Type"] == "EnemyDamaged") { positions[d] = new Vector4((float)dic[i]["PositionX"], 0f, (float)dic[i]["PositionZ"], 0); properties[d++] = new Vector4(1.0f, 0.85f, 0, 0); } } count = d; break; } material.SetInt("_Points_Length", count); material.SetVectorArray("_Points", positions); material.SetVectorArray("_Properties", properties); }