Flashlight

MasterGamer

New member
How do you use the battery? There is very little documentation on the flashlight. I wanted the light to turn off when the battery runs out. Additional question, how would you add battery and bullets by script? Trying to make battery items and bullet packs that you need to click to pick up. Finally is there an animation where the flashlight turns off and replaces the battery? I wanted the player to pick up batteries and have to turn off the flashlight in order to replace batteries. This is because I have monsters that flee from light and will attack the player when the light turns off.
 
The flashlight object uses the Flashlight component (a simple example of a custom Item script) and the Attribute Manager component (to manage the Battery attribute). The Flashlight component already does turn the flashlight off when the battery runs out, you can test this in the demo scene.

For adding item pickups, here are a couple of links to help get you started:


Battery pickups would be slightly different though, since they would increase the Battery attribute rather than adding an actual item to your character's inventory. So instead you'd use an object pickup, similar to the health packs in the demo scene. Here's a page describing object pickups:


There's no animation included in the demo that matches what you described unfortunately.
 
Top