public void Die() { SoundEffectBoard.PlayDeath(); new WaitForSeconds(100); Application.LoadLevel(scene.name); //Destroy(gameObject); }
// Start is called before the first frame update void Start() { if (main == null) { main = this; player = GetComponent <AudioSource>(); } else { Destroy(this.gameObject); } }
public override void OnOverlap(PlayerMovement pm) { HealthSystem health = pm.GetComponent <HealthSystem>(); if (health) { health.TakeDamage(damageAmount); } //TODO add knock-back Vector3 vToPlayer = (pm.transform.position - this.transform.position).normalized; SoundEffectBoard.PlayDeath(); Debug.Log("You fell."); }
public override void OnOverlap(PlayerMovement pm) { HealthSystem health = pm.GetComponent <HealthSystem>(); if (health) { health.TakeDamage(damageAmount); } //TODO add knock-back Vector3 vToPlayer = (pm.transform.position - this.transform.position).normalized; pm.LaunchPlayer(vToPlayer * 20); if (health.health > 25) { SoundEffectBoard.PlayDamage(); } else { SoundEffectBoard.PlayDeath(); } }
/// <summary> /// Calculating Euler physics on y-axis. /// </summary> private void CalcVerticalMovement() { float gravMultiplier = 1; bool wantsToJump = Input.GetButtonDown("Jump"); bool isHoldingJump = Input.GetButton("Jump"); // Jump! if (wantsToJump && isGrounded) { velocity.y = jumpImpulse; isJumpingUpwards = true; isGrounded = false; SoundEffectBoard.PlayJump2(); } if (!isHoldingJump || velocity.y < 0) { isJumpingUpwards = false; } if (isJumpingUpwards) { gravMultiplier = 0.5f; } // apply force of gravity to our velocity velocity.y -= gravity * Time.deltaTime * gravMultiplier; //clamp vertical terminal velocity if (velocity.y < -terminalVelocity) { velocity.y = -terminalVelocity; } }
public override void OnOverlap(PlayerMovement pm) { pm.LaunchPlayer(new Vector3(0, 20, 0)); SoundEffectBoard.PlaySpring(); }
public override void OnOverlap(PlayerMovement pm) { SoundEffectBoard.PlayCoin(); Destroy(this.gameObject); }