Exemple #1
0
    /// <summary>
    /// Initiates the startup for the quick time event and activates the affected object.
    /// </summary>
    /// <param name="player"></param>
    public override void Interact(GameObject player)
    {
        if (interacting == false)
        {
            foreach (Interactable otherSwitch in connectedSwitches)
            {
                if (otherSwitch.interacting == false)
                {
                    otherSwitch.StopInteraction();
                }
            }

            interacting       = true;
            interactingPlayer = player.GetComponent <PlayerQTE>();
            interactingPlayer.GetComponent <NewPlayerScript>().SwapLiftingState();
            interactingPlayer.SwapToQTE(this, gameObject);

            StartCoroutine(AnimationDelay());
        }
    }
Exemple #2
0
    /// <summary>
    /// Stops the QTE and resets values.
    /// </summary>
    private void StopQTE()
    {
        if (abortQTE == true && interactingPlayer != null)
        {
            takeInput = false;
            rendererHolder.SetActive(false);
            interactingPlayer.GetComponent <NewPlayerScript>().SwapLiftingState();
            interactingPlayer.GetComponent <NewPlayerScript>().StartAnimation("FailQTE");
            interactingPlayer.SwapToMovement();
            QTETimer          = originalQTETimer;
            playerAnswer      = 0;
            abortQTE          = false;
            correctAnswer     = 0;
            interactingPlayer = null;
            renderQTE.sprite  = null;
            playerHasAnswered = false;
            StartCoroutine(InteractionCooldown());
            leverRotation = StartCoroutine(RotateLever());
            foreach (AffectedObject affectedObject in affected)
            {
                affectedObject.ExecuteAction();
            }
            foreach (Interactable otherSwitch in connectedSwitches)
            {
                if (otherSwitch.interacting == true)
                {
                    otherSwitch.EnableInteraction();
                }
            }

            if (clockHand != null)
            {
                clockHand.SetActive(false);
            }
        }
    }