Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        isShooting = false;

        // Sau khi Follow player, nghi mot thoi gian roi moi ban dan
        if (!enemyAI.CanShoot() || enemy.IsDamaged())
        {
            timeBtwShots = startTimeShotsAfterEvent;
        }

        // Sau mot khoan startTimeBtwShots thi ban dan
        if (timeBtwShots <= 0 && enemyAI.IsFollow())
        {
            isShooting = true;
            StartCoroutine(SpawnBullet());
            timeBtwShots = startTimeBtwShots;
        }
        else
        {
            timeBtwShots -= Time.deltaTime;
        }
    }