Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » FREE Project Downloads & Recources » Scripts » Simple Flashlight script

Simple Flashlight script

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Simple Flashlight script on Tue Feb 18, 2014 5:13 pm

NXTGenerationsTv


Member [Lv. 3]
Member [Lv. 3]
to get this script to work just add a flashlight to the player and attach this script to it .... i know really simple but it works fine
Code:
var FlashSound : AudioClip;
var linkedLight : Light;

function Update () {
    if(Input.GetKeyDown("f")){
        linkedLight.enabled = !linkedLight.enabled;
        audio.PlayOneShot(FlashSound, 1.0 / audio.volume);
   }
}

function LightOff (){
   linkedLight.enabled = false;
   audio.PlayOneShot(FlashSound, 1.0 / audio.volume);
}   

View user profile

2 Re: Simple Flashlight script on Tue Feb 18, 2014 9:19 pm

Thanks for sharing Very Happy 

View user profile http://www.youtube.com/user/misterninjaboy

3 Re: Simple Flashlight script on Sun Jul 27, 2014 1:43 am

javance


Member [Lv. 0]
Member [Lv. 0]
Thanks, needed this

View user profile

4 Re: Simple Flashlight script on Thu Aug 14, 2014 3:58 pm

DeveloperLuke


Moderator
Moderator
I am posting an ADVANCED flashlight script in about 30 minutes  Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy Very Happy 

View user profile

5 Re: Simple Flashlight script on Wed Oct 22, 2014 8:53 pm

OneKnifeGames


{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
Hey, is this for javascript? It looks like it, but just to be certain.

View user profile http://oneknifegames.weebly.com/

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum