Last active
February 6, 2017 21:13
-
-
Save lazarofl/037ceb37068a50bbd13437b1439d4f50 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using HoloToolkit.Unity.InputModule; | |
using UnityEngine; | |
public class HologramBehaviors : MonoBehaviour, IFocusable, IInputClickHandler | |
{ | |
[SerializeField] | |
public bool IsRotating = false; | |
[SerializeField] | |
public Color FocusedColor = Color.red; | |
private Color OriginalColor; | |
// Use this for initialization | |
void Start() | |
{ | |
this.OriginalColor = gameObject.GetComponent<Renderer>().material.color; | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
if (IsRotating) | |
gameObject.transform.Rotate(1, 1, 1); | |
} | |
public void OnFocusEnter() | |
{ | |
gameObject.GetComponent<Renderer>().material.color = FocusedColor; | |
} | |
public void OnFocusExit() | |
{ | |
gameObject.GetComponent<Renderer>().material.color = OriginalColor; | |
} | |
public void OnInputClicked(InputEventData eventData) | |
{ | |
IsRotating = !IsRotating; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment