Skip to Content
Augmented Reality for Developers
book

Augmented Reality for Developers

by Jonathan Linowes, Krystian Babilinski
October 2017
Intermediate to advanced
548 pages
13h 23m
English
Packt Publishing
Content preview from Augmented Reality for Developers

Gametime event handlers

Now we can implement the behavior when the user clicks down the mouse and releases it. Very simply, we'll set gameTimePerDay to 24f and 0.5f, respectively. We'll add these functions to MasterControls.cs. Open that script and add two functions, namely SlowTime() and ResetTime(), like this:

File: MasterControls.cs 
using UnityEngine; 
 
public class MasterControls : MonoBehaviour { 
    public float gametimePerDay = 0.05f; 
 
    public void SlowTime() { 
        gametimePerDay = 24f; 
    } 
 
    public void ResetTime() { 
        gametimePerDay = 0.05f; 
    } 
} 

The SlowTime() function will change gametimePerDay, so the animation is slow. Likewise, ResetTime() will speed it back up.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Augmented Reality Game Development

Augmented Reality Game Development

Micheal Lanham
Augmented Reality

Augmented Reality

Joseph Rampolla, Greg Kipper

Publisher Resources

ISBN: 9781787286436Supplemental Content