31 lines
506 B
C#
31 lines
506 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class nightvision : MonoBehaviour
|
|
{
|
|
public GameObject flashlight;
|
|
|
|
public AudioClip switchsound;
|
|
|
|
public Light myLight;
|
|
|
|
public nightvision()
|
|
{
|
|
myLight = (Light)flashlight.GetComponent("Light");
|
|
}
|
|
|
|
public virtual void Update()
|
|
{
|
|
if (GetComponent<NetworkView>().isMine && Input.GetKeyDown("n"))
|
|
{
|
|
myLight.enabled = !myLight.enabled;
|
|
GetComponent<AudioSource>().PlayOneShot(switchsound);
|
|
}
|
|
}
|
|
|
|
public virtual void Main()
|
|
{
|
|
}
|
|
}
|