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
| public static bool HasOSVRHMDEnabled() | |
| { | |
| #if UNITY_STANDALONE | |
| var clientContext = new OSVR.ClientKit.ClientContext(GamePrefs.AppID); | |
| // Check if the server is running | |
| if (clientContext != null && clientContext.CheckStatus()) | |
| { | |
| // Check if the HMD si connected | |
| var displayConfig = clientContext.GetDisplayConfig(); |
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
| public static int GetScreenInch() | |
| { | |
| #if UNITY_ANDROID | |
| var displayMetrics = new AndroidJavaObject("android.util.DisplayMetrics"); | |
| var heightPixels = displayMetrics.Get<int>("heightPixels"); | |
| var widthPixels = displayMetrics.Get<int>("widthPixels"); | |
| var xdpi = displayMetrics.Get<float>("xdpi"); | |
| var ydpi = displayMetrics.Get<float>("ydpi"); | |
| var x = widthPixels / xdpi; | |
| var y = heightPixels / ydpi; |
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
| var array = [1, 2, 3, 4, 5]; | |
| console.log(array.length); // 5 | |
| array.length--; | |
| console.log(array.length); // 4 | |
| array.length += 15; | |
| console.log(array.length); // 19 |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"/> | |
| <title>VR Sandbox 3D</title> | |
| <style> | |
| body { | |
| margin: 0; padding: 0; overflow: hidden; | |
| } |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>ECMAScript 6 - Demos</title> | |
| </head> | |
| <body> | |
| <script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script> | |
| <script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script> | |
| <script type="module"> |
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
| var start = new Date().getTime(); for (var i = 0; i < 1000000; i++) { "foo"; } console.log("Original Loop:", (new Date().getTime() - start)) | |
| var start = new Date().getTime(); for (var i = 0; i < 1000000; i++) { "foo"; } console.log("Original Loop:", (new Date().getTime() - start)) | |
| var start = new Date().getTime(); for (var i = 0; i < 1000000; i++) { "foo"; } console.log("Original Loop:", (new Date().getTime() - start)) | |
| var start = new Date().getTime(); for (var i = -1; ++i < 1000000; ) { "foo"; } console.log("New Loop:", (new Date().getTime() - start)) | |
| var start = new Date().getTime(); for (var i = -1; ++i < 1000000; ) { "foo"; } console.log("New Loop:", (new Date().getTime() - start)) | |
| var start = new Date().getTime(); for (var i = -1; ++i < 1000000; ) { "foo"; } console.log("New Loop:", (new Date().getTime() - start)) |
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
| Shader "Demonixis/LavaShader" { | |
| Properties { | |
| _MainTexture ("Lava texture", 2D) = "white" {} | |
| _BumpTexture ("Bump texture", 2D) = "white" {} | |
| _DiffuseColor ("Diffuse Color", Color) = (1, 1, 1, 1) | |
| _EmissiveColor ("Emissive Color", Color) = (0, 0, 0, 1) | |
| _Tiling ("Texture tiling", Vector) = (1, 1, 0) | |
| _Offset ("Texture offset", Vector) = (0, 0, 0) | |
| _WeaveSpeed ("_WeaveSpeed", float) = 1 | |
| } |
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
| var MobileVRCamera = (function() { | |
| var mobileVR = function(position, scene) { | |
| BABYLON.OculusCamera.call(this, "MobileVR Component", position, scene); | |
| this.vrEnabled = false; | |
| this.screenOrientation = 0; | |
| this.deviceOrientation = { | |
| alpha: 0, | |
| beta: 0, |
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
| var OculusRiftCamera = (function () { | |
| var camRift = function (position, scene) { | |
| BABYLON.OculusCamera.call(this, "OculusRiftCamera", position, scene); | |
| this._startVR = this._startVR.bind(this); | |
| }; | |
| camRift.prototype = Object.create(BABYLON.OculusCamera.prototype); | |
| camRift.prototype.attachControl = function (element, noPreventDefault) { | |
| BABYLON.OculusCamera.prototype.attachControl.call(this, element, noPreventDefault); |
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 UnityEngine; | |
| using System.Collections; | |
| public class LevelManager : MonoBehaviour | |
| { | |
| public CameraFollow playerCam; | |
| public GameObject playerPrefab; | |
| public SpawnPoint[] spawnPoints; | |
| void Start () |