Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# infinite clock coroutine loop

int count = 24;   //starts at midnight
string hour;
int time_scale_delay = 1;  //seconds

//infinite loop/clock from the start function with 24 second intervals 
IEnumerator Start()
{
  while(true)
  {
    yield return new WaitForSeconds(time_scale_delay);
    
    //reset timer
    if(count == 25)
      count = 1;
    
    //AM or PM
    if(count == 12)
      hour = (count + "th hour PM");
              if(count == 24)
              hour = ((count - 12) + "th hour AM");
                      if(count < 12)
                      hour = (count + "th hour AM");
                              if(count > 12 && != 24)
                              hour = ((count - 12) + "th hour PM");
    count + count +1;
   )
     
 
PREVIOUS NEXT
Tagged: #infinite #clock #coroutine #loop
ADD COMMENT
Topic
Name
1+6 =