Example #1
0
    public override void Update()
    {
        if (target != null && !charging && Vector3.Distance(transform.position, target.position) < attackDistance)
        {
            StartCoroutine(Attack());
        }

        sprite.SetActive(visible || visibleOverride);

        if (visible)
        {
            postProcessingAnimator.RegisterEnemyWithinPlayer(this);
        }
        else
        {
            postProcessingAnimator.RegitsterEnemyOutsidePlayer(this);
        }

        DisableMovement = charging;
        if (!isPlayingEnmMov && visible)
        {
            SoundSystem.Play("enemy movement", 1, 0.25f);
            isPlayingEnmMov = true;
        }
        else if (!visible)
        {
            SoundSystem.Stop("enemy movement");
            isPlayingEnmMov = false;
        }
    }