Adjusted door timetables, added clock and wall trashcan
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
|
||||
using UnityEngine;
|
||||
using System;
|
||||
|
||||
public class Clock : MonoBehaviour
|
||||
{
|
||||
public GameObject HourHand;
|
||||
public GameObject MinuteHand;
|
||||
|
||||
private Vector3 hourBaseAngles;
|
||||
private Vector3 minuteBaseAngles;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
// Remember the original orientations.
|
||||
hourBaseAngles = HourHand.transform.localEulerAngles;
|
||||
minuteBaseAngles = MinuteHand.transform.localEulerAngles;
|
||||
}
|
||||
|
||||
public void SetTime(DateTime time)
|
||||
{
|
||||
// Calculate the hand angles.
|
||||
float minuteAngle = time.Minute * 6f;
|
||||
float hourAngle = (time.Hour % 12 + time.Minute / 60f) * 30f;
|
||||
|
||||
// Preserve the original X and Z rotations.
|
||||
HourHand.transform.localRotation = Quaternion.Euler(
|
||||
hourBaseAngles.x,
|
||||
hourBaseAngles.y + hourAngle,
|
||||
hourBaseAngles.z
|
||||
);
|
||||
|
||||
MinuteHand.transform.localRotation = Quaternion.Euler(
|
||||
minuteBaseAngles.x,
|
||||
minuteBaseAngles.y + minuteAngle,
|
||||
minuteBaseAngles.z
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user