販売シーン時計挙動改善
This commit is contained in:
parent
d9b45c8264
commit
cd495f0a2c
|
|
@ -8,12 +8,14 @@ namespace MyGame.Scenes.marketing.Scripts
|
||||||
{
|
{
|
||||||
[SerializeField] private Transform shortNeedle;
|
[SerializeField] private Transform shortNeedle;
|
||||||
[SerializeField] private Transform longNeedle;
|
[SerializeField] private Transform longNeedle;
|
||||||
|
private readonly float timing = 60f;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(1f))
|
Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(timing))
|
||||||
.Select(_ => DateTime.Now)
|
.Select(_ => DateTime.Now)
|
||||||
.DistinctUntilChanged(x => x.Minute)
|
.DistinctUntilChanged(x => x.Minute)
|
||||||
|
.StartWith(DateTime.Now)
|
||||||
.Subscribe(x =>
|
.Subscribe(x =>
|
||||||
{
|
{
|
||||||
SetClock(x);
|
SetClock(x);
|
||||||
|
|
@ -22,8 +24,8 @@ namespace MyGame.Scenes.marketing.Scripts
|
||||||
|
|
||||||
private void SetClock(DateTime dateTime)
|
private void SetClock(DateTime dateTime)
|
||||||
{
|
{
|
||||||
shortNeedle.localRotation = Quaternion.Euler(Vector3.forward * -dateTime.Hour * 30);
|
shortNeedle.localRotation = Quaternion.Euler(Vector3.back * (dateTime.Hour * 30 + dateTime.Minute / 2));
|
||||||
longNeedle.localRotation = Quaternion.Euler(Vector3.forward * -dateTime.Minute * 6);
|
longNeedle.localRotation = Quaternion.Euler(Vector3.back * dateTime.Minute * 6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue