Tuesday, 9 December 2014

Disappear

This script was the one I had the most problems with and spent a good while trying to work out how to add time to the timer when a pickup was activated. I was trying to add time by adding various scripts to the player and the timerScript, when I needed to add it to the object that was being picked up. I learnt a new line 'GameObject.FindObjectOfType' which will come in really useful in the future. I was unsure on how to reference and call other scripts within a script and this was what I had to do, I was trying to use things like GetComponent which were just not working and far more complicated than this. Also, by adding the public variable of 'Value', it made the script easier to edit in the future by being able to adjust the values in the unity inspector, rather than constantly adjusting the script.

What it does it make it so that anything it is attached to and made the trigger will add time to the timer by the amount specified in the value inspector. It is a key part of the gameplay as our game revolves around running around picking objects up to add more time on so you don't die and have to restart.

No comments:

Post a Comment