private void OnTriggerEnter(Collider other) { DynamicObstacle obstacle = other.GetComponent <DynamicObstacle>(); if (obstacle != null) { obstacle.FlipDirection(); } }