// Start is called before the first frame update void Start() { // Set up initial materials foreach (GameObject segment in Segments) { SevenSegmentHelper.InitializeSegment(segment, SegmentOnMaterial, SegmentOffMaterial); } }
private void UpdateSegmentDisplay(int time) { List <int> digits = MathHelper.GetDigitsForNumber(time, Segments.Count); for (int i = 0; i < Segments.Count; i++) { SevenSegmentHelper.UpdateSegment(Segments[i], digits[i], SegmentOnMaterial, SegmentOffMaterial); } }
private void UpdateSegmentDisplay(int seconds) { TimeSpan time = TimeSpan.FromSeconds(seconds); int onesSeconds = time.Seconds % 10; int tensSeconds = Mathf.FloorToInt(time.Seconds / 10); int onesMinutes = time.Minutes % 10; int tensMinutes = Mathf.FloorToInt(time.Minutes / 10); SevenSegmentHelper.UpdateSegment(Segments[0], tensMinutes, SegmentOnMaterial, SegmentOffMaterial); SevenSegmentHelper.UpdateSegment(Segments[1], onesMinutes, SegmentOnMaterial, SegmentOffMaterial); SevenSegmentHelper.UpdateSegment(Segments[2], tensSeconds, SegmentOnMaterial, SegmentOffMaterial); SevenSegmentHelper.UpdateSegment(Segments[3], onesSeconds, SegmentOnMaterial, SegmentOffMaterial); }
// Start is called before the first frame update void Start() { // Set up initial materials foreach (GameObject segment in Segments) { SevenSegmentHelper.InitializeSegment(segment, SegmentOnMaterial, SegmentOnMaterial); } // Set up events to the VR interactive button var buttonScript = gameObject.GetComponent <BaseButton>(); buttonScript.OnActivatedEvent += ButtonScript_OnActivatedEvent; buttonScript.OnDectivatedEvent += ButtonScript_OnDectivatedEvent; buttonScript.OnInteractEvent += ButtonScript_OnInteractEvent; buttonScript.OnUnInteractEvent += ButtonScript_OnUnInteractEvent; active = buttonScript.m_active; // Update display so it starts at 00:00 UpdateSegmentDisplay(0); }