Beispiel #1
0
    public virtual void ConnectToRail(List <RailSegment> railSegments)
    {
        Rail r = railSegments.FirstOrDefault()?.parentRail;

        if (r != null)
        {
            ConnectToRail(r);
            if (AttachedRail != null)
            {
                RailIndex = AttachedRail.GetTargetIndex(railSegments, transform.position);
                SetTarget();

                if (centerOnRailRoutine != null)
                {
                    StopCoroutine(centerOnRailRoutine);
                }
                centerOnRailRoutine = StartCoroutine(CenterOnRail());
            }
        }
    }