Quantcast
Channel: Answers by "ransomink"
Viewing all articles
Browse latest Browse all 80

Answer by ransomink

$
0
0
I went ahead and recreated the script for turning the flashlight on/off. I simplified draining the battery and charging the battery by placing them inside of functions. It is much easier than having long *if* statements inside of *Update()*. I moved the flicker code within a function as well, so if you ever need to access these again, you can simply call the function name. Everything important is commented (well, I hope) and the *Debug.Log()* are there for testing purposes; you can delete or comment those out. In the start function—at the bottom of the script—I gave you two options for referencing the flashlight. The comments explain their use but both of them are being executed, so choose which one you wish to use and comment out the other. I've tested it myself and it works wonders. Please let me know if any problems persist. I hope this helps! Character limit exceeded, so I'll post a pastebin file: [Flashlight][1] [1]: http://pastebin.com/raph1LvC

Viewing all articles
Browse latest Browse all 80

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>