I have a time script which generates the time *Example*
using UnityEngine;
namespace TheTime
{
public class CurrentTime : MonoBehaviour
{
public float
TimeH = 0,
TimeM = 0,
TimeS = 0;
public bool ActiveTime,Rewind,FastForward;
void Update (){
if (ActiveTime)
{
float secondsPassed = Time.deltaTime;
if (Rewind)
{
secondsPassed *= -1250;
TimeS += secondsPassed;
if (TimeS <= 0) {
TimeM--;
TimeS += 60;
}
if (TimeM <= 0) {
TimeH--;
TimeM += 60;
}
if (TimeH <= 0) {
TimeH += 24;
}
}
That's just a slice of it, the fast forward and rewind are the same.
Anyway I have another script which handles a clock I made
using UnityEngine;
using TheTime;
class FFClock : MonoBehaviour {
public Transform hours, minutes, seconds;
void Update (){
{
hours.localRotation =
Quaternion.Euler(CurrentTime.TimeH,90,90);
minutes.localRotation =
Quaternion.Euler(CurrentTime.TimeM,90,90);
seconds.localRotation =
Quaternion.Euler(CurrentTime.TimeS,90,90);
}
}
}
the 3 lines all give me
1."error CS1503: Argument `#1' cannot convert `object' expression to type `float'"
2.error CS0120: An object reference is required to access non-static member `TheTime.CurrentTime.TimeM'
↧