private void Start() { _wearableControl = WearableControl.Instance; _wearableControl.DeviceConnected += OnDeviceConnected; _wearableControl.DeviceDisconnected += OnDeviceDisconnected; var deviceIsConnected = _wearableControl.ConnectedDevice.HasValue; _buttonParentGameObject.gameObject.SetActive(deviceIsConnected); _connectParentGameObject.gameObject.SetActive(!deviceIsConnected); }
private void Awake() { _matcher = GetComponent <RotationMatcher>(); // Grab an instance of the WearableControl singleton. This is the primary access point to the wearable SDK. _wearableControl = WearableControl.Instance; _audioSource = AudioControl.Instance; // Subscribe to DeviceConnected to handle reconnects that happen during play. _wearableControl.DeviceConnected += OnDeviceConnected; }
private void Start() { _wearableControl = WearableControl.Instance; _audioControl = AudioControl.Instance; _sfx = GetComponent <TargetSFX>(); _animator = GetComponent <Animator>(); _animator.SetBool("Destroy", false); _collected = false; _targetLocked = false; PlaySpawnSting(); }
private void OnEnable() { _editorProvider = serializedObject.FindProperty(EDITOR_DEFAULT_PROVIDER_FIELD); _runtimeProvider = serializedObject.FindProperty(RUNTIME_DEFAULT_PROVIDER_FIELD); _editorProviderMap = GetProviderMap(WearableConstants.DISALLOWED_EDITOR_PROVIDERS); _editorProviderOptions = _editorProviderMap.Keys.ToArray(); _runtimeProviderMap = GetProviderMap(WearableConstants.DISALLOWED_RUNTIME_PROVIDERS); _runtimeProviderOptions = _runtimeProviderMap.Keys.ToArray(); _wearableControl = (WearableControl)target; }
private void OnEnable() { _editorProvider = serializedObject.FindProperty(EditorDefaultProviderField); _runtimeProvider = serializedObject.FindProperty(RuntimeDefaultProviderField); _editorProviderMap = GetProviderMap(WearableConstants.DisallowedEditorProviders); _editorProviderOptions = _editorProviderMap.Keys.ToArray(); _runtimeProviderMap = GetProviderMap(WearableConstants.DisallowedRuntimeProviders); _runtimeProviderOptions = _runtimeProviderMap.Keys.ToArray(); _wearableControl = (WearableControl)target; }
//private GestureDetector gest; // Start is called before the first frame update void Start() { headShaken = false; audios = cube.GetComponent <AudioSource>(); audios.enabled = false; _wearableControl = WearableControl.Instance; // Establish a requirement for the acceleration sensor WearableRequirement requirement = GetComponent <WearableRequirement>(); if (requirement == null) { requirement = gameObject.AddComponent <WearableRequirement>(); } requirement.EnableSensor(SensorId.Accelerometer); requirement.SetSensorUpdateInterval(SensorUpdateInterval.EightyMs); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); //count = 0; //SetCountText(); //winText.text = "You Win!"; //winText.gameObject.SetActive(false); //getCount = GameObject.FindGameObjectsWithTag("Pick Up"); //pickUpCount = getCount.Length; wearableControl = WearableControl.Instance; WearableRequirement requirement = GetComponent <WearableRequirement>(); if (requirement == null) { requirement = gameObject.AddComponent <WearableRequirement>(); } requirement.EnableSensor(SensorId.RotationSixDof); requirement.SetSensorUpdateInterval(SensorUpdateInterval.EightyMs); }
private void Awake() { _protocol = new WearableProxyServerProtocol(); _protocol.KeepAlive += OnKeepAlivePacket; _protocol.SensorControl += OnSensorControlPacket; _protocol.GestureControl += OnGestureControlPacket; _protocol.ConnectToDevice += OnConnectToDevicePacket; _protocol.DisconnectFromDevice += OnDisconnectFromDevicePacket; _protocol.InitiateDeviceSearch += OnInitiateDeviceSearchPacket; _protocol.StopDeviceSearch += OnStopDeviceSearchPacket; _protocol.QueryConnectionStatus += OnQueryConnectionStatusPacket; _protocol.QueryUpdateInterval += OnQueryUpdateIntervalPacket; _protocol.RSSIFilterValueChange += OnRSSIFilterValueChangePacket; _protocol.SetUpdateInterval += OnSetUpdateIntervalPacket; _protocol.QuerySensorStatus += OnQuerySensorStatusPacket; _protocol.QueryGestureStatus += OnQueryGestureStatusPacket; _protocol.PingQuery += OnPingQuery; _protocol.SetRotationSource += OnSetRotationSourcePacket; _protocol.QueryRotationSource += OnQueryRotationSourcePacket; _listener = new TcpListener(IPAddress.Any, _port); _receiveBuffer = new byte[WearableProxyProtocolBase.SuggestedClientToServerBufferSize]; _receiveIndex = 0; _transmitBuffer = new byte[WearableProxyProtocolBase.SuggestedServerToClientBufferSize]; _transmitIndex = 0; _networkTimeout = 0.5f; _running = false; _wearableControl = WearableControl.Instance; _wearableControl.DeviceConnecting += OnDeviceConnecting; _wearableControl.DeviceConnected += OnDeviceConnected; _wearableControl.DeviceDisconnected += OnDeviceDisconnected; _deviceProvider = (WearableDeviceProvider)_wearableControl.GetOrCreateProvider <WearableDeviceProvider>(); }
private void Start() { _wearableControl = WearableControl.Instance; _wearableControl.DeviceDisconnected += OnDeviceDisconnected; }
private void Awake() { _wearableControl = WearableControl.Instance; _sfx = GetComponent <TargetSFX>(); _animator = GetComponent <Animator>(); }
private void Awake() { _wearableControl = WearableControl.Instance; }
private void Awake() { // Grab an instance of the WearableControl singleton. This is the primary access point to the wearable SDK. _wearableControl = WearableControl.Instance; }
// Update is called once per frame // Mode - 1:Help, 2:Classic, 3:Memory void Update() { if (Input.GetKeyDown("1")) { if (GameMode == 0) { GameMode = 1; Instruction.SetActive(true); //playaudio(13); timeold = Time.time; } else if (GameMode == 1) { GameMode = 0; Instruction.SetActive(false); timeold = Time.time; } } else if (Input.GetKeyDown("2")) { if (initialize == 0) { wearableControl = WearableControl.Instance; WearableRequirement requirement = GetComponent <WearableRequirement>(); if (requirement == null) { requirement = gameObject.AddComponent <WearableRequirement>(); } requirement.EnableSensor(SensorId.RotationSixDof); requirement.SetSensorUpdateInterval(SensorUpdateInterval.FortyMs); //Debug.Log("Game Started : i = "+ i); initialize = 1; } GameMode = 2; playaudio(4); timeold = Time.time; } else if (Input.GetKeyDown("h")) { score = score - 100; T_Score.text = "Score : " + score; if (fb_flip == 1) { T_FBStatus.text = "Front-Back : Flipped"; } else { T_FBStatus.text = "Front-Back : Normal"; } if (lr_flip == 1) { T_LRStatus.text = "Left-Right : Flipped"; } else { T_LRStatus.text = "Left-Right : Normal"; } T_Hint.text = ""; } if (GameMode > 1) { SensorFrame sensorFrame = wearableControl.LastSensorFrame; movez = sensorFrame.rotationSixDof.value.eulerAngles.z; movex = sensorFrame.rotationSixDof.value.eulerAngles.x; } if (GameMode == 0) { if (Time.time - timeold >= delay) { playaudio(14); timeold = Time.time; } } /*else if (GameMode == 1){ * if(Time.time-timeold >= delay){ * GameMode = 0; * T_Score.text = " "; * T_Lives.text = " "; * T_Difficulty.text = " "; * T_LRStatus.text = " "; * T_FBStatus.text = " "; * } * }*/ else if (GameMode == 2) { if (Time.time - timeold >= delay) { //Debug.Log("Actually Started : i = "+ i); info_mode1 = 0; // Checking the head position : Pitch & Roll if (ctr != 0 && info_mode == 0) { //Debug.Log(r_o+","+movex+","+movez); //Debug.Log("Before Checking : i = "+ i); if (lr_flip == 0) { if (r_o == 1 && !((movez > 270) && (movez < 360 - threshold))) { Wrong_Action(); } else if (r_o == 3 && !((movez > threshold) && (movez < 90))) { Wrong_Action(); } } else { if (r_o == 3 && !((movez > 270) && (movez < 360 - threshold))) { Wrong_Action(); } else if (r_o == 1 && !((movez > threshold) && (movez < 90))) { Wrong_Action(); } } if (fb_flip == 0) { if (r_o == 0 && !((movex > threshold) && (movex < 90))) { Wrong_Action(); } else if (r_o == 2 && !((movex > 270) && (movex < 360 - threshold))) { Wrong_Action(); } } else { if (r_o == 2 && !((movex > threshold) && (movex < 90))) { Wrong_Action(); } else if (r_o == 0 && !((movex > 270) && (movex < 360 - threshold))) { Wrong_Action(); } } } if (ctr > 0 && info_mode == 0 && info_mode1 == 0) { score = score + difficulty; T_Score.text = "Score : " + score; Cont_Correct++; playaudio(15); info_mode1 = 1; if (Cont_Correct == 5) { Cont_Correct = 0; Lives++; playaudio(12); T_Lives.text = "Lives : " + Lives; //info_mode1=1; } } info_mode = info_mode1; // Change level after every 5 steps if (GameMode != 0 && ctr == 5 && info_mode == 0) { difficulty++; T_FBStatus.text = " "; T_LRStatus.text = " "; T_Hint.text = "Press 'h' for hint"; Cont_Correct = 0; reaction_time = reaction_time * (0.9); if (difficulty == 16) { playaudio(10); } else { r1 = Random.Range(1, 4); // 1:LR_Flip, 2:FB_Flip, 3:Both if (difficulty <= 5) { while (r1 == 3) { r1 = Random.Range(1, 4); } } playaudio(5 + r1); ctr = 0; } info_mode = 1; T_Difficulty.text = "Difficulty : " + difficulty; } timeold = Time.time; if (GameMode != 0 && info_mode == 0) { //Debug.Log("Before Playing : i = "+ i); r = Random.Range(0, 4); while (r == r_o) { r = Random.Range(0, 4); } r_o = r; playaudio(r); ctr++; } } } }
private void Awake() { _matcher = GetComponent <RotationMatcher>(); _wearableControl = WearableControl.Instance; StartSensors(); }