Revize 2a7f543a
Přidáno uživatelem Zuzana Káčereková před téměř 4 roky(ů)
Client/Client/Assets/Scripts/MapRenderer.cs | ||
---|---|---|
22 | 22 |
public Color maxColor; |
23 | 23 |
|
24 | 24 |
|
25 |
private Vector3 startPos; |
|
26 |
|
|
27 |
private Vector3 startScale; |
|
28 |
|
|
29 |
|
|
25 | 30 |
private SpriteRenderer underlay; |
26 | 31 |
|
27 | 32 |
private Dictionary<string, SpriteRenderer> overlay = new Dictionary<string, SpriteRenderer>(); |
... | ... | |
30 | 35 |
// Start is called before the first frame update |
31 | 36 |
void Start() |
32 | 37 |
{ |
38 |
startPos = transform.position; |
|
39 |
startScale = transform.localScale; |
|
40 |
|
|
33 | 41 |
Load(); |
34 | 42 |
interactable = true; |
35 | 43 |
} |
... | ... | |
118 | 126 |
} |
119 | 127 |
} |
120 | 128 |
|
121 |
public void Animate(float value)
|
|
129 |
public void SetColors(double[] predictions)
|
|
122 | 130 |
{ |
123 |
foreach (var sprite in overlay) |
|
131 |
var buildings = Buildings.buildings; |
|
132 |
|
|
133 |
if (predictions.Length != buildings.Length) |
|
134 |
{ |
|
135 |
Debug.LogError("Mismatch in prediction and building count."); |
|
136 |
return; |
|
137 |
} |
|
138 |
|
|
139 |
for (int i = 0; i < buildings.Length; i++) |
|
124 | 140 |
{ |
125 |
sprite.Value.color = Color.Lerp(minColor, maxColor, value); |
|
141 |
if (predictions[i] < 0) |
|
142 |
{ |
|
143 |
// TODO set different material |
|
144 |
} |
|
145 |
else |
|
146 |
{ |
|
147 |
overlay[buildings[i]].color = Color.Lerp(minColor, maxColor, (float)predictions[i] / 100f); |
|
148 |
} |
|
126 | 149 |
} |
150 |
|
|
127 | 151 |
} |
128 | 152 |
|
129 | 153 |
/// <summary> |
... | ... | |
133 | 157 |
private void Reset() |
134 | 158 |
{ |
135 | 159 |
// Reset scale and position |
136 |
transform.position = new Vector3(0, 0, 0);
|
|
137 |
transform.localScale = new Vector3(1, 1, 1);
|
|
160 |
transform.position = startPos;
|
|
161 |
transform.localScale = startScale;
|
|
138 | 162 |
|
139 | 163 |
// Destroy children |
140 | 164 |
if (underlay != null && underlay.gameObject != null) |
Také k dispozici: Unified diff
Re #8829 Added heatmap visualization