void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { VibrateController.vibrateControllerForXSeconds(0.1f, 0.7f, 0.7f); print(audioSource.name); if (audioSource != null) { audioSource.Play(); } other.GetComponent <Player_Movement>().addDirectionalForce(this.transform.up, force, jumpTime); GetComponent <Animator>().SetTrigger("Triggered"); } else if (other.CompareTag("Box")) { print(audioSource.name); if (audioSource != null) { audioSource.Play(); } other.GetComponent <BoxBounce>().addDirectionalForce(this.transform.up, force * 1.2f); GetComponent <Animator>().SetTrigger("Triggered"); } }
public void newCutscene(Vector2 finalPosition, float pan_duration, float stay_duration, Player_EnterDoors linkedDoor) { VibrateController.vibrateControllerForXSeconds(pan_duration + stay_duration, 0, 0); Time.timeScale = 0; inCutscene = true; StartCoroutine(panCamera(this.transform.position, Time.realtimeSinceStartup, finalPosition, pan_duration, stay_duration, linkedDoor)); }
void OnTriggerEnter2D(Collider2D coll) { if (coll.gameObject.name == "Player Prefab") { coll.GetComponent <Checkpoint_Handler>().returnToLastCheckpoint(); GameObject.Find("DeathScreen").GetComponent <Animator>().SetTrigger("Die"); VibrateController.vibrateControllerForXSeconds(0.5f, 0.3f, 0.3f); } }
protected override void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Box")) { VibrateController.vibrateControllerForXSeconds(0.2f, 0.6f, 0.6f); other.gameObject.SetActive(false); childTrigger(); if (this.GetComponent <TriggerCutscene>() != null) { this.GetComponent <TriggerCutscene>().trigger(); } } }
void handleJumpInput1() { if (!alreadyPressedJump && !inTrampolin && MyInput.GetJump()) { if (grounded /*|| !jumpedTwice*/) { //if (!grounded) { // jumpedTwice = true; // Jump (); //} else { singleStompSource.pitch = 0.8f; singleStompSource.Play(); Jump(); VibrateController.vibrateControllerForXSeconds(0.05f, 0.2f, 0.2f); //anim.SetBool ("Ground", false); //} } else if (CanWallJump && !alreadyWallJumped) { if (huggingFrontWall) { JumpBackward(); alreadyWallJumped = true; } else if (huggingBackWall) { JumpForward(); alreadyWallJumped = true; } else { jumpNext = true; } } } }