Exemplo n.º 1
0
 public AirlineAirportFacilityMVVM(AirlineAirportFacility facility, Alliance alliance)
 {
     Facility = facility;
     Alliance = alliance;
     IsHuman = GameObject.GetInstance().HumanAirline == facility.Airline;
     IsDelivered = facility.FinishedDate < GameObject.GetInstance().GameTime;
 }
Exemplo n.º 2
0
 //sets the facility for an airline
 public void AddAirportFacility(AirlineAirportFacility facility)
 {
     //this.Facilities.RemoveAll(f => f.Airline == facility.Airline && f.Facility.Type == facility.Facility.Type);
     _facilities.Add(facility);
 }
Exemplo n.º 3
0
        public void addAirlineFacility(AirportFacility facility)
        {
            var nextFacility = new AirlineAirportFacility(
                GameObject.GetInstance().HumanAirline,
                Airport,
                facility,
                GameObject.GetInstance().GameTime.AddDays(facility.BuildingDays));
            Airport.AddAirportFacility(nextFacility);

            /*
            AirlineAirportFacilityMVVM currentFacility = this.AirlineFacilities.Where(f => f.Facility.Facility.Type == facility.Type).FirstOrDefault();

            if (currentFacility != null)
                removeAirlineFacility(currentFacility);

            Alliance alliance = nextFacility.Airline.Alliances.Count == 0 ? null : nextFacility.Airline.Alliances[0];

            this.AirlineFacilities.Add(new AirlineAirportFacilityMVVM(nextFacility,alliance));
             * */
            AirlineFacilities.Clear();
            BuildingAirlineFacilities.Clear();

            foreach (
                AirlineAirportFacility tFacility in Airport.GetAirportFacilities().FindAll(f => f.Airline != null))
            {
                if (tFacility.Facility.TypeLevel != 0)
                {
                    Alliance alliance = tFacility.Airline.Alliances.Count == 0 ? null : tFacility.Airline.Alliances[0];

                    var airlineFacility = new AirlineAirportFacilityMVVM(tFacility, alliance);

                    if (airlineFacility.IsDelivered)
                    {
                        AirlineFacilities.Add(airlineFacility);
                    }
                    else
                    {
                        BuildingAirlineFacilities.Add(airlineFacility);
                    }
                }
            }
        }