using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterManager : MonoBehaviour
{
    private Animator characterAnimator;
    public GameObject ShoutEffect;
    public GameObject AntennaEffect;
    public Transform StartingPoint;
    public Transform DestinationPoint;

    private void Awake()
    {
        characterAnimator = GetComponent<Animator>();
    }

    public void PlayAnimation(AnimationType t)
    {
        if (t == AnimationType.Cast)
            characterAnimator.SetTrigger("Cast");
        else if (t == AnimationType.Shout)
        {
            characterAnimator.SetTrigger("Shout");
            ShoutEffect.SetActive(true);
        }
    }
	
    public IEnumerator MoveToNextLevel()
    {
        yield return new WaitForSeconds(1);
        while (Vector3.Distance(transform.position, DestinationPoint.position) > 0.1)
        {
            transform.position = Vector3.MoveTowards(transform.position, DestinationPoint.position, 2 * Time.deltaTime);
            yield return null;
        }
        GameManager.Singleton.ChangeScene();
    }
}

public enum AnimationType
{
    Shout,
    Cast,
}
