Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Mirror;
- public class Door : NetworkBehaviour
- {
- public DoorPermissions permissions;
- public Animator doorAnimator;
- private bool open = false;
- private bool debounce = false;
- public void RequestDoorOpen(PDATool PDA) {
- if (isServer) {
- bool allowOpen = permissions.validateOpen(PDA.access);
- if (allowOpen && !debounce) {
- open = !open;
- Debug.Log("Status: " + open);
- doorAnimator.SetBool("IsOpen", open);
- debounce = true;
- StartCoroutine("killDebounce");
- }
- }
- }
- IEnumerator killDebounce() {
- yield return new WaitForSeconds(1f);
- debounce = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement