Skip to content

Instantly share code, notes, and snippets.

@danaabs
Created March 11, 2017 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danaabs/65a605ac8c9bf53757e7c4fd12bc8bfa to your computer and use it in GitHub Desktop.
Save danaabs/65a605ac8c9bf53757e7c4fd12bc8bfa to your computer and use it in GitHub Desktop.
Button Code for hops (unity)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class PilsHops : MonoBehaviour, IVirtualButtonEventHandler {
private GameObject vbbuttonObject4;
//private GameObject showTest;
private GameObject BPils;
//private GameObject BAle2;
private GameObject BPils2;
// Use this for initialization
void Start () {
vbbuttonObject4 = GameObject.Find ("PilsactionButtonBack");
//zombie = GameObject.Find("zombie");
//showTest = GameObject.Find("SphereTest");
BPils = GameObject.Find ("BPilsner");
//BAle2 = GameObject.Find ("BAle2");
BPils2 = GameObject.Find ("BPils2");
BPils2.SetActive (false); //hide B Ale @ start
vbbuttonObject4.GetComponent<VirtualButtonBehaviour> ().RegisterEventHandler (this);
}
public void OnButtonPressed(VirtualButtonAbstractBehaviour vb){
//Debug.Log ("button down!!");
//zombie.GetComponent<Animation>().Play();
//showTest.SetActive(true);
BPils.SetActive (false); //hide BLager when button pressed
//BAle2.SetActive(false);
}
public void OnButtonReleased(VirtualButtonAbstractBehaviour vb){
BPils2.SetActive(true); //show BAle when button release
//BAle2.SetActive(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment