/// <summary> /// Constructor for the userAccount class /// </summary> /// <param name="username">The username</param> /// <param name="password">The password</param> /// <param name="cprNumber">The CPR-number</param> public UserAccount(string username, string password, string cprNumber) { this.username = username; this.password = password; this.cprNumber = cprNumber; this.keycard = new KeyCard(); }
private void OnTriggerEnter(Collider other) { if (isDone) { return; } if (DriverCabinDoorLock.bIsUnlocked) { return; } if (successAudio.IsPlaying()) { return; } if (FailedAudio.IsPlaying()) { return; } KeyCard card = other.GetComponent <KeyCard>(); if (card) { if (card.IsSuccess()) { ScanSuccess(card); } else { ScanFailed(card); } } }
/// <summary> /// Constructor for the userAccount class /// </summary> /// <param name="username">The username</param> /// <param name="password">The password</param> /// <param name="cprNumber">The CPR-number</param> /// <param name="email">The email address</param> public UserAccount(string username, string password, string cprNumber, string email) { this.username = username; this.password = password; this.cprNumber = cprNumber; this.email = email; this.keycard = new KeyCard(username, password, cprNumber, email, 1); }
void Start() { _controller = GetComponent <CharacterController>(); _playerAnim = GetComponent <Animator>(); _gameManager = GameObject.Find("Game_Manager").GetComponent <GameManager>(); _uiManager = GameObject.Find("Canvas").GetComponent <UIManager>(); _jumpSound = GetComponent <AudioSource>(); _keyCard = GameObject.Find("KeyCard").GetComponent <KeyCard>(); playerRestart = false; }
private void ScanFailed(KeyCard card) { if (FailedAudio) { FailedAudio.Play(); } if (card.playerController != null) { card.playerController.Vibration(0, 0.3f, 1, 1, card.playerHand); } }
private void OnTriggerEnter(Collider other) { KeyCard keyCard = other.GetComponent <KeyCard>(); if (keyCard != null) { if (keyCard.GetKeyCardType() == GetKeyCardType()) { _doorIsOpened = true; } } }
private void OnCollisionEnter(Collision other) { if (other.gameObject.tag == "KeyCard") { KeyCard keyCard = other.gameObject.GetComponent <KeyCard>(); if (keyCard.Id == CardSlotId) { Grab pickable = other.gameObject.GetComponent <Grab>(); pickable.OnRelease(); pickable.Picked = false; pickable.Rigid.isKinematic = true; //IsPickable = false; other.gameObject.transform.SetParent(gameObject.transform); other.transform.position = gameObject.gameObject.transform.position + cardOffset; other.transform.rotation = gameObject.gameObject.transform.rotation; KeyCardManager keyCardManager = other.gameObject.GetComponentInParent <KeyCardManager>(); keyCardManager.UpdateCredentials(keyCard.Id); } } }
/// <summary> /// OnTriggerEnter is called when the Collider other enters the trigger. /// </summary> /// <param name="other">The other Collider involved in this collision.</param> void OnTriggerEnter(Collider other) { if (myReceptacleType == ReceptacleType.CardReader && other.gameObject.tag == "KeyCard") { other.gameObject.GetComponent <KeyCard>().Detach(); other.gameObject.GetComponent <KeyCard>().MakeNoLongerNeeded(); // transform to put in slot properly other.transform.parent = transform; other.transform.localPosition = new Vector3(0.0521f, 0.1512f, 0f); other.transform.localRotation = Quaternion.Euler(0f, 0f, 97.16f); other.transform.localScale = new Vector3(0.104f, 0.006f, 0.0887f); KeyCard keyCard = other.gameObject.GetComponent <KeyCard>(); StateManager.instance.ActivateRoom(); int keyCardNumber = keyCard.cardIndex; Debug.Log("<color=green>Collision:</color> Received Key Card " + keyCardNumber); } else if (myReceptacleType == ReceptacleType.CoffeeMachine && other.gameObject.tag == "Item") { Item receivedItem = other.gameObject.GetComponent <Item>(); if (receivedItem.itemType == Item.ItemType.DummyItem) { // reset the current state other.transform.parent = transform; Destroy(other.gameObject); } else if (receivedItem.itemType == Item.ItemType.KeyItem) { // move onto the next state other.transform.parent = transform; Destroy(other.gameObject); StateManager.instance.ActivateNextCard(); } } }
private void ScanSuccess(KeyCard card) { if (isDone) { return; } if (successAudio) { successAudio.Play(); } if (card != null && card.playerController != null) { card.playerController.Vibration(0, 0.7f, 10, 1, card.playerHand); } transform.parent.GetComponent <Renderer>().materials[0].SetColor("_Color", Color.green); transform.parent.GetComponent <Renderer>().materials[0].SetVector("_EmissionColor", Color.green * 100f); DriverCabinDoorLock.init(); isDone = true; }