Files
Slendytubbies-V2-Beta/V2Beta/Assets/Scripts/Assembly-UnityScript/flashlight.cs
T
2026-05-24 12:14:04 +02:00

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>();
}
}