public void OnTriggerEnter(Collider col) { ColliderButtonL2 colliderOtroBtn = theOtherButton.GetComponent <ColliderButtonL2>(); if (col.tag == "ObjectInButton") { this.gameObject.GetComponent <Renderer>().material.color = Color.green; InventarioScript inventario = player.GetComponent <InventarioScript>(); //Abrir nivel 2 y vaciar inventario inventario.objetoEnInventario = null; activado = true; audioBtn.PlayOneShot(audioBtn.clip); if (colliderOtroBtn.activado) { this.gameObject.GetComponent <Renderer>().material.color = Color.green; activado = true; AbrirPuertaNivel2(); } } else if (col.tag == "Player") { audioClick.PlayOneShot(audioClick.clip); activado = true; if (colliderOtroBtn.activado) { this.gameObject.GetComponent <Renderer>().material.color = Color.green; activado = true; AbrirPuertaNivel2(); } } }
public override void HaSidoMirado() { InventarioScript inventario = player.GetComponent <InventarioScript>(); if (inventario.objetoEnInventario != null) { if (inventario.objetoEnInventario.tag == this.gameObject.tag) { GameObject piezaEscaleraInventario = inventario.objetoEnInventario; GameObject copiaPiezaEscalera = Instantiate(piezaEscaleraInventario); copiaPiezaEscalera.SetActive(true); copiaPiezaEscalera.transform.position = new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y + 1f, this.gameObject.transform.position.z); copiaPiezaEscalera.gameObject.tag = "ObjectInButton"; //Eliminar collider y Gvr Pointer Graphic Raycaster de la pieza para que no se pueda interaccionar con ella ColliderLowPolyBox colliderBox = copiaPiezaEscalera.GetComponent <ColliderLowPolyBox>(); GvrPointerGraphicRaycaster grvPointer = copiaPiezaEscalera.GetComponent <GvrPointerGraphicRaycaster>(); Destroy(colliderBox); Destroy(grvPointer); copiaPiezaEscalera.GetComponent <Renderer>().material.color = Color.white; planeActivated = true; //Vaciado de inventario inventario.objetoEnInventario = null; CheckForFullStair(); this.gameObject.SetActive(false); //TODO congelar posición "y" con una task con delay después de hacer el deploy a 1 metro } } }
public override void HaSidoMirado() { InventarioScript inventario = player.GetComponent <InventarioScript>(); inventario.NuevoObjetoEnInventario(objetoMirado); this.gameObject.GetComponent <Renderer>().material.color = Color.green; }
public override void HaSidoMirado() { InventarioScript inventario = player.GetComponent <InventarioScript>(); if (inventario.objetoEnInventario != null) { if (inventario.objetoEnInventario.tag == this.gameObject.tag) { audioHole.PlayOneShot(audioHole.clip); isActivated = true; GameObject objetoADuplicar = inventario.objetoEnInventario; GameObject copiaObjeto = Instantiate(objetoADuplicar); copiaObjeto.SetActive(true); copiaObjeto.transform.position = new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y + 2, this.gameObject.transform.position.z); ColliderLowPolyBox colliderBox = copiaObjeto.GetComponent <ColliderLowPolyBox>(); copiaObjeto.GetComponent <Renderer>().material.color = Color.white; Destroy(colliderBox); GvrPointerGraphicRaycaster gaze = copiaObjeto.GetComponent <GvrPointerGraphicRaycaster>(); Destroy(gaze); GvrPointerPhysicsRaycaster physicsRaycaster = copiaObjeto.GetComponent <GvrPointerPhysicsRaycaster>(); Destroy(physicsRaycaster); CheckForRoomSolved(); inventario.objetoEnInventario = null; } } }
void Start() { inventario = (InventarioScript)FindObjectOfType(typeof(InventarioScript)); anim = blackImage.GetComponent <Animator>(); StartCoroutine(FadeIn()); isGameOver = false; }
public void AbrirPuertaSala5() { InventarioScript inventario = player.GetComponent <InventarioScript>(); inventario.CambiarTexto("Sala 5 superada!"); puertaSala5.transform.Rotate(0, 0, -90); Movimiento scriptMovimiento = player.GetComponent <Movimiento>(); //scriptMovimiento.playerSpeed = 7; scriptMovimiento.isMoving = false; }
private void OpenDoorRoom1() { InventarioScript inventario = player.GetComponent <InventarioScript>(); inventario.CambiarTexto("Sala 3 superada!"); doorRoom1Level2.transform.Rotate(0, 0, -90); Movimiento scriptMovimiento = player.GetComponent <Movimiento>(); scriptMovimiento.isMoving = false; audioPuerta.PlayOneShot(audioPuerta.clip); }
private void AbrirPuertaSala3() { InventarioScript inventario = player.GetComponent <InventarioScript>(); inventario.CambiarTexto("Sala 3 superada!"); puertaSala3.transform.Rotate(0, 0, -90); Movimiento scriptMovimiento = player.GetComponent <Movimiento>(); scriptMovimiento.isMoving = false; audioPuerta.Play(); }
public void OnTriggerEnter(Collider col) { //Comprobar la tag del objeto con el que ha colisionado if (col.tag == "ObjectInButton") { audioBtn.PlayOneShot(audioBtn.clip); this.gameObject.GetComponent <Renderer>().material.color = Color.green; finalizado = true; InventarioScript inventario = player.GetComponent <InventarioScript>(); //Abrir nivel 2 y vaciar inventario inventario.CambiarTexto("Nivel 1 superado!"); inventario.objetoEnInventario = null; AbrirPuertaNivel1(); } }
public void OnTriggerEnter(Collider col) { if (col.tag == "Player" && !levelFinished) { levelFinished = true; GameObject player = GameObject.FindWithTag("Player"); GameObject doorRoom2Level2 = GameObject.FindWithTag("DoorRoom3Level2"); AudioSource audioPuerta = doorRoom2Level2.GetComponent <AudioSource>(); InventarioScript inventario = player.GetComponent <InventarioScript>(); inventario.CambiarTexto("Nivel superado!"); doorRoom2Level2.transform.Rotate(0, 0, -90); Movimiento scriptMovimiento = player.GetComponent <Movimiento>(); scriptMovimiento.isMoving = false; audioPuerta.PlayOneShot(audioPuerta.clip); } }
private UIPlayerScript uiPlayer; //Acceso al UI del jugador private void OnTriggerEnter(Collider other) { if (other.tag == "Player") //El collider detecto al jugador? { InventarioScript inventario = other.GetComponent <InventarioScript>(); //Se accede al inventario del jugador uiPlayer = other.GetComponent <UIPlayerScript>(); //Se obtiene el UI if (inventario.currentItem != null) //El jugador tiene un objeto en su inventario? { if (inventario.currentItem.CompareTag("Bidon")) //Dicho objeto es el bidon? { boton.SetActive(true); //Se muestra el boton de interaccion bidon = inventario.currentItem.GetComponent <BidonScript>(); //Se obtiene el script del bidon } } } }
public override void HaSidoMirado() { InventarioScript inventario = player.GetComponent <InventarioScript>(); if (inventario.objetoEnInventario != null) { //Copiar cubo y poner el nuevo encima del botón GameObject cuboInventario = inventario.objetoEnInventario; GameObject copiaCubo = Instantiate(cuboInventario); copiaCubo.SetActive(true); copiaCubo.transform.position = new Vector3(objetoMirado.transform.position.x, objetoMirado.transform.position.y + 2, objetoMirado.transform.position.z); copiaCubo.gameObject.tag = "ObjectInButton"; //Eliminar collider del nuevo cubo para que no se pueda interaccionar con él ColliderLowPolyBox colliderBox = copiaCubo.GetComponent <ColliderLowPolyBox>(); Destroy(colliderBox); } }
public override void HaSidoMirado() { InventarioScript inventario = player.GetComponent <InventarioScript>(); if (inventario.objetoEnInventario != null) { GameObject cuboInventario = inventario.objetoEnInventario; GameObject copiaCubo = Instantiate(cuboInventario); copiaCubo.SetActive(true); copiaCubo.transform.position = new Vector3(foso.transform.position.x, foso.transform.position.y + 2, foso.transform.position.z); copiaCubo.gameObject.tag = "ObjectInHole"; ColliderLowPolyBox colliderBox = copiaCubo.GetComponent <ColliderLowPolyBox>(); Destroy(colliderBox); GvrPointerGraphicRaycaster gaze = copiaCubo.GetComponent <GvrPointerGraphicRaycaster>(); Destroy(gaze); } }
public void OnTriggerEnter(Collider col) { if (col.tag == "Player") { if (this.gameObject.tag == "FinalPlatform" && !isActivated) { isActivated = true; GameObject player = GameObject.FindWithTag("Player"); GameObject doorRoom2Level2 = GameObject.FindWithTag("DoorRoom2Level2"); AudioSource audioPuerta = doorRoom2Level2.GetComponent <AudioSource>(); InventarioScript inventario = player.GetComponent <InventarioScript>(); inventario.CambiarTexto("Sala 2 superada!"); doorRoom2Level2.transform.Rotate(0, 0, -90); Movimiento scriptMovimiento = player.GetComponent <Movimiento>(); scriptMovimiento.isMoving = false; audioPuerta.PlayOneShot(audioPuerta.clip); landingSound.Play(); } else if (this.gameObject.tag != "FinalPlatform") { landingSound.Play(); } } }