Ejemplo n.º 1
0
    public Passenger Instantiate(HousingCar car, PassengerData passengerData)
    {
        Passenger passenger = Instantiate(passengerData);
        Vector3   position  = passengerPrefab.transform.position;

        position.x = car.transform.position.x;
        passenger.transform.position = position;
        return(passenger);
    }
Ejemplo n.º 2
0
 public void Enable(Family[] families, HousingCar car)
 {
     carData = car;
     selectedFamilyPanels.Clear();
     UpdateTitle();
     Populate(families);
     inviteButton.interactable = false;
     gameObject.SetActive(true);
 }
Ejemplo n.º 3
0
    public HousingCar GetOpenCar()
    {
        List <Car>        sleepCars   = cars.FindAll(element => element.type == CarType.Housing);
        List <HousingCar> housingCars = new List <HousingCar>();

        foreach (Car car in sleepCars)
        {
            HousingCar housingCar = (HousingCar)car;
            housingCars.Add(housingCar);
        }

        HousingCar emptyCar = housingCars.Find(element => element.NumberOfOccupants < element.MaximumNumberOfOccupants);

        return(emptyCar);
    }
Ejemplo n.º 4
0
    public bool HasOpenCar()
    {
        List <Car> sleepCars      = cars.FindAll(element => element.type == CarType.Housing);
        int        familySpaces   = 0;
        int        occupiedSpaces = 0;

        sleepCars.ForEach(element =>
        {
            HousingCar housingCar = (HousingCar)element;
            familySpaces         += housingCar.MaximumNumberOfOccupants;
            occupiedSpaces       += housingCar.NumberOfOccupants;
        });

        return(occupiedSpaces < familySpaces);
    }
Ejemplo n.º 5
0
    public IEnumerator ShowFamilySelectionDialogue()
    {
        // If there is an empty Car
        if (CarManager.instance.HasOpenCar())
        {
            ChoosingFamily = true;
            car            = CarManager.instance.GetOpenCar();
            if (car)
            {
                // Create enough families
                Family[] families = FamilyFactory.instance.Create(car.travelClass, 4);
                // Pass them to the UI

                familyUi.Enable(families, car);
                // While selection dialoge is open
                while (ChoosingFamily)
                {
                    yield return(null);
                }

                car = null;
            }
        }
    }