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

public class TM_Utilities : MonoBehaviour
{
    private static TM_Utilities _instance;

    private static TM_Utilities Instance
    {
        get
        {
            if (_instance == null)
            {
                _instance = FindObjectOfType<TM_Utilities>();

                if (_instance != null)
                {
                    return _instance;
                }

                GameObject go = new GameObject("TM_Utilities");
                _instance = go.AddComponent<TM_Utilities>();
            }

            return _instance;
        }
    }

    public static Vector2 Rotate2DVector(Vector2 rotateMe, float fAngleInDegrees)
    {
        Vector2 retVec = new Vector2();
        float rads = (fAngleInDegrees / 360.0f) * 6.28f;

        retVec.x = rotateMe.x * Mathf.Cos(rads) - rotateMe.y * Mathf.Sin(rads);
        retVec.y = rotateMe.x * Mathf.Sin(rads) + rotateMe.y * Mathf.Cos(rads);
        return retVec;
    }
}