/// /// \brief Called every frame /// /// \return No return value /// /// \details Updates the Displayed text. /// public void update() { int np = PowerSystem.getRoom(name); tb.text = string.Format("{0}\n{1}/{2}", displayName, np, minPower); tb.color = np < minPower ? Color.red : powered; }
/// /// \brief Used for initialization /// /// \return No return value /// /// \details Gets and sets the color form the powerUI object. Gets the text component. Gets the minimum power. Sets the initial display text. /// void Start() { powered = GetComponentInParent <powerUI>().powered; tb = GetComponent <Text>(); int np = PowerSystem.getRoom(name); minPower = PowerSystem.getMin(name); tb.text = string.Format("{0}\n{1}/{2}", displayName, np, minPower); tb.color = np < minPower ? Color.red : powered; }