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
Share
Go down
avatar
Member [Lv. 3]
Member [Lv. 3]
Posts : 38
Points : 1699
Rep : -2
Join date : 2014-02-15
View user profile

Simple Flashlight script

on Tue Feb 18, 2014 5:13 pm
Message reputation : 50% (4 votes)
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);
}   
avatar
Admin
Admin
Posts : 608
Points : 3197
Rep : 406
Join date : 2013-12-11
Age : 21
View user profilehttps://www.youtube.com/user/misterninjaboy

Re: Simple Flashlight script

on Tue Feb 18, 2014 9:19 pm
Thanks for sharing Very Happy 
Member [Lv. 0]
Member [Lv. 0]
Posts : 1
Points : 1568
Rep : 0
Join date : 2014-05-04
View user profile

Re: Simple Flashlight script

on Sun Jul 27, 2014 1:43 am
Thanks, needed this
avatar
Moderator
Moderator
Posts : 76
Points : 1954
Rep : 16
Join date : 2014-06-02
Age : 15
Location : Milky Way
View user profile

Re: Simple Flashlight script

on Thu Aug 14, 2014 3:58 pm
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 
avatar
{SUPER MEMBER}-LV.4
{SUPER MEMBER}-LV.4
Posts : 64
Points : 1885
Rep : 3
Join date : 2013-12-21
Age : 15
Location : USA
View user profilehttp://oneknifegames.weebly.com/

Re: Simple Flashlight script

on Wed Oct 22, 2014 8:53 pm
Hey, is this for javascript? It looks like it, but just to be certain.
Back to top
Permissions in this forum:
You cannot reply to topics in this forum