Example #1
0
    // Call by button and show buttons on available tracks to choose
    public void OnArrivalAccept(Notification callingNote)
    {
        ResetTracksUI();

        var atLeastOneFree = false;

        foreach (var track in Tracks)
        {
            var isFree = track.ShowAvailability();
            if (!atLeastOneFree && isFree)
            {
                atLeastOneFree = true;
            }
        }

        if (atLeastOneFree)
        {
            // Destroy notification
            callingNote.DestroyNotification();

            // Unsubscribe from note click action
            callingNote.OnClick -= OnArrivalAccept;

            // Get vehicle from schedule
            acceptedVehicle = Schedule.AcceptScheduledVehicle();
        }
    }