Skip to content

Instantly share code, notes, and snippets.

@CapnRat
Created October 19, 2014 16:59
Show Gist options
  • Select an option

  • Save CapnRat/cf218b56249a8326d069 to your computer and use it in GitHub Desktop.

Select an option

Save CapnRat/cf218b56249a8326d069 to your computer and use it in GitHub Desktop.

Revisions

  1. CapnRat created this gist Oct 19, 2014.
    35 changes: 35 additions & 0 deletions GameController
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    using UnityEngine;
    using System.Collections;

    public class GameController : MonoBehaviour {

    public bool craneSwitch;
    public static GameController instance;

    void Awake () {
    // There can only be one
    if (instance != null)
    {
    this.enabled = false;
    Destroy (this.gameObject);
    return;
    }

    instance = this;
    }

    // Use this for initialization
    void Start () {
    craneSwitch = false;
    }

    // Update is called once per frame
    void Update () {

    if (Input.GetKeyDown(KeyCode.Space))
    {
    craneSwitch = !craneSwitch;
    Debug.Log (craneSwitch);
    }
    }
    }