void TeleportToOtherDoor(GameObject plr) { if (Input.GetButtonDown("Interact")) { if (switchToVoid && soundDirector != null) { soundDirector.play(SoundDirector.Mode.teleport); } //otherDoor.SetActive(true); director.switchWorlds(otherDoor); //director.SaveCheckpoint(); GameObject obj = Instantiate(TeleportParticleEffect, otherDoor.transform.position, TeleportParticleEffect.transform.rotation) as GameObject; //set the particle's rendering to visible against sprites obj.particleSystem.renderer.sortingLayerName = this.renderer.name; obj.renderer.sortingOrder = 2; // if (shrink.isOnTheVoid) //if we're on the void, set the current teleporter to the current respawn postions. // director.respawnPos = this.transform; //StartCoroutine(DeactiveCurrentGameObjectAfterTwoSeconds()); plr.transform.position = otherDoor.transform.position; } }
void OnTriggerStay2D(Collider2D col) { if (col.tag == "Player") { if (flashNow) { flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.activateMessage, flashMessage); } if (Input.GetButtonDown("Interact")) { soundDirector.play(SoundDirector.Mode.eventSuccess); for (int i = 0; i < poweredUpObjects.Length; i++) { poweredUpObjects[i].SendMessage("TurnPowerOn"); } hintbox.UseMessageBox(gameObject, HintBoxController.Mode.activateMessage, messageText); hasActivated = true; flashText.UseFlashMsg(gameObject, FlashingTextController.Mode.permanentlyDeactivateFlash, ""); flashNow = false; } } }
void OnPickup() { if (eventToActivate != null) { eventToActivate.SendMessage("PuzzlePiecePickedUp"); } //disable the hintbox for this puzzlePiece soundDirector.play(SoundDirector.Mode.pickup); hintbox.UseMessageBox(this.gameObject, HintBoxController.Mode.permanentlyDeactivateBox, ""); }
void OpenDoor() { if (YellowDoor) { transform.Rotate(0f, 180f, 0f); transform.position += Vector3.right * 6.65f; } else { unlockedDoor.enabled = true; } isClosed = false; hasAlreadyInteracted = true; soundDirector.play(SoundDirector.Mode.unlock); gameObject.collider2D.enabled = false; gameObject.GetComponent <BoxCollider2D> ().enabled = false; print("disabled collider"); }
//if all puzzle pieces are fixed, then display the painting. In this level, the game is finished IEnumerator DisplayPainting(int time) { yield return(new WaitForSeconds(time)); if (totalPiecesLeft == 0) { soundDirector.play(SoundDirector.Mode.success); if (this.gameObject.GetComponent <SpriteRenderer> ()) { this.gameObject.GetComponent <SpriteRenderer> ().enabled = true; } else { GetComponentInChildren <SpriteRenderer>().enabled = true; } director.FinishedLevel(); } }
void PlaySound() { //audio.clip = bell; //audio.Play (); soundDirector.play(SoundDirector.Mode.elevatorArrival); }