예제 #1
0
        public bool Select(ModelStation station)
        {
            bool modelSent = false;

            if (mModel != null)
            {
                modelSent = true;
                mModel.GoToStation(station);
                ClearSelection();
            }
            return(modelSent);
        }
        /// <summary>
        /// Transition to the state that corresponds with 'stand at the given station'
        /// </summary>
        public void TransitionToStayAtStation(ModelStation station)
        {
            AtStationState state;

            if (mAtStationStates.TryGetValue(station, out state))
            {
                this.TransitionToState(state);
            }
            else
            {
                throw new ArgumentException("Station not needed by this Model", "station");
            }
        }
예제 #3
0
        public AtStationState(FashionModel model, ModelStation station)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            mModel = model;

            if (station == null)
            {
                throw new ArgumentNullException("station");
            }
            mStation = station;
        }
        /// <summary>
        /// Transition to the state that corresponds with 'Walk to the given station'
        /// </summary>
        /// <returns>True when the model needed this station, False otherwise</returns>
        public bool TransitionToWalkToStation(ModelStation station)
        {
            WalkToStationState state;
            bool result = false;

            if (mWalkToStationStates.TryGetValue(station, out state))
            {
                this.TransitionToState(state);
                result = true;
            }
            else if (station is HoldingStation)
            {
                throw new Exception("Models should always have states for going to a HoldingStation until they're completed.");
            }
            return(result);
        }
예제 #5
0
        public void GoToStation(ModelStation station)
        {
            if (mNeeds != null)
            {
                mStationInUseAtStartWalk = false;

                // Might not actually transition if the avatar doesn't need this station
                if (mStateMachine.TransitionToWalkToStation(station))
                {
                    if (station.InUse)
                    {
                        mStationInUseAtStartWalk = true;
                    }
                }
            }
        }
예제 #6
0
        public void ArrivedAtStation(ModelStation station)
        {
            if (mNeeds != null)
            {
                if (mStationInUseAtStartWalk && !station.InUse)
                {
                    GameFacade.Instance.SendNotification
                    (
                        FashionMinigame.EARNED_EXPERIENCE_NOTIFICATION,
                        new ExperienceInfo
                        (
                            ExperienceType.CloseSave,
                            station.UnityGameObject.transform.position + Vector3.up
                        )
                    );
                }

                IWidget widget;
                if (station.InUse)
                {
                    // Play a gentle error sfx
                    if (mErrorSfx != null)
                    {
                        AudioSource.PlayClipAtPoint(mErrorSfx, station.UnityGameObject.transform.position, 0.8f);
                    }
                    mStateMachine.TransitionToState(mStateMachine.WalkToCenterState);
                }
                else if (station is HoldingStation)
                {
                    mStateMachine.TransitionToStayAtStation(station);
                }
                else if (mDesiredStations.TryGetValue(station, out widget))
                {
                    mStationInUseAtStartWalk = station.InUse;
                    mDesiredClothingFrame.RemoveChildWidget(widget);
                    mDesiredStations.Remove(station);
                    mNeeds.Remove(station);

                    mStateMachine.TransitionToStayAtStation(station);
                    mStateMachine.RemoveStation(station);
                }
            }
        }
예제 #7
0
        public WalkToStationState(FashionModel model, ModelStation station, FashionLevel level)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            mModel = model;

            if (station == null)
            {
                throw new ArgumentNullException("station");
            }
            mStation = station;

            if (level == null)
            {
                throw new ArgumentNullException("level");
            }
            mLevel = level;
        }
        /// <summary>
        /// Called when an avatar completes a station, this will remove that station's states
        /// </summary>
        public void RemoveStation(ModelStation station)
        {
            if (station is HoldingStation)
            {
                // Holding stations don't need to be removed
                return;
            }

            WalkToStationState thisStationWalkState = mWalkToStationStates[station];

            mAtStationStates.Remove(station);
            mWalkToStationStates.Remove(station);

            foreach (WalkToStationState walkState in mWalkToStationStates.Values)
            {
                walkState.RemoveTransition(thisStationWalkState);
            }

            mWalkToCenterState.RemoveTransition(thisStationWalkState);
            mWalkToEndGoalState.RemoveTransition(thisStationWalkState);
        }
예제 #9
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);
        }
예제 #10
0
 public void Remove(ModelStation station)
 {
     mStations.Remove(station);
     CheckComplete();
 }
예제 #11
0
 public void Add(ModelStation station)
 {
     mStations.Add(station);
 }