販売シーン時計の針ロジック追加
This commit is contained in:
parent
d5c94d1adf
commit
512ac49e7c
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using UniRx;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MyGame.Scenes.marketing.Scripts
|
||||
{
|
||||
public class ClockView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Transform shortNeedle;
|
||||
[SerializeField] private Transform longNeedle;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Observable.Timer(TimeSpan.Zero, TimeSpan.FromSeconds(1f))
|
||||
.Select(_ => DateTime.Now)
|
||||
.DistinctUntilChanged(x => x.Minute)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
SetClock(x);
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
private void SetClock(DateTime dateTime)
|
||||
{
|
||||
shortNeedle.localRotation = Quaternion.Euler(Vector3.forward * -dateTime.Hour * 30);
|
||||
longNeedle.localRotation = Quaternion.Euler(Vector3.forward * -dateTime.Minute * 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6686769e44a54cccba71011ca528e233
|
||||
timeCreated: 1638334927
|
||||
|
|
@ -7733,6 +7733,7 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1522686120}
|
||||
- component: {fileID: 1522686121}
|
||||
m_Layer: 0
|
||||
m_Name: Clock
|
||||
m_TagString: Untagged
|
||||
|
|
@ -7755,6 +7756,20 @@ Transform:
|
|||
m_Father: {fileID: 1102296790}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &1522686121
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1522686119}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6686769e44a54cccba71011ca528e233, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
shortNeedle: {fileID: 2115458980}
|
||||
longNeedle: {fileID: 944070334}
|
||||
--- !u!1001 &1556091576
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
Loading…
Reference in New Issue