Net.Like.Xue.Tokyo/Assets/Artists/Scripts/SetDayTime.cs

38 lines
799 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using BITKit;
using NodeCanvas.Framework;
using Pinwheel.Jupiter;
using UnityEngine;
namespace Net.Like.Xue.Tokyo
{
public class SetDayTime:MonoBehaviour
{
private JDayNightCycle _cycle;
private void Start()
{
_cycle = GetComponent<JDayNightCycle>();
Data.AddListener<float>("Time",OnSetTime);
destroyCancellationToken.Register(Dispose);
}
private void Dispose()
{
Data.RemoveListender<float>("Time",OnSetTime);
}
private void Update()
{
Data.Set("Time", _cycle.Time);
}
private void OnSetTime(float obj)
{
_cycle.Time = obj;
}
}
}