예제 #1
0
        public FashionLevel(string levelDataPath, FashionNpcMediator fashionNpcMediator, bool firstTimePlayed, float requiredEnergy)
        {
            mScheduler = GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler;

            mLevelXmlPath = levelDataPath;
            mLevelXml     = XmlUtility.LoadXmlDocument(mLevelXmlPath);

            XmlNode backgroundNode = mLevelXml.SelectSingleNode("Level/RunwayBackground");

            if (backgroundNode != null)
            {
                mRunwayBackgroundPath = backgroundNode.InnerText;
            }
            else
            {
                Debug.LogError("No background url node in level xml.");
            }

            XmlNode locationNode = mLevelXml.SelectSingleNode("Level/LocationName");

            if (backgroundNode != null)
            {
                mLocationName = locationNode.InnerText;
            }
            else
            {
                Debug.LogError("No location node in level xml.");
            }

            XmlNode runwayMusicNode = mLevelXml.SelectSingleNode("Level/RunwayMusic");

            if (runwayMusicNode != null)
            {
                mRunwayMusicPath = runwayMusicNode.InnerText;
            }
            else
            {
                Debug.LogError("No runway music node in level xml.");
            }

            XmlNode levelAssetsPath = mLevelXml.SelectSingleNode("Level/@path");

            if (levelAssetsPath == null)
            {
                throw new Exception("Cannot load level from " + levelDataPath + ", no Level/@path attribute found.");
            }

            ClientAssetRepository clientAssetRepo = GameFacade.Instance.RetrieveProxy <ClientAssetRepository>();

            clientAssetRepo.LoadAssetFromPath <UnityEngineAsset>(levelAssetsPath.InnerText, BuildLevelAssets);

            XmlNode startNode = mLevelXml.SelectSingleNode("Level/ModelSpawn");

            mStartWidth     = float.Parse(startNode.Attributes["width"].InnerText);
            mEnd            = XmlUtility.ParsePositionDirection(mLevelXml.SelectSingleNode("Level/ModelDrain"));
            mEndWidth       = float.Parse(startNode.Attributes["width"].InnerText);
            mName           = mLevelXml.SelectSingleNode("Level/@name").InnerText;
            mStart          = XmlUtility.ParsePositionDirection(startNode);
            mModelsRequired = int.Parse(mLevelXml.SelectSingleNode("Level/Waves/@requiredModels").InnerText);

            mLevelGui = new LevelGui(mLevelXml, this);
            if (fashionNpcMediator == null)
            {
                throw new ArgumentNullException("fashionModelMediator");
            }
            mFashionNpcMediator = fashionNpcMediator;
            mLevelGameplay      = new LevelGameplay(mLevelXml, this, mFashionNpcMediator);
            mFirstTimePlayed    = firstTimePlayed;

            mRequiredEnergy = requiredEnergy;
        }
예제 #2
0
 public ClosureBugWorkaround(FashionModel model, LevelGameplay level)
 {
     mModel         = model;
     mLevelGameplay = level;
 }