// the player collided with an obstacle, play some particle effects public void ObstacleCollision(Transform obstacle, Vector3 position) { if (!enabled) { return; } // Make sure the particle system is active if (!collisionParticleSystem.gameObject.activeSelf) { collisionParticleSystem.gameObject.SetActive(true); } collisionParticleSystem.transform.position = position; collisionParticleSystem.transform.parent = obstacle; collisionParticleSystem.Clear(); collisionParticleSystem.Play(); // stumble if (stumbleDuration > 0) { isStumbling = true; stumbleData.duration = stumbleDuration; StartCoroutine("Stumble"); } // camera shake cameraController.Shake(); }