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

public class SimpleCharacter : MonoBehaviour
{
    public enum HeadDirection { Up, Right, Down, Left}
    [Header("Head Renderers")]
    [SerializeField] private SpriteRenderer
        headUp;
    [SerializeField] private SpriteRenderer 
        headDown,
        headLeft,
        headRight;

    [Header("Initial Animation Settings")]
    [SerializeField] private HeadDirection headDirection;
    [SerializeField] private float 
        speedX,
        speedY,
        velocity;

    [Header("Setup")]
    [SerializeField] private Animator animator;

	// Use this for initialization
	void Start ()
    {
        animator.SetFloat("SpeedX", speedX);
        animator.SetFloat("SpeedY", speedY);
        animator.SetFloat("Velocity", velocity);
        animator.SetInteger("Direction", (int)headDirection);
	}
	
    public void SetHeadSprites(CharacterRandomizer.Character character)
    {
        headUp.sprite = character.HeadUp;
        headDown.sprite = character.HeadDown;
        headLeft.sprite = character.HeadLeft;
        headRight.sprite = character.HeadRight;
    }

    public void SetSpeed(Vector2 speed, float velocity)
    {
        animator.SetFloat("SpeedX", speed.x);
        animator.SetFloat("SpeedY", speed.y);
        animator.SetFloat("Velocity", velocity);
    }

    public void SetDirection(HeadDirection direction)
    {
        animator.SetInteger("Direction", (int)direction);
    }



}
