void CheckHitObject() { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit[] hits; hits = Physics.RaycastAll(ray, 10f); foreach (RaycastHit hit in hits) { if (hit.transform == spheres[step].transform) { if (step >= 4) { SetEmission(false); Unlocked?.Invoke(); Exit(); } else { lightSphere(step, false); lightSphere(step + 1, true); step++; } } } }
public virtual void SetLocked(bool lockState) { if (IsLocked == lockState) { return; } IsLocked = lockState; InternalSetLocked(lockState); if (IsLocked) { if (Locked != null) { Locked.Invoke(this, new LockStateChangedEventArgs(IsLocked)); } } else { if (Unlocked != null) { Unlocked.Invoke(this, new LockStateChangedEventArgs(IsLocked)); } } }
public void Unlock(Relic relic) { relic.Owner = gameObject; Available.Add(relic); Unlocked?.Invoke(this, relic); }
public void Evaluate() { if (IsUnlocked || Quantity < RequiredQuantity) { return; } IsUnlocked = true; AnyAchievementUnlocked?.Invoke(this); Unlocked?.Invoke(this); Unsubscribe(); }
void CheckHitObject() { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit[] hits; hits = Physics.RaycastAll(ray, 10f); foreach (RaycastHit hit in hits) { if (hit.transform.CompareTag("KeypadButton")) { if (keypressSound != null) { keypadSound.clip = keypressSound; keypadSound.Play(); } enteredCode += hit.transform.name; if (enteredCode.Length >= codeLength) { if (code.Equals(enteredCode)) { Unlocked?.Invoke(); Exit(); Debug.Log("Correct"); if (keypressSound != null) { keypadSound.clip = correctSound; keypadSound.Play(); } } else { Debug.Log("Incorrect"); if (keypressSound != null) { keypadSound.clip = incorrectSound; keypadSound.Play(); } } enteredCode = ""; } } } }
/// <summary> /// Lowers the time scale lock by one, time scale value is applied when gets unlocked /// </summary> public void Unlock() { lock (this) { if (Locks == 0) { Log.Warning("Trying to unlock already unlocked semaphore."); return; } if (--Locks == 0) { Unlocked?.Invoke(); } LocksCountChanged?.Invoke(Locks); } }
/// <summary> /// called when the player gets the number right. Subscribe to the event on your seperate script (for hub) /// </summary> private void FinishWithLock() { /// <summary> /// do something special, depending on which lock it is /// calls player state if all the numbers are inputed. this disables the script so users are not able to move the lock after completing all the numbers /// </summary> Brackets.SetActive(true); switch (thisLock) { case LockType.NormaPuzzle: currentState = PlayerStates.Roaming; if (Unlocked != null) { Unlocked.Invoke(); } break; case LockType.HubLock: currentState = PlayerStates.Roaming; if (Unlocked != null) { Unlocked.Invoke(); } break; default: break; } //Should disable the lock now after completing it enabled = false; LockisActive = false; StartCoroutine(UnlockedCoroutine()); //Gets out of the lock sequence }
private void ButtonPressed(string key) { if (!locked) { return; } if (keyCode.Substring(currentSequence.Length, 1) == key) { currentSequence += key; if (currentSequence == keyCode) { Unlocked?.Invoke(); locked = false; baseMeshRenderer.material.EnableKeyword("_EMISSION"); } } else { currentSequence = key; } }
protected override void OnUnlocked(int param1, int param2, int param3, int param4, int param) { Unlocked?.Invoke(); }
public void Unlock(SecureString password) { Wallet.Unlock(password); Unlocked?.Invoke(this, EventArgs.Empty); }
public void Unlock() { IsUnlocked = true; Unlocked?.Invoke(this); }
/// <summary> /// Raises the <see cref="Unlocked" /> event. /// </summary> /// <seealso cref="EventArgs" /> protected virtual void OnUnlocked() { Unlocked?.Invoke(this, EventArgs.Empty); }