Exemplo n.º 1
0
        public DateModel CreateRandomModel()
        {
            DateModel model = new DateModel();

            model.hairType  = Random.Range(0, 3);
            model.hairColor = Random.Range(0, colorMap.Count);
            model.topType   = Random.Range(0, 1);
            model.topColor  = Random.Range(0, colorMap.Count);
            model.botType   = Random.Range(0, 2);
            model.botColor  = Random.Range(0, colorMap.Count);

            model.firstNameIdx = Random.Range(0, firstNames.Count);
            model.firstName    = firstNames[model.firstNameIdx];

            model.birthMonthIdx = Random.Range(0, birthMonths.Count);
            model.birthMonth    = birthMonths[model.birthMonthIdx];

            model.hobbyIdx = Random.Range(0, hobbies.Count);
            model.hobby    = hobbies[model.hobbyIdx];

            model.bloodTypeIdx = Random.Range(0, bloodTypes.Count);
            model.bloodType    = bloodTypes[model.bloodTypeIdx];

            model.homeTownIdx = Random.Range(0, homeTowns.Count);
            model.homeTown    = homeTowns[model.homeTownIdx];

            model.movieIdx = Random.Range(0, movies.Count);
            model.movie    = movies[model.movieIdx];

            return(model);
        }
Exemplo n.º 2
0
 public bool IsAppearanceTheSame(DateModel other)
 {
     return(hairType == other.hairType &&
            hairColor == other.hairColor &&
            topType == other.topType &&
            topColor == other.topColor &&
            botType == other.botType &&
            botColor == other.botColor);
 }
Exemplo n.º 3
0
        public void Init(DateModel newModel)
        {
            model = newModel;

            hairSprite.sprite = hairSprites[newModel.hairType];
            hairSprite.color  = DateFactory.instance.colorMap[newModel.hairColor];
            topSprite.sprite  = topSprites[newModel.topType];
            topSprite.color   = DateFactory.instance.colorMap[newModel.topColor];
            botSprite.sprite  = botSprites[newModel.botType];
            botSprite.color   = DateFactory.instance.colorMap[newModel.botColor];
        }
Exemplo n.º 4
0
        private bool DoesDateHaveDupe(DateModel dateModel)
        {
            foreach (DateView date in dates)
            {
                if (dateModel.IsAppearanceTheSame(date.model))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 5
0
        public void InitInterview(DateModel model, int infoType)
        {
            answerViews.ForEach(o => o.ClearMarks());
            p1Locked = false;
            p2Locked = false;

            ClearAnswers();
            p1SelectedAnswer = 3;
            p2SelectedAnswer = 3;
            SetAnswers();

            // Init the 8 answers
            List <int> choiceSlotsUsed = new List <int>();
            List <int> answersUsed     = new List <int>();

            // Place the correct answer
            string correctAnswer = "";

            switch (infoType)
            {
            case 0:
                correctAnswer = model.firstName;
                answersUsed.Add(model.firstNameIdx);
                question.text = "What is my name?";
                break;

            case 1:
                correctAnswer = model.birthMonth;
                answersUsed.Add(model.birthMonthIdx);
                question.text = "When is my bday?";
                break;

            case 2:
                correctAnswer = model.hobby;
                answersUsed.Add(model.hobbyIdx);
                question.text = "What is my hobby?";
                break;

            case 3:
                correctAnswer = model.bloodType;
                answersUsed.Add(model.bloodTypeIdx);
                question.text = "What is my blood type?";
                break;

            case 4:
                correctAnswer = model.homeTown;
                answersUsed.Add(model.homeTownIdx);
                question.text = "What is my hometown?";
                break;

            case 5:
                correctAnswer = model.movie;
                answersUsed.Add(model.movieIdx);
                question.text = "What is my favorite movie?";
                break;
            }

            int idx = PlaceAnswer(choiceSlotsUsed, correctAnswer);

            choiceSlotsUsed.Add(idx);
            currentCorrectAnswer = idx;

            // Place 7 false answers
            int           numAnswers = 0;
            List <string> answers    = null;

            switch (infoType)
            {
            case 0:
                numAnswers = DateFactory.instance.firstNames.Count;
                answers    = DateFactory.instance.firstNames;
                break;

            case 1:
                numAnswers = DateFactory.instance.birthMonths.Count;
                answers    = DateFactory.instance.birthMonths;
                break;

            case 2:
                numAnswers = DateFactory.instance.hobbies.Count;
                answers    = DateFactory.instance.hobbies;
                break;

            case 3:
                numAnswers = DateFactory.instance.bloodTypes.Count;
                answers    = DateFactory.instance.bloodTypes;
                break;

            case 4:
                numAnswers = DateFactory.instance.homeTowns.Count;
                answers    = DateFactory.instance.homeTowns;
                break;

            case 5:
                numAnswers = DateFactory.instance.movies.Count;
                answers    = DateFactory.instance.movies;
                break;
            }

            for (int i = 0; i < 7; i++)
            {
                int answerIdx = GetUnusedAnswer(answersUsed, numAnswers);
                answersUsed.Add(answerIdx);

                int choiceIdx = PlaceAnswer(choiceSlotsUsed, answers[answerIdx]);
                choiceSlotsUsed.Add(choiceIdx);
            }
        }