public void EnableDisplay() { bool a = display.IsActive(); display.gameObject.SetActive(!a); enableDisplay.GetComponentInChildren <Text>().text = a ? "3D" : "2D"; }
public string NomeTexturaModuloSelecionado(string modulo) { switch (modulo) { case "cabeca": return(Cabeca.texture.name); case "nariz": return(Nariz.texture.name); case "olhos": return(Olhos.texture.name); case "boca": return(Boca.texture.name); case "roupa": return(Roupa.texture.name); case "cabeloFrontal": return((CabeloFrontal.IsActive()) ? CabeloFrontal.texture.name : modulo + "vazio"); case "cabeloTraseiro": return((CabeloTraseiro.IsActive()) ? CabeloTraseiro.texture.name : modulo + "vazio"); case "barba": return((Barba.IsActive()) ? Barba.texture.name : modulo + "vazio"); case "sombrancelhas": return(Sombrancelhas.texture.name); default: return(""); } }
protected virtual void OnTrackingFound() { //Disabled audio and video playback and enable image playback mTrackableBehaviour.gameObject.SetActive(true); video.gameObject.SetActive(false); sound.gameObject.SetActive(false); var rendererComponents = GetComponentsInChildren <Renderer>(true); var colliderComponents = GetComponentsInChildren <Collider>(true); var canvasComponents = GetComponentsInChildren <Canvas>(true); // Enable rendering: foreach (var component in rendererComponents) { component.enabled = true; } // Enable colliders: foreach (var component in colliderComponents) { component.enabled = true; } // Enable canvas': foreach (var component in canvasComponents) { component.enabled = true; } if (Imagenes != null) { msjImagen = ""; //To advance image if (countImg == 2) { CancelInvoke(); Advance(); } if (img.IsActive() == false) { img.gameObject.SetActive(true); Invoke("Advance", 15); } detalles.text = statusRed + "\nMarcador perdido: " + ((countImg == 1)?countImg.ToString() + " vez":countImg.ToString() + " veces") + "\n" + msjImagen; } else { msjImagen = "Sin imágenes para mostrar"; detalles.text = statusRed + "\nMarcador perdido: " + ((countImg == 1)?countImg.ToString() + " vez":countImg.ToString() + " veces") + "\n" + msjImagen; countImg = -1; StartCoroutine(getImagenes()); } }
// Update is called once per frame void Update() { if (!BladeModeElementRawImage) { return; } Color thecolor = this.GetComponent <RawImage>().color; thecolor.a = BladeModeElementRawImage.IsActive()?0:1; this.GetComponent <RawImage>().color = thecolor; }
// Update is called once per frame void Update() { if (feet.IsActive() == true) { t -= Time.deltaTime; if (t < 0) { feet.gameObject.SetActive(false); t = 0.2f; } } }
void Update() { if (tapToContinue.IsActive()) { if (Input.touchCount > 0) { screenTapped = true; } if (Input.anyKey) { screenTapped = true; } } }
// Update is called once per frame void Update() { if (ui_displayState >= 2) { if (!CanAttack()) { ui_attackIconCover.transform.position = new Vector3(ui_attackIconPos.x, ui_attackIconPos.y + ((coolDownTimer - Time.time) * (50 / coolDownDuration))); ui_attackIconCover.transform.localScale = new Vector3(1, ((coolDownTimer - Time.time) * 1 / coolDownDuration), 1); } else if (CanAttack() && ui_attackIconCover.IsActive()) { ui_attackIconCover.gameObject.SetActive(false); } } }
private bool GetColorComponent() { if (!colorCodeView) { if (root) { var ColorView = root.transform.FindChildRecursively("ColorCodeView"); if (ColorView) { ColorView.gameObject.SetActive(true); colorCodeView = ColorView.GetComponent <RawImage>(); } } } return(colorCodeView.IsActive()); }
private void Update() { c.r = 0; c.g = 0; c.b = 0; if (img.IsActive()) { c.a += Time.deltaTime; img.color = c; audio.volume -= Time.deltaTime; } if (img.color.a >= 1f) { SceneManager.LoadScene(1); } }
public void hitByBullet(Vector2 bulletPosition) { if (bloodTexDisp.IsActive() == false) { bloodTexDisp.gameObject.SetActive(true); } bloodAlphaVal += 0.3f; //bullet position to be converted so the camera gets moved in the direction of the bullets path //do math.abs(bul pos - pl pos) if (bloodAlphaVal > 0.8f) { bloodAlphaVal = 0.8f; } cameraRecoilOffset = transform.InverseTransformDirection(bulletPosition.normalized) * 3; }
//Make sure to check for input before the minigame has started. private void Update() { bool nextScreen = InputManager.Instance.GetButton("nextScreen"); //bool nextScreen = true; //Check for input to get rid of the tutorial screen. if ((nextScreen) && (LS_tutorialScreen.IsActive()) && (!LS_introScreen.enabled)) { LS_tutorialScreen.enabled = false; //LS_tutStart.enabled = false; StartMinigame(); } //Check for input to get rid of the tutorial screen. if ((nextScreen) && (LS_introScreen.IsActive())) { LS_introScreen.enabled = false; //LS_introStart.enabled = false; } }
/* * Create an Atlas (improve performance, only one drawcall needed to show all images!) */ private void createImagesAtlas(List <Texture2D> textures) { // Create the Atlas Texture2D atlas = new Texture2D(MaximumAtlasSize, MaximumAtlasSize); var rects = atlas.PackTextures(textures.ToArray(), 10, MaximumAtlasSize); // Draw white margin (instead of transparent) for (var i = 0; i < atlas.width; i++) { for (var j = 0; j < atlas.height; j++) { var pixel = atlas.GetPixel(i, j); if (pixel == new Color(pixel.r, pixel.g, pixel.b, 0f)) //Transparent? { atlas.SetPixel(i, j, Color.white); } } } atlas.Apply(); // Used to see the Atlas if (DebugAtlas != null && DebugAtlas.IsActive()) { #if UNITY_EDITOR DebugAtlas.texture = atlas; #else DebugAtlas.gameObject.SetActive(false); #endif } // Then apply the atlas texture to for (var i = 0; i < draggableObjects.Count; i++) { ((DraggableImageObject)draggableObjects[i]).SetImage(atlas, new Rect(rects[i].x - AtlasMargin, rects[i].y - AtlasMargin, rects[i].width + AtlasMargin * 2, rects[i].height + AtlasMargin * 2)); } }
public void Update() { _arCoreLifeCycleManager.UpdateApplicationLifecycle(); clickOnFloorTutorial.SetActive(!_portalCreated && !moreInfo.activeSelf && !pointDownTutorial.IsActive()); if (_portalCreated) { return; } // If the player has not touched the screen, we are done with this update. Touch touch; if (Input.touchCount < 1 || (touch = Input.GetTouch(0)).phase != TouchPhase.Began) { return; } // Should not handle input if the player is pointing on UI. if (EventSystem.current.IsPointerOverGameObject(touch.fingerId)) { return; } // Raycast against the location the player touched to search for planes. const TrackableHitFlags rayCastFilter = TrackableHitFlags.PlaneWithinPolygon | TrackableHitFlags.FeaturePointWithSurfaceNormal; if (!Frame.Raycast(touch.position.x, touch.position.y, rayCastFilter, out var hit)) { return; } // Use hit pose and camera pose to check if hittest is from the // back of the plane, if it is, no need to create the anchor. if (hit.Trackable is DetectedPlane && Vector3.Dot(FirstPersonCamera.transform.position - hit.Pose.position, hit.Pose.rotation * Vector3.up) < 0) { Debug.Log("Hit at back of the current DetectedPlane"); } else { // Choose the Andy model for the Trackable that got hit. var prefab = SpawnPrefab; if (hit.Trackable is FeaturePoint) { return; } // Instantiate Andy model at the hit pose. var portal = Instantiate(prefab, hit.Pose.position, hit.Pose.rotation); // Compensate for the hitPose rotation facing away from the raycast (i.e. // camera). portal.transform.Rotate(0, k_ModelRotation, 0, Space.Self); // Create an anchor to allow ARCore to track the hitpoint as understanding of // the physical world evolves. var anchor = hit.Trackable.CreateAnchor(hit.Pose); // Make Andy model a child of the anchor. portal.transform.parent = anchor.transform; _portalCreated = true; } }
// Update is called once per frame void Update() { remainingFlowers = gardenController.GetComponent <gardenController>().gardenFlowers - currentFlower; //int tempo = gardenController.GetComponent<gardenController>().gardenFlowers; int tempo = 100; beesCreated.text = gardenController.GetComponent <gardenController>().gardenBees - beeStack.Count + " bees fed"; beesRemaining.text = beeStack.Count + " bees left"; if (Input.touchCount > 0) { var touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { var screenPosition = Camera.main.ScreenToViewportPoint(touch.position); ARPoint point = new ARPoint { x = screenPosition.x, y = screenPosition.y }; List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingExtent); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Vector3 position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); //add createheight to the y below placeLevel = new Vector3(position.x, position.y, position.z); bool UIZ = IsPointerOverUIObject(); if (currentFlower < 1000 && !UIZ) { if (tapCount == 0) { } alert.SetActive(false); CreateBall(placeLevel, twoFlower); currentFlower++; Debug.Log("current flower: " + currentFlower + ", total bees: " + beeStack.Count + ", position:" + placeLevel.x + ", " + placeLevel.y + ", " + placeLevel.z); tapCount++; // + ", remaining flowers: "+remainingFlowers } else if (totalBees == currentFlowerType && popUp.IsActive() == false) { // Debug.Log("SCENE RESET"); popUp2.gameObject.SetActive(true); } else if (keeper.Instance.currentGardenLevel == 4) { // SceneManager.LoadScene("Beez"); } else { Debug.Log("TRY AGAIN"); } break; } } } } }
// Update is called once per frame void Update() { remainingFlowers = gardenController.GetComponent <gardenController>().gardenFlowers - currentFlower + 1; beesCreated.text = gardenController.GetComponent <gardenController>().gardenBees - beeStack.Count + " bees fed"; beesRemaining.text = beeStack.Count + " bees left"; /* * if (popUp.IsActive()==true){ * // * Debug.Log("popup active? "+popUp.IsActive()); * } */ //Debug.Log("popup active? "+popUp.IsActive()); #if UNITY_EDITOR //we will only use this script on the editor side, though there is nothing that would prevent it from working on device if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; //we'll try to hit one of the plane collider gameobjects that were generated by the plugin //effectively similar to calling HitTest with ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingExtent if (Physics.Raycast(ray, out hit, maxRayDistance, collisionLayer)) { //CreateBall (new Vector3 (hit.point.x, hit.point.y + createHeight, hit.point.z),); //we're going to get the position from the contact point Debug.Log(string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######}", hit.point.x, hit.point.y, hit.point.z)); } } #else if (Input.touchCount > 0) { var touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { var screenPosition = Camera.main.ScreenToViewportPoint(touch.position); ARPoint point = new ARPoint { x = screenPosition.x, y = screenPosition.y }; List <ARHitTestResult> hitResults = UnityARSessionNativeInterface.GetARSessionNativeInterface().HitTest(point, ARHitTestResultType.ARHitTestResultTypeExistingPlaneUsingExtent); if (hitResults.Count > 0) { foreach (var hitResult in hitResults) { Vector3 position = UnityARMatrixOps.GetPosition(hitResult.worldTransform); //add createheight to the y below placeLevel = new Vector3(position.x, createHeight, position.z); Vector3 flowerLevel = new Vector3(placeLevel.x, 0, placeLevel.z); flowerNum.text = remainingFlowers + " flowers left"; if (totalBees != 0 && popUp.IsActive() == false && currentFlower < remainingFlowers) { alert.SetActive(false); CreateBall(flowerLevel, twoFlower); currentFlower++; Debug.Log("current flower: " + currentFlower + ", total bees: " + totalBees + ", remaining flowers: " + remainingFlowers); } else if (totalBees == 0 && popUp.IsActive() == false) { // //alert.GetComponentInChildren<Text>().text = "You fed all the bees!"; Debug.Log("SCENE RESET"); SceneManager.LoadScene("Garden"); } else if (keeper.Instance.currentGardenLevel == 4) { // SceneManager.LoadScene("Beez"); } else { Debug.Log("TRY AGAIN"); } break; } } } } #endif }
// Update is called once per frame void Update() { if (passcode.IsActive()) { } else { if (Input.GetKey("w") || Input.GetKey("s") /*|| Input.GetKey("a") || Input.GetKey("d")*/) { anim.SetBool("rolling", true); if (controller.isGrounded) { if (speed < maxSpeed) { speed += acceleration; } } } // else if (Input.GetKey("a") || Input.GetKey("d")) // { // anim.SetBool("rolling", true); // } else { anim.SetBool("rolling", false); if (controller.isGrounded) { speed = baseSpeed; } } if (controller.isGrounded) { particleSys.Stop(); gravity = 4.0f; } moveDirection = transform.forward * Input.GetAxis("Vertical") * speed; //float turn = Input.GetAxis ("Horizontal"); //transform.Rotate (0, turn * turnSpeed * Time.deltaTime, 0); if (controller.isGrounded && Input.GetKeyDown("space")) { vertVel = jumpSpeed; gravity = 30f; particleSys.Play(); if (Input.GetKey("left shift") && mentosJumpsLeft > 0) { StartCoroutine(say("WAHOOOOO", 2)); mentosJumpsLeft -= 1; vertVel *= powerUpScalar; if (powerUp && mentosJumpsLeft <= 0) { //Out of Mentos Jumps powerUpScalar = 1; powerUp.SetActive(true); powerUp = null; } displayMentosText(); } } vertVel -= gravity * Time.deltaTime; moveDirection.y = vertVel; controller.Move(moveDirection * Time.deltaTime); } }
void Start() { dp = FindObjectOfType <DetailPanel>(); gm = FindObjectOfType <GameManager>(); showNNet = NNetSprite.IsActive(); }