/****************************************************************************** * Copyright (C) Leap Motion, Inc. 2011-2018. * * Leap Motion proprietary and confidential. * * * * Use subject to the terms of the Leap Motion SDK Agreement available at * * https://developer.leapmotion.com/sdk_agreement, or another agreement * * between Leap Motion and you, your company or other organization. * ******************************************************************************/ using UnityEngine; using System.Collections; using System.Collections.Generic; namespace Leap.Unity { public class KeyEnableBehaviors : MonoBehaviour { public List targets; [Header("Controls")] public KeyCode unlockHold = KeyCode.None; public KeyCode toggle = KeyCode.Space; // Update is called once per frame void Update() { if (unlockHold != KeyCode.None && !Input.GetKey(unlockHold)) { return; } if (Input.GetKeyDown(toggle)) { for (int i = 0; i < targets.Count; i++) { targets[i].enabled = !targets[i].enabled; } } } } }