Skip to content

Instantly share code, notes, and snippets.

@lazarofl
Last active February 6, 2017 21:13
Show Gist options
  • Save lazarofl/037ceb37068a50bbd13437b1439d4f50 to your computer and use it in GitHub Desktop.
Save lazarofl/037ceb37068a50bbd13437b1439d4f50 to your computer and use it in GitHub Desktop.
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