Skip to content

Instantly share code, notes, and snippets.

@mikelovesrobots
Created March 11, 2016 22:37
Show Gist options
  • Save mikelovesrobots/f04e78f1d1eacbc6fc09 to your computer and use it in GitHub Desktop.
Save mikelovesrobots/f04e78f1d1eacbc6fc09 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System;
using System.Collections;
public class CheatActivator : MonoBehaviour {
private DateTime ClickedAt;
private const int MIN_SECONDS = 5;
private const string CHEAT_SCENE = "Cheats";
public void OnPress(bool isDown) {
if (isDown) {
ClickedAt = DateTime.Now;
} else {
var timeDiff = DateTime.Now - ClickedAt;
if (timeDiff.TotalSeconds >= MIN_SECONDS) {
SceneTransitioner.Instance.TransitionTo(CHEAT_SCENE);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment