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

public class ValkyrieControl : MonoBehaviour {

    Animator anim;
    FreqOriginScript freq_source;

	// Use this for initialization
	void Awake () {
        freq_source = GameObject.FindGameObjectWithTag("Freq").GetComponent<FreqOriginScript>();
        anim = GetComponent<Animator>();
	}
	
	// Update is called once per frame
	void Update () {
        if (freq_source.control == FreqOriginScript.MOUSECONTROL ||
            freq_source.control == FreqOriginScript.SINGCONTROL) {
            float pit = freq_source.Freq();
            float amp = freq_source.Amplitude();
            if (pit > 2300) pit = 2300;
            if (pit < 10) pit = 10;
            float a = pit / 2300 * amp;
            float y = a; //Input.mousePosition.y / Screen.height;
            anim.SetFloat("Blend", y);
        }
        else {
            anim.SetFloat("Blend", 1);
        }
	}
}
