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++;
                }
            }
        }
    }
示例#2
0
        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));
                }
            }
        }
示例#3
0
        public void Unlock(Relic relic)
        {
            relic.Owner = gameObject;
            Available.Add(relic);

            Unlocked?.Invoke(this, relic);
        }
示例#4
0
        public void Evaluate()
        {
            if (IsUnlocked || Quantity < RequiredQuantity)
            {
                return;
            }

            IsUnlocked = true;
            AnyAchievementUnlocked?.Invoke(this);
            Unlocked?.Invoke(this);

            Unsubscribe();
        }
示例#5
0
    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 = "";
                }
            }
        }
    }
示例#6
0
        /// <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);
            }
        }
示例#7
0
    /// <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
    }
示例#8
0
    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;
        }
    }
示例#9
0
 protected override void OnUnlocked(int param1, int param2, int param3, int param4, int param)
 {
     Unlocked?.Invoke();
 }
示例#10
0
        public void Unlock(SecureString password)
        {
            Wallet.Unlock(password);

            Unlocked?.Invoke(this, EventArgs.Empty);
        }
示例#11
0
 public void Unlock()
 {
     IsUnlocked = true;
     Unlocked?.Invoke(this);
 }
示例#12
0
 /// <summary>
 ///     Raises the <see cref="Unlocked" /> event.
 /// </summary>
 /// <seealso cref="EventArgs" />
 protected virtual void OnUnlocked()
 {
     Unlocked?.Invoke(this, EventArgs.Empty);
 }