Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        enemyAnimator.EnemyIsPossing();
        var relativePos = player.position - transform.position;
        var rotation    = Quaternion.LookRotation(relativePos);

        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * rotate_speed);

        if (notShooted)
        {
            if (timeBtwShots <= 0)
            {
                enemyAnimator.EnemyIsAttacking();
                // audioSource.PlayOneShot(shootSE);
                enemySound.EnemyShooted();
                Shot();
                timeBtwShots = startTimeBtwShots;
            }
            else
            {
                timeBtwShots -= Time.deltaTime;
            }
        }
    }