处理了下热度数值
This commit is contained in:
@@ -15,7 +15,18 @@ public class HeatMapController : MonoBehaviour
|
||||
private Vector4[] properties = new Vector4[7]; // 存储6个盒子大小的数组, (x,y) = boxsize
|
||||
|
||||
public Slider slider;
|
||||
private float tempNum=0;
|
||||
|
||||
public float tempNumMax;
|
||||
private float uftempture=1;
|
||||
private float backtemture=1;
|
||||
|
||||
private float modulesTempture=1;
|
||||
|
||||
public float uf=1;
|
||||
public float back=1;
|
||||
|
||||
public float module=0.7f;
|
||||
//public Texture2D hotspotShapeTexture; // 引用热点形状纹理
|
||||
|
||||
|
||||
@@ -23,6 +34,7 @@ public class HeatMapController : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
slider.value=1;
|
||||
tempture=slider.value;
|
||||
// 初始化数据,这里是示例,你可以根据实际需求设置
|
||||
SetDataToMaterial();
|
||||
@@ -30,14 +42,56 @@ public class HeatMapController : MonoBehaviour
|
||||
}
|
||||
public void SetDataToMaterial()
|
||||
{
|
||||
tempture=slider.value;
|
||||
|
||||
// uftempture=slider.value;
|
||||
// uftempture=Map(uftempture,0,3,1.5f,2.6f);
|
||||
|
||||
// backtemture=slider.value;
|
||||
// backtemture=Map(backtemture,0,3,1.5f,3.6f);
|
||||
|
||||
// modulesTempture=slider.value;
|
||||
// modulesTempture=Map(modulesTempture,0,3f,1.5f,2.3f);
|
||||
|
||||
if (slider.value <= 1)
|
||||
{
|
||||
uftempture = Mathf.Lerp(1.5f, 2.4f, slider.value ); // 线性插值
|
||||
modulesTempture = Mathf.Lerp(1.5f, 2.1f, slider.value)-tempNum;
|
||||
backtemture = Mathf.Lerp(1.5f, 2.1f, slider.value);
|
||||
}
|
||||
else if (slider.value <= 2)
|
||||
{
|
||||
uftempture = Mathf.Lerp(2.4f, 2.7f, slider.value - 1);
|
||||
modulesTempture = Mathf.Lerp(2.1f, 2.3f, slider.value - 1);
|
||||
backtemture = Mathf.Lerp(2.1f, 3.6f, slider.value - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
uftempture =2.7f;
|
||||
modulesTempture = 2.6f;
|
||||
backtemture = 3.8f;
|
||||
}
|
||||
|
||||
|
||||
tempture=Map(tempture,0,1,0.5f,2.3f);
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
RectTransform transform=Pos[i].GetComponent<RectTransform>();
|
||||
|
||||
points[i] = new Vector4(Pos[i].position.x, Pos[i].position.y, tempture, 0); // (x, y, z, temperature)
|
||||
if(i==0)
|
||||
{
|
||||
points[i] = new Vector4(Pos[i].position.x, Pos[i].position.y, uftempture, 0);
|
||||
|
||||
}
|
||||
else if(i==6)
|
||||
{
|
||||
points[i] = new Vector4(Pos[i].position.x, Pos[i].position.y, backtemture, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
points[i] = new Vector4(Pos[i].position.x, Pos[i].position.y, modulesTempture, 0); // (x, y, z, temperature)
|
||||
|
||||
}
|
||||
|
||||
|
||||
properties[i] = new Vector4(transform.rect.width*1, transform.rect.height*1, 0.0f, 0.0f); // (boxsize x, boxsize y, unused, unused)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user