| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | using UnityEngine.Events; |
| | | 5 | | |
| | | 6 | | public class KeyPadControll : MonoBehaviour |
| | | 7 | | { |
| | | 8 | | public int correctCombination; |
| | 4 | 9 | | public bool accessGranted = false; |
| | | 10 | | |
| | | 11 | | //public GameObject key; |
| | | 12 | | |
| | | 13 | | public UnityEvent onCorrectCode; |
| | | 14 | | |
| | | 15 | | |
| | | 16 | | // Start is called before the first frame update |
| | | 17 | | private void Start() |
| | 2 | 18 | | { |
| | | 19 | | //key.SetActive(false); |
| | 2 | 20 | | } |
| | | 21 | | |
| | | 22 | | // Update is called once per frame |
| | | 23 | | void Update() |
| | 2594 | 24 | | { |
| | 2594 | 25 | | if(accessGranted == true) |
| | 0 | 26 | | { |
| | 0 | 27 | | onCorrectCode.Invoke(); |
| | 0 | 28 | | accessGranted = false; |
| | 0 | 29 | | } |
| | 2594 | 30 | | } |
| | | 31 | | |
| | | 32 | | public bool CheckIfCorrect(int combination) |
| | 0 | 33 | | { |
| | 0 | 34 | | if(combination == correctCombination) |
| | 0 | 35 | | { |
| | 0 | 36 | | accessGranted = true; |
| | 0 | 37 | | return true; |
| | | 38 | | } |
| | 0 | 39 | | return false; |
| | 0 | 40 | | } |
| | | 41 | | } |