Пример #1
0
 public void SpawnItem(Requirements reqs)
 {
     Debug.Log(reqs.hasEngine);
     Debug.Log(reqs.numberOfEngines);
     Debug.Log(reqs.numberOfWings);
     if (reqs.hasEngine)
     {
         aircraftFactory.ManufacturePoweredAircraft(reqs);
     }
     else
     {
         gliderFactory.ManufactureGlider(reqs);
     }
 }
Пример #2
0
    //public GliderFactory gliderFactory;
    //public AircraftFactory aircraftFactory;
    //public RocketFactory rocketFactory;

    public IPlane createItem(Requirements reqs)
    {
        if (reqs.rocket)
        {
            RocketFactory rocketFactory = new RocketFactory();
            return(rocketFactory.ManufactureRocket(reqs));
        }
        else if (reqs.numberOfEngines > 0)
        {
            AircraftFactory aircraftFactory = new AircraftFactory();
            return(aircraftFactory.ManufacturePoweredAircraft(reqs));
        }
        else
        {
            GliderFactory gliderFactory = new GliderFactory();
            return(gliderFactory.ManufactureGlider(reqs));
        }
    }