improve traffic light phase display
- hide when not in traffic light mode
- smaller scale
1 parent 2eeeb37 commit 2ca7a7fea534c8052b07c089327c2c0f2b22457b
@biosfood biosfood authored on 18 Oct 2022
Showing 2 changed files
View
3
■■
Assets/Scripts/Roads/Node/Node.cs
textObject.AddComponent<MeshRenderer>();
TextMesh text = textObject.AddComponent<TextMesh>();
text.text = "";
text.anchor = TextAnchor.MiddleCenter;
textObject.transform.localScale = Vector3.one * 0.25f;
textObject.transform.parent = gameObject.transform;
textObject.transform.localPosition = new Vector3(0f, 4f, 0f);
textObject.transform.localPosition = new Vector3(0f, 3f, 0f);
update();
return this;
}
 
View
10
Assets/Scripts/Roads/Node/NodeData.cs
node.circleObject.GetComponent<MeshRenderer>().material = config.carAccelerationMaterial;
} else {
node.circleObject.GetComponent<MeshRenderer>().material = config.carBrakingMaterial;
}
node.textObject.GetComponent<TextMesh>().text = string.Format("phase: {0}", customNode.lightPhase);
string text = "";
if (config.mode == Mode.TrafficLight) {
text = string.Format("phase: {0}", customNode.lightPhase);
}
node.textObject.GetComponent<TextMesh>().text = text;
Vector3 target = Camera.main.transform.position;
node.textObject.transform.LookAt(-target, Vector3.up);
}
}