using System.Collections;
using System.Collections.Generic;
using Tobii.EyeTracking;
using UnityEngine;
[RequireComponent(typeof(GazeAware))]
public class SoundEnemy: BaseEnemy {
    private GazeAware _gazeAware;

    [SerializeField]
    float speed = 10f;

    void Awake() {
        base.Start();
        _gazeAware = GetComponent<GazeAware>();
    }

    public override void Start() {
        Type = AbilityType.Sound;
    }

    public override void Update() {
        transform.position = new Vector3(transform.position.x - (1.0f / speed) * Time.deltaTime, transform.position.y, transform.position.z);

        if(_gazeAware.HasGazeFocus && Input.GetKeyDown(KeyCode.KeypadEnter)) {
            Shatter();
        }
    }

    void Shatter() {
        MusicManager.Instance.PlayOneShot(MusicManager.Instance.MapAudio(Sounds.LargeShatter));
        Destroy(gameObject);
    }

}
