So being a big fan of scripting for games and making all of the mechanics and controls work to help the game come to life I've come up with the idea of sharing what knowledge I have by creating a library of scripts alongside my tutorials. From now on I intend to use whatever file sharing service I can to share some of my best and most useful scripts. All of these scripts will be written and used in the Unity game engine.
I'll post each of the links below along with the name of the script and a short description which explains what the script does.
If any of these links don't work please either tweet me or comment letting me know asap :)
- Enemy/Player Located Script:
This script can be used for NPCs, security cameras and anything that is used to detect something or someone. Setting up the script is simple you just place the script on the thing which will be doing the detecting and tag the object or player with a "Player" tag (this can be changed in the script itself).
https://dl.dropboxusercontent.com/u/59486345/PlayerSpotted.cs.zip
- Player Dies If They Stay In The Area Too Long
This one checks to see if the player has a tag of "Player" when they are within the trigger area and then kills/destroys them if they stay in the area for more than 5 seconds (this can be changed by changing the number in the brackets).
- Score System
I figured this would be one that people would be in need of a lot. This script adds a certain amount of "score" to the counter each time the player enters an object which has the tag "PickUp" on it (this tag can be changed in the script). You will also need to create a "Text" object using Unity's new UI system so that the script has somewhere to print the score.
https://drive.google.com/open?id=0ByTYhg5RcS2pS3pWY1dDa3lPYUE
No comments:
Post a Comment