using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class Compass : MonoBehaviour
{
    private float RotZ = 0f;
    public Image UICompass;
    // Start is called before the first frame update
    void Start()
    {
        Observable.EveryLateUpdate()
            .Where(_ => gameObject.activeSelf == true&&UICompass!=null)
            .Subscribe(_ =>
            {
                RotZ = transform.eulerAngles.y + AssetManager.Instance.InitialAngle;
                UICompass.transform.eulerAngles = new Vector3(0, 0, RotZ);
            });
    }

    
}