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

public class Example : MonoBehaviourEx
{
    public float testFloat = 0f;
    public Vector3 testVector = Vector3.zero;
    void Start()
    {

        DelayAction("TEST_1", 1f, () => Debug.Log("TEST_1"));

        DelayAction("TEST_2", 2f, () => 
        {

            Debug.Log("TEST_2");

            AnimateFloat("TEST_3", 0f, 100f, 3f,null,
            (value) => {
                UpdateFloat(value);
            });

            AnimateVector3("TEST_4", Vector3.zero, Vector3.one*100f, 3f,null,
            (value) => {
                testVector = value;
            }).End( () => {
                DestroyImmediate(gameObject);
            });

        });

        StartCoroutineEx(ExCall("TEST_5"));
    }

    void UpdateFloat(float _float)
    {
        testFloat = _float;
    }

    IEnumerator ExCall(string _msg)
    {
        yield return new WaitForSeconds(7f);
        Debug.Log(_msg);
    }

    void OnGUI () {

        GUI.TextField( new Rect(10,10,120,20), $"TEST_3 : {testFloat}" );
        GUI.TextField( new Rect(10,30,170,20), $"TEST_4 : {testVector}" );
        
    }

}
