예제 #1
0
    void Start()
    {
        blurringEffect      = mainCam.GetComponent <BlurOptimized>();
        characterController = player.GetComponent <CharacterController>();
        movingCheck         = player.GetComponent <MoveCheck>();

        isMoving = movingCheck.Moving();

        threatLevel = 0;
        blurTime    = maxBlurTime;

        blurringEffect.downsample     = 0;
        blurringEffect.blurSize       = 0;
        blurringEffect.blurIterations = 1;
        blurringEffect.enabled        = false;

        mouse          = mainCam.GetComponent <MouseLook>();
        mouse.enabled  = true;
        isParalyzed    = false;
        paralyzingTime = maxParalysingTime;

        maxInvincibilityTime = invincibilityTime;
    }
예제 #2
0
    void FixedUpdate()
    {
        if (Vector3.Distance(enemy.transform.position, transform.position) > 0)
        {
            threatLevel = (int)(1 / Vector3.Distance(enemy.transform.position, transform.position) * 10);
        }
        else
        {
            threatLevel = 0;
        }
        threatLevel--;

        anxText.text = anxLabel + Mathf.Ceil(anxietyGauge).ToString();

        isMoving = movingCheck.Moving();

        AnxietyUp();

        if (anxietyGauge < 0)
        {
            anxietyGauge = 0;
        }

        if (isInvicible)
        {
            invincibilityTime -= Time.deltaTime;
            if (invincibilityTime <= 0)
            {
                isInvicible       = false;
                invincibilityTime = maxInvincibilityTime;
            }
            else if (threatLevel <= 0)
            {
                isInvicible       = false;
                invincibilityTime = maxInvincibilityTime;
            }
        }

        if (threatLevel > 0)
        {
            Blurring();
        }

        if (anxietyGauge >= (anxietyMax / 2) + 10)
        {
            if (isMoving)
            {
                Blurring();
            }
            else if (!isMoving && threatLevel <= 0)
            {
                Unblurring();
            }

            if (anxietyGauge >= anxietyMax)
            {
                anxietyGauge = anxietyMax;
                isParalyzed  = true;
                Paralyzing();
                isParalyzed = false;
                isInvicible = true;
            }
            else if (!isParalyzed && !isMoving)
            {
                AnxietyDown();
            }
        }


        else if (!isMoving && threatLevel <= 0)
        {
            Unblurring();
            AnxietyDown();
        }
    }