高亮时屏蔽贴图
This commit is contained in:
parent
01b66de62f
commit
0927ff6379
@ -14,6 +14,7 @@ public class ObjectColorToggle : MonoBehaviour
|
||||
public Color isOffColor = new Color(255 / 255f, 255 / 255f, 255 / 255f);
|
||||
public Color isHoverColor = new Color(185f / 255f, 255 / 255f, 215 / 255f);
|
||||
MeshRenderer mesh;
|
||||
private Texture2D savedTexture;
|
||||
private void Awake()
|
||||
{
|
||||
mesh = gameObject.GetComponent<MeshRenderer>();
|
||||
@ -26,14 +27,19 @@ public class ObjectColorToggle : MonoBehaviour
|
||||
{
|
||||
case State.On:
|
||||
isOnColor.a = alpha;
|
||||
savedTexture = mesh.material.mainTexture as Texture2D;
|
||||
mesh.material.mainTexture = null;
|
||||
mesh.material.color = isOnColor;
|
||||
break;
|
||||
case State.Off:
|
||||
isOffColor.a = alpha;
|
||||
mesh.material.mainTexture = savedTexture;
|
||||
mesh.material.color = isOffColor;
|
||||
break;
|
||||
case State.Hover:
|
||||
isHoverColor.a = alpha;
|
||||
savedTexture = mesh.material.mainTexture as Texture2D;
|
||||
mesh.material.mainTexture = null;
|
||||
mesh.material.color = isHoverColor;
|
||||
break;
|
||||
default:
|
||||
@ -56,5 +62,4 @@ public class ObjectColorToggle : MonoBehaviour
|
||||
SetColor(State.Off);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user