void OnTriggerEnter(Collider other) { TrainController train = other.GetComponent <TrainController>(); if (train != null) { train.GoToNextTarget(); /* * float horizontalAxis = Input.GetAxis("Horizontal"); * RotationalWaypoint nextWaypoint = null; * * if (horizontalAxis < 0 && leftPoint != null) * nextWaypoint = leftPoint; * else if (horizontalAxis > 0 && rightPoint != null) * nextWaypoint = rightPoint; * else * nextWaypoint = forwardPoint; * * train.waypointTarget = nextWaypoint; */ } /* * Transform otherTrans = other.transform; * * Vector3 rotToApply = transform.rotation.eulerAngles; * rotToApply.y -= 90; * * otherTrans.rotation = Quaternion.Euler(rotToApply); */ //PlayerMovement pm = other.GetComponent<PlayerMovement>(); //pm.HandleAutomaticMovement(); }