void OnCollisionEnter(Collision collisionInfo) { if (collisionInfo.collider.tag == "Obstacle") { movement.enabled = false; FindObjectOfType <GameManager>().EndGame(); dm.IncreaseDeaths(); } }
// We marked this as "Fixed Update because we are using it to mess with physics void FixedUpdate() { rb.AddForce(0, 0, forwardForce * Time.deltaTime); // *deltaTime allows us to balance it no matter what your FPS is if (Input.GetKey("d")) { rb.AddForce(sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange); } if (Input.GetKey("a")) { rb.AddForce(-sidewaysForce * Time.deltaTime, 0, 0, ForceMode.VelocityChange); } if (rb.position.y < -1f) { FindObjectOfType <GameManager>().EndGame(); dm.IncreaseDeaths(); } }
public override void Execute() { dm = GameObject.FindObjectOfType <DeathManager>(); var player = model.player; if (player.health.IsAlive) { player.health.Die(); model.virtualCamera.m_Follow = null; model.virtualCamera.m_LookAt = null; // player.collider.enabled = false; player.controlEnabled = false; if (player.audioSource && player.ouchAudio) { player.audioSource.PlayOneShot(player.ouchAudio); } player.animator.SetTrigger("hurt"); player.animator.SetBool("dead", true); Simulation.Schedule <PlayerSpawn>(2); dm.IncreaseDeaths(); } }