Unity Project 1: ButtonCheckScore - Task 1 Part 1
We created a way for a gamer to type in their score from a game. The text and colour of the background panel changes depending on their score.
Default colour of game before any input |
When the score is less than the value set for the variable 'silver' then the panel's text changes to 'bronze' and the colour of the panel is set to changes to a browny-bronze colour.
Bronze display |
When the score is less than the value set for the variable 'gold' or equal to the value set in the variable 'silver' then the panel's text changes to 'silver' and the colour of the panel is set to change to a silver colour.
When the score is more than or equal to the value set for the variable 'gold' then the panel's text changes to 'gold' and the colour of the panel is set to change to a gold colour.
Silver display |
When the score is more than or equal to the value set for the variable 'gold' then the panel's text changes to 'gold' and the colour of the panel is set to change to a gold colour.
Gold display |
The inspector allows us to change the colours of the panel and set the variable that the code has declared to the correct object. Input Field is assigned to the instance name of the text box/field while Medal Image is assigned to the back panel and Medal Text is assigned to the text that is defaulted to the word 'colour' (This will be replaced with the award name that the player has earned from the achieving that score).
In the code, the variable m_colours allows the player to set the colour wanted in this part of unity.
m_colours[0] refers to bronze, m_colours[1] refers to silver while m_colours[2] refers to gold.
Comments