45 lines
718 B
C#
45 lines
718 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class flashlight : MonoBehaviour
|
|
{
|
|
public GameObject flashLight;
|
|
|
|
public AudioClip switchsound;
|
|
|
|
public bool Paused;
|
|
|
|
public Light myLight;
|
|
|
|
|
|
public virtual void Update()
|
|
{
|
|
if (Input.GetKeyDown("f"))
|
|
{
|
|
myLight.enabled = !myLight.enabled;
|
|
GetComponent<AudioSource>().PlayOneShot(switchsound);
|
|
}
|
|
if (Input.GetMouseButtonDown(1))
|
|
{
|
|
myLight.enabled = !myLight.enabled;
|
|
GetComponent<AudioSource>().PlayOneShot(switchsound);
|
|
}
|
|
if (Input.GetKeyDown("h"))
|
|
{
|
|
Cursor.visible = false;
|
|
}
|
|
if (Input.GetKeyDown("g"))
|
|
{
|
|
Cursor.visible = false;
|
|
}
|
|
}
|
|
|
|
public void Start()
|
|
{
|
|
|
|
myLight = flashLight.GetComponent<Light>();
|
|
}
|
|
|
|
}
|