控制灯

This commit is contained in:
taosuqi 2025-02-19 17:58:20 +08:00
parent 56ea9b8674
commit e30309cd14
1 changed files with 18 additions and 18 deletions

View File

@ -71,7 +71,7 @@ public class ClickKangYangdevice : MonoBehaviour
/// </summary>
public void Init()
{
XueYaYiSMR.SetBlendShapeWeight(0,0);
XueYaYiSMR.SetBlendShapeWeight(0, 0);
ShuaiDaoIamge.gameObject.SetActive(false);
OldManAni.speed = 0;
playableDirector.Pause();
@ -90,14 +90,14 @@ public class ClickKangYangdevice : MonoBehaviour
if (lightsildervalue > value)
{
Debug.Log("----");
SetEmissionIntensity(LightsModel[i].GetComponent<MeshRenderer>(), value);
LightsModel[i].GetChild(0).GetComponent<Light>().intensity = value;
SetEmissionIntensity(LightsModel[i].parent.GetComponent<MeshRenderer>(), value);
LightsModel[i].GetComponent<Light>().intensity = value;
}
else if (lightsildervalue < value)
{
Debug.Log("+++++++++");
SetEmissionIntensity(LightsModel[i].GetComponent<MeshRenderer>(), value);
LightsModel[i].GetChild(0).GetComponent<Light>().intensity = value;
SetEmissionIntensity(LightsModel[i].parent.GetComponent<MeshRenderer>(), value);
LightsModel[i].GetComponent<Light>().intensity = value;
}
}
lightsildervalue = Lightbrightness.value;
@ -123,14 +123,14 @@ public class ClickKangYangdevice : MonoBehaviour
switch (KangYangMangner.Instance.kangYangregion)
{
case kangYangRegion.:
if (hit.collider.gameObject.name == "血压计")
{
StartCoroutine(Sphygmomanometer());
XueYaYiSMR.GetComponent<BoxCollider>().enabled = false;
}
float weigh = XueYaYiSMR.GetBlendShapeWeight(0);
if (weigh == 100)
@ -167,10 +167,10 @@ public class ClickKangYangdevice : MonoBehaviour
//Open.transform.GetComponentInChildren<TextMeshProUGUI>().text = "关";
for (int i = 0; i < LightsModel.Count; i++)
{
Material material = LightsModel[i].GetComponent<MeshRenderer>().materials[0];
Material material = LightsModel[i].parent.GetComponent<MeshRenderer>().materials[0];
material.EnableKeyword("_EMISSION");
//material.SetColor("_EmissionColor", Color.HSVToRGB(0, 0, 1));
LightsModel[i].GetChild(0).gameObject.SetActive(true);
LightsModel[i].gameObject.SetActive(true);
}
}
else
@ -178,10 +178,10 @@ public class ClickKangYangdevice : MonoBehaviour
//Open.transform.GetComponentInChildren<TextMeshProUGUI>().text = "开";
for (int i = 0; i < LightsModel.Count; i++)
{
Material material = LightsModel[i].GetComponent<MeshRenderer>().materials[0];
Material material = LightsModel[i].parent.GetComponent<MeshRenderer>().materials[0];
material.DisableKeyword("_EMISSION");
//material.SetColor("_EmissionColor", Color.HSVToRGB(5, 5, 1));
LightsModel[i].GetChild(0).gameObject.SetActive(false);
LightsModel[i].gameObject.SetActive(false);
}
}
}
@ -205,7 +205,7 @@ public class ClickKangYangdevice : MonoBehaviour
IEnumerator Sphygmomanometer()
{
yield return new WaitForSeconds(0.1f);
for (int i = 0; i <=100; i++)
for (int i = 0; i <= 100; i++)
{
yield return new WaitForSeconds(0.01f);
XueYaYiSMR.SetBlendShapeWeight(0, i);
@ -236,7 +236,7 @@ public class ClickKangYangdevice : MonoBehaviour
/// <param name="delay">等待几秒</param>
/// <param name="Btn">按钮</param>
/// <returns></returns>
IEnumerator ShowButtonAfterDelay(float delay,Button Btn)
IEnumerator ShowButtonAfterDelay(float delay, Button Btn)
{
yield return new WaitForSeconds(delay);
Btn.gameObject.SetActive(true);
@ -320,7 +320,7 @@ public class ClickKangYangdevice : MonoBehaviour
InitColor = new Color(1, 1, 1);
for (int i = 0; i < LightsModel.Count; i++)
{
LightsModel[i].GetChild(0).GetComponent<Light>().color = new Color(1, 1, 1);
LightsModel[i].GetComponent<Light>().color = new Color(1, 1, 1);
LightsModel[i].GetComponentInParent<MeshRenderer>().material.SetColor("_EmissionColor", new Color(1, 1, 1));
}
}
@ -332,7 +332,7 @@ public class ClickKangYangdevice : MonoBehaviour
InitColor = new Color(0, 0.6145419f, 0.9433962f);
for (int i = 0; i < LightsModel.Count; i++)
{
LightsModel[i].GetChild(0).GetComponent<Light>().color = new Color(0, 0.6145419f, 0.9433962f);
LightsModel[i].GetComponent<Light>().color = new Color(0, 0.6145419f, 0.9433962f);
LightsModel[i].GetComponentInParent<MeshRenderer>().material.SetColor("_EmissionColor", new Color(0, 0.6145419f, 0.9433962f));
}
}
@ -344,7 +344,7 @@ public class ClickKangYangdevice : MonoBehaviour
InitColor = new Color(1, 0.6831585f, 0);
for (int i = 0; i < LightsModel.Count; i++)
{
LightsModel[i].GetChild(0).GetComponent<Light>().color = new Color(1, 0.6831585f, 0);
LightsModel[i].GetComponent<Light>().color = new Color(1, 0.6831585f, 0);
LightsModel[i].GetComponentInParent<MeshRenderer>().material.SetColor("_EmissionColor", new Color(1, 0.6831585f, 0));
}
}