Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (ExclamationFadeCount > 0)
        {
            ExclamationFadeCount -= Time.deltaTime;
        }
        if (ExclamationFadeCount <= 0f)
        {
            exclamationMark.Disable();
        }

        if (GameManager.IsGameOver())
        {
            return;
        }
        if (suspicionLevel > TriggeredThreshold && !IsTriggered)
        {
            IsTriggered = true;
            exclamationMark.Enable();
            ExclamationFadeCount = 0.9f;
            GameManager.SetNPCDetection(true);
        }



        UpdateAlertLevel();
        switch (alertLevel)
        {
        case AlertLevel.LowAlert:
            LowAlertUpdate();
            break;

        case AlertLevel.MediumAlert:
            MediumAlertUpdate();
            break;

        case AlertLevel.HighAlert:
            HighAlertUpdate();
            break;
        }

        // update vision cone
        cone.SetSuspicionLevel(suspicionLevel);
        // make suspicion level go down
        if (PlayerInFOV)
        {
            suspicionLevel += SuspicionIncreasePerTick * Time.deltaTime;
        }
        else if (suspicionLevel > 0f)
        {
            suspicionLevel -= SuspicionDecreasePerTick * Time.deltaTime;
            if (suspicionLevel < 0f)
            {
                suspicionLevel = 0f;
            }
        }
    }