// The update method is called for every frame // We check if there has been a planet interaction and update accordingly if we have guessed for a location or not. void Update() { OVRInput.Update(); // Call before checking the input if (OVRInput.Get(OVRInput.Button.One) && (RayPointer.hasGuessed || !_gameStarted)) { hideSplash(); if (RayPointer.hasGuessed) { hideScoreSplash(); } if (nextLocation != null) { currentLocation = nextLocation; } nextLocation = GMAPS.GetNewStreetViewCoordinates(); TextureHelper.UpdateSkybox(); TextureHelper.cacheTextureSkybox(nextLocation); _globeTransform.localScale = new Vector3(0.0001f, 0.0001f, 0.0001f); } if (OVRInput.Get(OVRInput.Button.Three) && _gameStarted && !tutorialVisible) { tutorialVisible = true; _controllerTutorial.SetActive(true); } if (!OVRInput.Get(OVRInput.Button.Three) && _gameStarted && tutorialVisible) { tutorialVisible = false; _controllerTutorial.SetActive(false); } }
void Start() { //we attach the game objects to the actual scene object so that we can manipulate them with our code initializeGameObjects(); //change the visibility of GUI elements changeScoreVisibility(false); changeRoundVisibility(false); changeConfirmVisibility(false); changeIntroSplashVisibility(true); changeFinalRoundVisibility(false); currentLocation = GMAPS.GetNewStreetViewCoordinates(); TextureHelper.cacheTextureSkybox(currentLocation); }
public static void cacheTextureSkybox(GMAPS.Location loc) { Texture2D texUp = new Texture2D(DEFAULT_STREETVIEW_RES, DEFAULT_STREETVIEW_RES, TextureFormat.DXT1, false); Texture2D texDown = new Texture2D(DEFAULT_STREETVIEW_RES, DEFAULT_STREETVIEW_RES, TextureFormat.DXT1, false); Texture2D texFront = new Texture2D(DEFAULT_STREETVIEW_RES, DEFAULT_STREETVIEW_RES, TextureFormat.DXT1, false); Texture2D texBack = new Texture2D(DEFAULT_STREETVIEW_RES, DEFAULT_STREETVIEW_RES, TextureFormat.DXT1, false); Texture2D texLeft = new Texture2D(DEFAULT_STREETVIEW_RES, DEFAULT_STREETVIEW_RES, TextureFormat.DXT1, false); Texture2D texRight = new Texture2D(DEFAULT_STREETVIEW_RES, DEFAULT_STREETVIEW_RES, TextureFormat.DXT1, false); WWW wwwUp = new WWW(GMAPS.getAPIURL(DEFAULT_STREETVIEW_RES, loc, GMAPS.ViewAngle.DefaultUp)); WWW wwwDown = new WWW(GMAPS.getAPIURL(DEFAULT_STREETVIEW_RES, loc, GMAPS.ViewAngle.DefaultDown)); WWW wwwFront = new WWW(GMAPS.getAPIURL(DEFAULT_STREETVIEW_RES, loc, GMAPS.ViewAngle.DefaultFront)); WWW wwwBack = new WWW(GMAPS.getAPIURL(DEFAULT_STREETVIEW_RES, loc, GMAPS.ViewAngle.DefaultBack)); WWW wwwLeft = new WWW(GMAPS.getAPIURL(DEFAULT_STREETVIEW_RES, loc, GMAPS.ViewAngle.DefaultLeft)); WWW wwwRight = new WWW(GMAPS.getAPIURL(DEFAULT_STREETVIEW_RES, loc, GMAPS.ViewAngle.DefaultRight)); while (!wwwUp.isDone || !wwwDown.isDone || !wwwFront.isDone || !wwwBack.isDone || !wwwLeft.isDone || !wwwRight.isDone) { } wwwUp.LoadImageIntoTexture(texUp); wwwDown.LoadImageIntoTexture(texDown); wwwFront.LoadImageIntoTexture(texFront); wwwBack.LoadImageIntoTexture(texBack); wwwLeft.LoadImageIntoTexture(texLeft); wwwRight.LoadImageIntoTexture(texRight); Material m = new Material(Shader.Find("RenderFX/Skybox")); m.SetTexture("_FrontTex", texFront); m.SetTexture("_BackTex", texBack); m.SetTexture("_LeftTex", texLeft); m.SetTexture("_RightTex", texRight); m.SetTexture("_UpTex", texUp); m.SetTexture("_DownTex", texDown); TextureHelper.cachedSkyboxMaterial = m; }