Ejemplo n.º 1
0
    private IPassenger _generateOptionPassenger()
    {
        var stations = new List <IStation>();

        _map.GetAllStations(stations);

        StartEndOption option = _getRandomOption();

        int      startIdx = option.Start;
        IStation start    = stations[startIdx];

        int      goalIdx = option.End;
        IStation goal    = stations[goalIdx];

        int            lableIdx      = _map.GetStationIndex(goal);
        IPassengerView passengerView = _passengerViewFactory.MakePassengerView(lableIdx);

        IPassenger newPassenger = new Passenger(start, goal, passengerView);

        if (GeneratePassengerEvent != null)
        {
            GeneratePassengerEvent.Invoke(newPassenger);
        }

        newPassenger.WaitingAtStation(start);

        return(newPassenger);
    }
Ejemplo n.º 2
0
    private IPassenger _genertateRandomPassenger()
    {
        var stations = new List <IStation>();

        _map.GetAllStations(stations);

        int      startIdx = _rand.Next(stations.Count);
        IStation start    = stations[startIdx];

        stations.Remove(start);
        int      goalIdx = _rand.Next(stations.Count);
        IStation goal    = stations[goalIdx];

        int            lableIdx      = _map.GetStationIndex(goal);
        IPassengerView passengerView = _passengerViewFactory.MakePassengerView(lableIdx);

        IPassenger newPassenger = new Passenger(start, goal, passengerView);

        if (GeneratePassengerEvent != null)
        {
            GeneratePassengerEvent.Invoke(newPassenger);
        }

        newPassenger.WaitingAtStation(start);

        return(newPassenger);
    }
Ejemplo n.º 3
0
    public Passenger(IStation start, IStation goal, IPassengerView view)
    {
        _start = start;
        _goal  = goal;
        _rage  = 0;
        _mood  = MoodStatus.Happy;
        _view  = view;

        if (_view != null)
        {
            _view.ChangeToFace1();
        }
    }