public void BuildStation(string type, Pair <Vector3> location, string name, Action <FashionGameStation> onResult) { if (onResult == null) { throw new ArgumentNullException("onResult"); } FashionGameStation resultStation = null; if (!mStationInfos.ContainsKey(type)) { throw new Exception("Unexpected station type (" + type + "). Stations can only be of types defined in " + STATION_DESCRIPTION_PATH); } StationInfo info = mStationInfos[type]; Texture2D stationIcon = null; if (info.ImagePath != null) { stationIcon = (Texture2D)Resources.Load(info.ImagePath); } switch (type) { case "Holding": resultStation = new HoldingStation(location, name, info.Time, info.GuiOffset, info.InstantiateAssets()); break; case "Sewing": resultStation = new TailorStation(location, name, stationIcon, info.Time, info.GuiOffset, info.InstantiateAssets()); break; case "Hair": if (stationIcon == null) { throw new Exception("Unable to load the texture at " + info.ImagePath); } resultStation = new HairStation(location, name, stationIcon, info.Time, info.GuiOffset, info.InstantiateAssets()); break; case "Makeup": if (stationIcon == null) { throw new Exception("Unable to load the texture at " + info.ImagePath); } resultStation = new MakeupStation(location, name, stationIcon, info.Time, info.GuiOffset, info.InstantiateAssets()); break; } // If this station requires late bound animations or sounds, load them, otherwise just return the station if (info.SoundPaths.Count > 0 || info.WorkingAnimationPath != null || info.IdleAnimationPath != null) { GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler.StartCoroutine(LoadExternalAssetsForStation(info, resultStation, onResult)); } else { onResult(resultStation); } }