Example #1
0
 /// <summary>
 /// Allows the game to run logic such as updating the world,
 /// checking for collisions, gathering input, and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Update(GameTime gameTime)
 {
     _currentState?.Update(gameTime);
     base.Update(gameTime);
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        //if(Input.GetKeyDown(KeyCode.F8)) {
        //    game_mode = GameMode.Minigame;
        //    game_sequence = GameSequence.Balcony;
        //    cheers_game.SetActive(true);
        //}
        //if(Input.GetKeyDown(KeyCode.F9)) {
        //    game_mode = GameMode.Talking;
        //    game_sequence = GameSequence.Livingroom;
        //    cheers_game.SetActive(false);
        //}
        if (Input.GetKeyDown(KeyCode.F6))
        {
            AndroidStatus.happiness -= 0.1f;
        }
        if (Input.GetKeyDown(KeyCode.F7))
        {
            AndroidStatus.happiness += 0.1f;
        }
        if (Input.GetKeyDown(KeyCode.F5))
        {
            if (mood_debug != null)
            {
                mood_debug.gameObject.SetActive(true);
            }
            if (happiness_debug != null)
            {
                happiness_debug.gameObject.SetActive(true);
            }
        }
        if (Input.GetKeyDown(KeyCode.F4))
        {
            if (mood_debug != null)
            {
                mood_debug.gameObject.SetActive(false);
            }

            if (happiness_debug != null)
            {
                happiness_debug.gameObject.SetActive(false);
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (game_mode == GameMode.Talking)
            {
                SetDialogue(new Question.StringEmotion {
                    breadText = "Are you leaving me?", emotionState = FaceSystem.Emotion.sad
                });
                game_mode = GameMode.Leave;
            }
            else
            {
                Application.Quit();
            }
        }

        outputDia.text = readLine;

        readLine = ReadCurrentDialogue();
        if (fullLine != readLine)
        {
            return;
        }

        if (happiness_debug != null)
        {
            happiness_debug.text = "" + AndroidStatus.happiness;
        }

        if (game_mode == GameMode.Leave)
        {
            PlayerAnswer pa = InputManager.yesAndNo.GetAnswer();
            if (pa == PlayerAnswer.Yes)
            {
                Application.Quit();
            }
            else if (pa == PlayerAnswer.No)
            {
                game_mode = GameMode.Talking;
            }
        }

        if (game_mode == GameMode.Talking)
        {
            if (AndroidStatus.happiness >= 1.0f)
            {
                if (game_sequence == GameSequence.Livingroom)
                {
                    currentTalkingElement = null;
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Let's head out to the balcony?", emotionState = FaceSystem.Emotion.happy
                    });
                    game_mode = GameMode.Minigame;
                }

                if (game_sequence == GameSequence.Balcony)
                {
                    currentTalkingElement = null;
                    SetDialogue(new Question.StringEmotion {
                        breadText = "A toast, to us!", emotionState = FaceSystem.Emotion.happy
                    });
                    cheers_game.SetActive(true);
                    game_mode = GameMode.Minigame;
                }

                if (game_sequence == GameSequence.Bedroom)
                {
                    currentTalkingElement = null;
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Let's take this all the way", emotionState = FaceSystem.Emotion.blush
                    });
                    sex_game.SetActive(true);
                    game_mode = GameMode.Minigame;
                }
            }
            else if (AndroidStatus.happiness <= -1.0f)
            {
                game_mode = GameMode.Failure;
            }
        }

        if (game_mode == GameMode.Minigame)
        {
            if (game_sequence == GameSequence.Livingroom)
            {
                PlayerAnswer pa = InputManager.yesAndNo.GetAnswer();

                if (pa == PlayerAnswer.Yes)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "^^'", emotionState = FaceSystem.Emotion.blush
                    });
                    game_mode = GameMode.BackToTalking;
                }
                else if (pa == PlayerAnswer.No)
                {
                    game_mode = GameMode.Failure;
                }
            }
            else if (game_sequence == GameSequence.Balcony)
            {
                CheersGame cg = cheers_game.GetComponent <CheersGame>();

                if (cg.won)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Shall take this to the bedroom", emotionState = FaceSystem.Emotion.blush
                    });
                    game_mode = GameMode.BackToTalking;
                }
                else if (cg.lost)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Why do you have to ruin every special moment we have?", emotionState = FaceSystem.Emotion.sad
                    });
                    game_mode = GameMode.Failure;
                }
                else if (cg.won == false && cg.lost == false && cg.attempts != prev_cheer_attempts)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "Can't you aim!?", emotionState = FaceSystem.Emotion.angry
                    });
                    prev_cheer_attempts = cg.attempts;
                }
            }
            else if (game_sequence == GameSequence.Bedroom)
            {
                SexHandler sh = sex_game.GetComponent <SexHandler>();
                if (sh.finalized)
                {
                    SetDialogue(new Question.StringEmotion {
                        breadText = "You do care!", emotionState = FaceSystem.Emotion.happy
                    });
                    game_mode = GameMode.BackToTalking;
                }
            }
        }

        if (game_mode == GameMode.Failure)
        {
            if (fail_state.active == false)
            {
                fail_state.SetActive(true);
                SetDialogue(new Question.StringEmotion {
                    breadText = "...", emotionState = FaceSystem.Emotion.serious
                });
            }
        }

        if (game_mode == GameMode.BackToTalking)
        {
            if (InputManager.PushToTalk())
            {
                if (game_sequence == GameSequence.Livingroom)
                {
                    change_scene.NextScene();
                    game_sequence           = GameSequence.Balcony;
                    game_mode               = GameMode.Talking;
                    AndroidStatus.happiness = 0.0f;
                }
                else if (game_sequence == GameSequence.Balcony)
                {
                    change_scene.NextScene();
                    cheers_game.SetActive(false);
                    game_sequence           = GameSequence.Bedroom;
                    game_mode               = GameMode.Talking;
                    AndroidStatus.happiness = 0.0f;
                }
                else if (game_sequence == GameSequence.Bedroom)
                {
                    AndroidStatus.happiness = 100000000.0f;
                }
            }
        }

        if (game_mode == GameMode.Talking)
        {
            if (!currentTalkingElement || currentTalkingElement.GoNext())
            {
                //Debug.Log("HEREH: ");
                if (currentTalkingElement is Question)
                {
                    TalkingElement nextElement = null;

                    if (currentTalkingElement.correctlyAnswered)
                    {
                        if (currentTalkingElement.GetType() == typeof(Question))
                        {
                            Question q = (Question)currentTalkingElement;
                            AndroidStatus.happiness += q.correct_happiness_boost;
                        }
                        nextElement = currentTalkingElement.rightAnswerNode;
                    }
                    else
                    {
                        if (currentTalkingElement.GetType() == typeof(Question))
                        {
                            Question q = (Question)currentTalkingElement;
                            AndroidStatus.happiness += q.incorrect_happiness_loss;
                        }
                        nextElement = currentTalkingElement.wrongAnswerNode;
                    }

                    if (nextElement != null)
                    {
                        SetTalkingElement(nextElement);
                        Debug.Log("Not nUll");
                    }
                    else
                    {
                        SetTalkingElement(AndroidStatus.GetTalkingElement());
                        Debug.Log("Next Element");
                    }
                }
                else
                {
                    SetTalkingElement(AndroidStatus.GetTalkingElement());
                }
            }
        }

        androidState.Update();
        if (game_mode == GameMode.Talking)
        {
            if (currentTalkingElement)
            {
                var next = currentTalkingElement.GetText();
                if (next != null && next.breadText != originalFullLine)
                {
                    SetDialogue(next);
                }
            }
        }
    }