@@ -39,9 +39,6 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
public PortSelector PortSelector;
|
public PortSelector PortSelector;
|
||||||
public int Index = -1;
|
public int Index = -1;
|
||||||
|
|
||||||
const int FinalColorTick = 60; //shouldnt take too long
|
|
||||||
Color _oldColor = Color.black;
|
|
||||||
int colorTick = FinalColorTick;
|
|
||||||
Color _color = Color.black;
|
Color _color = Color.black;
|
||||||
Color Color
|
Color Color
|
||||||
{
|
{
|
||||||
@@ -49,8 +46,10 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
var clonedMaterial = new Material(meshRenderer.material); //clone da sonst alle anderen mit dem mat auch colorchanged werden
|
var clonedMaterial = new Material(meshRenderer.material); //clone da sonst alle anderen mit dem mat auch colorchanged werden
|
||||||
meshRenderer.material = clonedMaterial; // Actual color setting happens in Update
|
clonedMaterial.color = value;
|
||||||
|
meshRenderer.material = clonedMaterial;
|
||||||
Debug.Log($"{name}: Set color from {_color} to {value}");
|
Debug.Log($"{name}: Set color from {_color} to {value}");
|
||||||
|
_color = value;
|
||||||
if (Model.Passthrough)
|
if (Model.Passthrough)
|
||||||
{
|
{
|
||||||
Debug.Log($"{name}: Passthrough {_children.Count}");
|
Debug.Log($"{name}: Passthrough {_children.Count}");
|
||||||
@@ -60,9 +59,6 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
go.GetComponent<ChildModelBehaviour>().Color = value;
|
go.GetComponent<ChildModelBehaviour>().Color = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_oldColor = _color;
|
|
||||||
_color = value;
|
|
||||||
colorTick = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,15 +73,6 @@ public class ModelBehaviour : MonoBehaviour, IResettable
|
|||||||
ModelManager = FindFirstObjectByType<ModelManager>();
|
ModelManager = FindFirstObjectByType<ModelManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if (colorTick < FinalColorTick)
|
|
||||||
{
|
|
||||||
meshRenderer.material.color = Color.Lerp(_oldColor, _color, colorTick * 1.0f / FinalColorTick);
|
|
||||||
colorTick++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LateUpdate()
|
void LateUpdate()
|
||||||
{
|
{
|
||||||
if (!lateInited)
|
if (!lateInited)
|
||||||
|
|||||||
Reference in New Issue
Block a user