Example #1
0
        public FashionModel GetModel(FashionLevel level, FashionModelNeeds needs, string type)
        {
            FashionModelInfo modelTypeInfo = mFashionModelTypes[type];
            FashionModel     resultModel   = mFashionModels.GetNpc();

            resultModel.SetActive(needs, level);
            resultModel.WalkSpeed = modelTypeInfo.Speed;
            resultModel.UnityGameObject.SetActiveRecursively(true);

            return(resultModel);
        }
Example #2
0
        public FashionNpcMediator()
        {
            XmlDocument modelsXmlDoc = XmlUtility.LoadXmlDocument(MODEL_TYPES_PATH);

            foreach (XmlNode modelInfoNode in modelsXmlDoc.SelectNodes("//Model"))
            {
                FashionModelInfo info = new FashionModelInfo(modelInfoNode);
                mFashionModelTypes.Add(info.Name, info);
            }

            mScheduler = GameFacade.Instance.RetrieveMediator <SchedulerMediator>().Scheduler;
            mActiveTasks.Add(mScheduler.StartCoroutine(LoadAnimations(modelsXmlDoc)));
        }
Example #3
0
        private FashionModelNeeds BuildNeedsFromInfo(FashionModelInfo info, IEnumerable <ModelStation> modelStations)
        {
            FashionModelNeeds result = new FashionModelNeeds();
            int clothingNeeds        = mRand.Next(info.ClothingNeeds.Low, info.ClothingNeeds.High + 1);
            int stationNeeds         = mRand.Next(info.StationNeeds.Low, info.StationNeeds.High + 1);

            ClothingMediator    clothingMediator = GameFacade.Instance.RetrieveMediator <ClothingMediator>();
            List <ModelStation> stations         = new List <ModelStation>();

            foreach (ModelStation station in modelStations)
            {
                if (!(station is HoldingStation))
                {
                    stations.Add(station);
                }
            }

            List <string> clothingTypes = new List <string>(clothingMediator.ClothingItemTypes);

            // Setup Clothing Needs
            for (int i = 0; i < clothingNeeds; ++i)
            {
                string clothingType = clothingTypes[mRand.Next(0, clothingTypes.Count)];
                clothingTypes.Remove(clothingType);

                foreach (Pair <string> synonym in mSynonyms)
                {
                    if (synonym.First == clothingType)
                    {
                        clothingTypes.Remove(synonym.Second);
                    }
                    else if (synonym.Second == clothingType)
                    {
                        clothingTypes.Remove(synonym.First);
                    }
                }

                List <ClothingItem> clothesForThisType = new List <ClothingItem>(clothingMediator.ClothingForType(clothingType));
                if (clothesForThisType.Count == 0)
                {
                    continue;
                }

                ItemId clothing = clothesForThisType[mRand.Next(0, clothesForThisType.Count)].ItemId;
                result.Add(clothing);

                if (clothingTypes.Count == 0)
                {
                    break;
                }
            }

            // Setup Station Needs
            if (stations.Count != 0)
            {
                for (int i = 0; i < stationNeeds; ++i)
                {
                    ModelStation station = stations[mRand.Next(0, stations.Count)];

                    string stationName = station.Name;
                    stations.RemoveAll(delegate(ModelStation stationInList)
                    {
                        return(stationInList.Name == stationName);
                    });

                    result.Add(station);

                    if (stations.Count == 0)
                    {
                        break;
                    }
                }
            }

            result.NeedFixinChance = info.NeedFixinChance;

            return(result);
        }
Example #4
0
        public FashionModelNeeds BuildNeedsForType(string modelType, IEnumerable <ModelStation> modelStations)
        {
            FashionModelInfo modelInfo = mFashionModelTypes[modelType];

            return(BuildNeedsFromInfo(modelInfo, modelStations));
        }