Example #1
0
        public Tram removeTram()
        {
            Tram tram = null;

            for (int i = 0; i < reserved.Count; i++)
            {
                if (reserved[i].working)
                {
                    tram = reserved[i];
                    reserved.RemoveAt(i);
                    break;
                }
            }

            if (tram == null)
            {
                for (int i = 0; i < trams.list.Count; i++)
                {
                    if (trams.list[i].working)
                    {
                        tram = trams.list[i];
                        tram.resetRoute();
                        break;
                    }
                }
            }

            if (tram != null)
            {
                trams.remove(tram);
                tram.removed = true;
            }

            return(tram);
        }
Example #2
0
        // Перемещает трамвай в резерв
        public void moveToReserved(Tram tram)
        {
            if (!reserved.Contains(tram))
            {
                reserved.Add(tram);
            }

            tram.resetRoute();
        }