コード例 #1
0
ファイル: Gameplay.cs プロジェクト: autious/sexmachine
 void Start()
 {
     fullLine = "";
     readLine = "";
     //Input.
     androidState = new AndroidUpset(this);
     androidState.Enter();
     AndroidStatus.AddTalkingElement(starting_element);
 }
コード例 #2
0
ファイル: AndroidStatus.cs プロジェクト: tackey-01/LifePlan
 public NegativeButtonListner(AndroidStatus d) : base("android.content.DialogInterface$OnClickListener")
 {
     //リスナーを作成した時に呼び出される
     _parent = d;
 }
コード例 #3
0
ファイル: Gameplay.cs プロジェクト: autious/sexmachine
    public override void Update()
    {
        if (gameRef.currentTalkingElement == null)
        {
            //Add interjection?
            if (was_interjection == false && UnityEngine.Random.Range(0, 1.0f) > 0.5f)
            {
                List <RegularTalkingPoint> possibilities = new List <RegularTalkingPoint>();

                foreach (RegularTalkingPoint rtp in gameRef.interjections)
                {
                    if (AndroidStatus.happiness >= rtp.happiness_min && AndroidStatus.happiness <= rtp.happiness_max)
                    {
                        possibilities.Add(rtp);
                    }
                }

                if (possibilities.Count == 0)
                {
                    possibilities.AddRange(gameRef.interjections);
                    Debug.LogWarning("No matching");
                }

                RegularTalkingPoint chosen = possibilities[UnityEngine.Random.Range(0, possibilities.Count)];

                AndroidStatus.AddTalkingElement(chosen);
                was_interjection = true;
            }
            else
            {
                Question[] source = gameRef.questions;

                if (gameRef.game_sequence == Gameplay.GameSequence.Livingroom)
                {
                    if (gameRef.livingroom_questions.Length > 0)
                    {
                        source = gameRef.livingroom_questions;
                    }
                }
                if (gameRef.game_sequence == Gameplay.GameSequence.Balcony)
                {
                    if (gameRef.balcony_questions.Length > 0)
                    {
                        source = gameRef.balcony_questions;
                    }
                }
                if (gameRef.game_sequence == Gameplay.GameSequence.Bedroom)
                {
                    if (gameRef.bedroom_questions.Length > 0)
                    {
                        source = gameRef.bedroom_questions;
                    }
                }

                List <Question> possibilities = new List <Question>();
                foreach (Question q in source)
                {
                    if (AndroidStatus.happiness >= q.happiness_min && AndroidStatus.happiness <= q.happiness_max)
                    {
                        if (q != prev_question)
                        {
                            possibilities.Add(q);
                        }
                    }
                }

                if (possibilities.Count == 0)
                {
                    possibilities.AddRange(gameRef.questions);
                }

                Debug.Log("Possible " + possibilities.Count);

                Question chosen = possibilities[UnityEngine.Random.Range(0, possibilities.Count)];
                AndroidStatus.AddTalkingElement(chosen);
                prev_question    = chosen;
                was_interjection = false;
            }
        }
    }
コード例 #4
0
ファイル: Gameplay.cs プロジェクト: autious/sexmachine
    // 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);
                }
            }
        }
    }