Esempio n. 1
0
    private void DrawControls()
    {
        GUIContent content = new GUIContent("Character");

        EditorGUI.LabelField(new Rect(5, 5, 60, 15), content);
        tree.characterFile = (DialogueManager.Character)EditorGUI.EnumPopup(
            new Rect(70, 5, 90, 15), tree.characterFile, EditorStyles.popup);
        content = new GUIContent("Type");
        EditorGUI.LabelField(new Rect(5, 25, 60, 15), content);
        tree.type = (DialogueTree.Type)EditorGUI.EnumPopup(
            new Rect(70, 25, 90, 15), tree.type, EditorStyles.popup);
        content = new GUIContent("Dialogue Scene");
        EditorGUI.LabelField(new Rect(5, 45, 100, 20), content);
        tree.scene = EditorGUI.IntField(new Rect(100, 45, 60, 15), tree.scene);
        content    = new GUIContent("Load Dialogue");
        if (GUI.Button(new Rect(5, 65, 150, 20), content))
        {
            DialogueTree d = DialogueWriter.LoadTree(Path.Combine(tree.GetDirectory(), tree.GetFileName()));
            if (d != null)
            {
                tree.Nodes          = d.Nodes;
                tree.Connections    = d.Connections;
                needsConnectionFuse = true;
            }
        }
        content = new GUIContent("Save Dialogue");
        if (GUI.Button(new Rect(5, 90, 150, 20), content))
        {
            DialogueWriter.WriteTree(tree, tree.GetFileName(), tree.GetDirectory());
        }
        if (needsConnectionFuse)
        {
            FuseConnections();
        }
    }
Esempio n. 2
0
    private void Start()
    {
        Application.targetFrameRate = 60;

        StartCoroutine(FadeOutTransition());

        // Starting the game from the title/start menu
        m_currentState        = GameState.START;
        m_dialogueWriter      = GetComponent <DialogueWriter>();
        m_audioSource         = GetComponent <AudioSource>();
        m_mainCameraTransform = Camera.main.transform;

        // Initializing everything needed
        // GetComponentsInChildren<CrackArea>(m_allCrackArea);
        m_fixingTool = FindObjectOfType <FixingTool>();

        // Instantiating post process profile to modify it at runtime
        // in case it's not yet fully optimal like described here
        // https://github.com/Unity-Technologies/PostProcessing/wiki/(v1)-Runtime-post-processing-modification
        var postBehavior = FindObjectOfType <UnityEngine.PostProcessing.PostProcessingBehaviour>();

        m_postProfile        = Instantiate(postBehavior.profile);
        postBehavior.profile = m_postProfile;
        //m_postProfile.motionBlur.enabled = false;
    }
Esempio n. 3
0
    void EnemySuicideAnimation()
    {
        actualPhase = Phase.SUICIDE;

        if (lastWriter == null)
        {
            enemyDialoguePosition.gameObject.SetActive(true);
            lastWriter = Instantiate(writerPrefab, enemyDialoguePosition.GetChild(1));

            lastWriter.GetComponent <TextMeshProUGUI>().font        = normalFont;
            lastWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 0;
            lastWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
            lastWriter.Play(actualCombat.playerWinResponse, preCombatWriterSpeed, preCombatWriterTrailLength, Skinning.GetSkin(preCombatEnnemyHighlight), Skinning.GetSkin(preCombatEnnemyColor));

            return;
        }

        effectAnimator.Play("Empty");
        enemyAnimator.enabled = false;

        enemyGraph.sprite    = actualCombat.enemySprites[suicideIndex];
        bigEnemyGraph.sprite = enemyGraph.sprite;

        if (suicideIndex != 3)
        {
            Invoke("EnemySuicideAnimation", suicideDelay);
            suicideIndex++;
        }
        else
        {
            AudioManager.PlaySound("Sepukku");
            AudioManager.PlaySound("Grunt");
            PlayBloodShed();
        }
    }
Esempio n. 4
0
    void ShowGameOver()
    {
        effectAnimator.Play("Empty");

        playerGraph.sprite = playerSprites[0];

        enemyDialoguePosition.gameObject.SetActive(true);

        lastWriter = Instantiate(writerPrefab, enemyDialoguePosition.GetChild(1));
        lastWriter.GetComponent <TextMeshProUGUI>().font        = normalFont;
        lastWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 0;
        lastWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));

        if (actualPhase == Phase.EFFECT_GENERAL)
        {
            lastWriter.Play(actualCombat.playerLoseResponse, preCombatWriterSpeed, preCombatWriterTrailLength, Skinning.GetSkin(preCombatEnnemyHighlight), Skinning.GetSkin(preCombatEnnemyColor));
        }

        if (actualPhase == Phase.EFFECT_FINAL)
        {
            lastWriter.Play(actualCombat.playerFinisherLoseResponse, preCombatWriterSpeed, preCombatWriterTrailLength, Skinning.GetSkin(preCombatEnnemyHighlight), Skinning.GetSkin(preCombatEnnemyColor));
        }

        actualPhase       = Phase.PLAYER_SUICIDE;
        playerTargetIndex = 0;
    }
Esempio n. 5
0
    void SpawnAttackReaction(string reaction)
    {
        enemyDialoguePosition.gameObject.SetActive(true);
        lastWriter = Instantiate(writerPrefab, enemyDialoguePosition.GetChild(1));

        lastWriter.GetComponent <TextMeshProUGUI>().font        = normalFont;
        lastWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 0;
        lastWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
        lastWriter.Play(reaction, preCombatWriterSpeed, preCombatWriterTrailLength, Skinning.GetSkin(preCombatEnnemyHighlight), Skinning.GetSkin(preCombatEnnemyColor));
    }
Esempio n. 6
0
    void SpawnCharacterLine(string line, Color text)
    {
        if (string.IsNullOrEmpty(line))
        {
            needsPlayerSpawn = true;
            return;
        }

        DialogueWriter spawned = Instantiate(characterTextPrefab, dialogueScrollList).GetComponent <DialogueWriter>();

        spawned.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
        spawned.Play(line, dialogueSpeed, highlightLength, Skinning.GetSkin(characterHighlightColor), GameData.LerpColorHSV(text, 0, 0.1f, -0.3f));

        lastWriter       = spawned;
        needsPlayerSpawn = true;
        characterDone    = false;
    }
Esempio n. 7
0
    /// <summary>
    /// Loads a dialogue scene file into dialogue line structs.
    /// </summary>
    /// <param name="path">The scene file to be loaded</param>
    public IEnumerator LoadDialogue(string path)
    {
        lines = new DialogueLine[1000];
        DialogueTree tree = DialogueWriter.LoadTree(path);

        yield return(new WaitForSecondsRealtime(0.2f));

        foreach (DialogueNode n in tree.Nodes)
        {
            lines[n.id] = new DialogueLine(n);
        }
        foreach (Connection c in tree.Connections)
        {
            DialogueLine inD  = lines[c.inPoint.id];
            DialogueLine outD = lines[c.outPoint.id];
            lines[c.outPoint.id].connections.Add(inD);
            lines[c.inPoint.id].parents.Add(outD);
        }
        head = lines[tree.Nodes[0].id];
        while (head.parents.Count > 0)
        {
            head = head.parents[0];
        }
    }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        //fill the dictionaries
        actorImages = new Dictionary <string, string> ()
        {
            { "blank", "CutScenes/blank" },
            { "RoyStandard", "CutScenes/royNEUTRAL_cutscene_2" },
            { "RoyDetermined", "CutScenes/royDETERMINEDL_cutscene_5" },
            { "RoyScared", "CutScenes/roySCARED_cutscene_10" },
            { "RoyHappy", "CutScenes/royHAPPY_cutscene_3" },
            { "EmilyCurious", "CutScenes/emilyCURIOUS_cutscene_3" },
            { "EmilyScared", "CutScenes/emilySCARED_cutscene_8" },
            { "JakeScared", "CutScenes/jakeSCAREDcutscene_8" },
            { "JakeCurious", "CutScenes/jakeCURIOUScutscene_4" },
            { "JakeHappy", "CutScenes/jakeHAPPYScutscene_2" },
            { "TankStandard", "CutScenes/tank" },
            { "EmilyHappy", "CutScenes/emilyHAPPY" },
            { "DadScared", "CutScenes/fatherSCARED" },
            { "DadHappy", "CutScenes/fatherHAPPY" }
        };
        backgrounds = new Dictionary <string, string> ()
        {
            { "templeOutside", "CutScenes/cutscene_Outside" },
            { "templeInfront", "CutScenes/cutscene_1" },
            { "templeStairs", "CutScenes/cutscene_7" },
            { "templeCollapse", "CutScenes/cutscene_9" },
            { "templeInside", "CutScenes/cutscene_Inside" },
            { "foundJake", "CutScenes/cutscene_4" },
            { "emilyBegin", "Cutscenes/cutscene_Emily-alone" },
            { "tankBegin", "Cutscenes/cutscene_TankAlone" },
            { "emilyandtank", "Cutscenes/cutscene_EmilyandTank" },
            { "tuckersreunited", "Cutscenes/cutscene_Reunited" },
            { "tankPup", "Cutscenes/cutscene_TankPup" },
            { "tankGrownUp", "Cutscenes/cutscene_Family" },
            { "sadFamily", "Cutscenes/cutscene_SadFamily" },
            { "kidsReading", "Cutscenes/cutscene_Reading" },
            { "kidsGrownUp", "Cutscenes/cutscene_GrownUp" },
            { "familyPictures", "Cutscenes/cutscene_FamilyPictures" },
            { "blackScreen", "Cutscenes/black-screen" },
            { "johnTuckerFigure", "Cutscenes/johnTuckerFigure" }
        };
        sounds = new Dictionary <string, string> ()
        {
            { "roy_hmm", "CutScenes/Roy/Roy - Thinking" },
            //	{"roy_notsure", "CutScenes/Andre-ImNotSureAboutThis"},
            //	{"roy_confused", "CutScenes/Andre-WhatWasThat"},
            { "roy_relieved", "CutScenes/Roy/Roy - Relieved" },
            { "roy_spooked", "CutScenes/Roy/Roy - Shook" },
            { "roy_unsure", "CutScenes/Roy/Roy - Unsure" },
            { "roy_determined", "CutScenes/Roy/Roy - Determined" },
            { "roy_pumped", "CutScenes/Roy/Roy - EndLevel1" },
            { "emily_determined", "CutScenes/Emily/Emily - Determined" },
            { "emily_disturbed", "CutScenes/Emily/Emily - Disturbed" },
            { "emily_happylaugh", "CutScenes/Emily/Emily - HappyLaugh" },
            { "emily_relief", "CutScenes/Emily/Emily - Relief" },
            { "emily_spooked", "CutScenes/Emily/Emily - Shook" },
            { "emily_thinking", "CutScenes/Emily/Emily - Thinking" },
            { "jake_affirmative", "CutScenes/Jake/Jake - Affirmative" },
            { "jake_confused", "CutScenes/Jake/Jake - Confused" },
            { "jake_scared", "CutScenes/Jake/Jake - Really Scared or Death" },
            { "jake_relief", "CutScenes/Jake/Jake - Relieved" },
            { "jake_spooked", "CutScenes/Jake/Jake - Shook" },
            { "jake_unsure", "CutScenes/Jake/Jake - Unsure" },
            { "tank_cautious", "CutScenes/Tank/Tank - Cautious" },
            { "tank_concerned", "CutScenes/Tank/Tank - Concerned" },
            { "tank_distressed", "CutScenes/Tank/Tank - Distressed" },
            { "tank_happy", "CutScenes/Tank/Tank - Happy2" },
            { "tank_loudroar", "CutScenes/Tank/Tank - Death" },
            { "temple_rumble", "CutScenes/templerumbling" },
            { "temple_collapse", "CutScenes/Temple Falling" }
        };

        cutSceneFiles = new Dictionary <int, string>()
        {
            { 1, "CutScene_Opening" },           //these cutscenes play before the level
            { 11, "CutScene_Flashback1" },
            { 21, "CutScene_JakeFound" },
            { 26, "CutScene_Flashback2" },
            { 31, "CutScene_EmilyAlone" },
            { 35, "CutScene_TankAlone" },
            { 37, "CutScene_EmilyAndTank" },
            { 41, "CutScene_TuckerKidsReunited" },
            { 51, "CutScene_Conclusion" }
        };

        //intialize GameObjects
        background = transform.Find("Background").gameObject;
        textBox    = transform.Find("TextBox").gameObject;
        //loadingImage = GameObject.Find ("LoadingImage").gameObject; //set manually
        dialogueWriter = transform.Find("Text").GetComponent <DialogueWriter> ();
        tapPrompt      = transform.Find("TapPrompt").gameObject;
        sceneIndex     = 0;
        lineIndex      = -1;    //line index gets set to -1 since there is currently no line displayed at all
        promptTimer    = 0;

        //get the current level
        zombie = GameObject.Find("ZombiePasser");

        int currLevel = zombie.GetComponent <ZombiePasser>().getLevel();

        //check if the current level has a cutscene
        if (!cutSceneFiles.ContainsKey(currLevel))
        {
            Debug.Log("No cutscene for level " + currLevel);
            endCutScene();
            return;
        }

        if (currLevel == 21)
        {
            zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_brotherly_love, false);
        }
        if (currLevel == 31)
        {
            zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_sister_sister, false);
        }
        if (currLevel == 35)
        {
            zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_bear_with_me, false);
        }
        if (currLevel == 41)
        {
            zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_family_reunion, false);
        }
        if (currLevel == 51)
        {
            zombie.GetComponent <SocialPlatform>().AchievementProgress(GPGSIds.achievement_all_tuckered_out, false);
        }

        //load in the JSON file, the same way as levelReader
        TextAsset cutSceneFile = Resources.Load(cutSceneFiles[currLevel]) as TextAsset;

        jsonString   = cutSceneFile.ToString();
        cutSceneData = JsonMapper.ToObject(jsonString);
        cutScenes    = new List <CutScene> ();

        //iterate through all the 'scenes', by adding an int to the end of the identifier
        int i = 1;

        while (cutSceneData.Keys.Contains(iterString + i.ToString()))
        {
            JsonData sceneInfo = cutSceneData[iterString + i.ToString()];
            CutScene cutScene  = new CutScene {
                BackgroundImage = backgrounds[(string)sceneInfo ["image"]],
                Lines           = new List <CharacterLine>()
            };

            int j = 1;
            while (sceneInfo.Keys.Contains(iterString2 + j.ToString()))
            {
                JsonData      lineInfo = sceneInfo [iterString2 + j.ToString()];
                CharacterLine line     = new CharacterLine {
                    characterImage = actorImages[(string)lineInfo["image"]],
                    LineText       = (string)lineInfo["text"]
                };
                string soundName = (string)lineInfo ["sound"];
                if (sounds.ContainsKey(soundName))
                {
                    line.soundByte = sounds[soundName];
                }
                cutScene.Lines.Add(line);
                j++;
            }

            // add level to levels list:
            cutScenes.Add(cutScene);
            i++;
        }

        //set background to first image, and make the text box invisible
        background.GetComponent <Image> ().sprite  = Resources.Load <Sprite>(cutScenes[0].BackgroundImage);
        textBox.GetComponent <CanvasGroup>().alpha = 0f;
        nextLine();
    }
Esempio n. 9
0
    void SpawnNextPreDialogue()
    {
        if (isPlayer)
        {
            if (lastWriterPlayer != null)
            {
                playerDialoguePosition.gameObject.SetActive(false);
                Destroy(lastWriterPlayer.gameObject);
            }

            if (actualCombat.actualState == GameData.GameState.GAME_OVER_FINISHER)
            {
                actualPhase = Phase.GONG;

                if (actualCombat.actualState == GameData.GameState.GAME_OVER_FINISHER)
                {
                    actualCombat.actualState = GameData.GameState.RETURN_FINISHER;
                }

                if (lastWriter != null)
                {
                    playerDialoguePosition.gameObject.SetActive(false);
                    enemyDialoguePosition.gameObject.SetActive(false);

                    Destroy(lastWriter.gameObject);
                }
                return;
            }
            else
            {
                if (dialogueIndex > actualCombat.preCombatReplicas.Count - 1 || string.IsNullOrEmpty(actualCombat.preCombatReplicas[dialogueIndex].playerLine))
                {
                    actualPhase = Phase.KATANA;

                    if (actualCombat.actualState == GameData.GameState.GAME_OVER_GENERAL)
                    {
                        actualCombat.actualState = GameData.GameState.RETURN_GENERAL;
                    }

                    playerDialoguePosition.gameObject.SetActive(false);
                    enemyDialoguePosition.gameObject.SetActive(false);

                    Destroy(lastWriter.gameObject);
                    return;
                }

                playerDialoguePosition.gameObject.SetActive(true);
                lastWriter = Instantiate(writerPrefab, playerDialoguePosition.GetChild(1));

                lastWriter.GetComponent <TextMeshProUGUI>().font        = streetFont;
                lastWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 5;

                lastWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
                lastWriter.Play(actualCombat.preCombatReplicas[dialogueIndex].playerLine, preCombatWriterSpeed, preCombatWriterTrailLength, Skinning.GetSkin(preCombatPlayerHighlight), Skinning.GetSkin(preCombatPlayerColor));
            }

            lastWriterPlayer = lastWriter;
        }
        else
        {
            if (lastWriterEnemy != null)
            {
                enemyDialoguePosition.gameObject.SetActive(false);
                Destroy(lastWriterEnemy.gameObject);
            }

            if (actualCombat.actualState == GameData.GameState.GAME_OVER_FINISHER)
            {
                enemyDialoguePosition.gameObject.SetActive(true);
                lastWriter = Instantiate(writerPrefab, enemyDialoguePosition.GetChild(1));

                lastWriter.GetComponent <TextMeshProUGUI>().font        = normalFont;
                lastWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 0;
                lastWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
                lastWriter.Play(actualCombat.preCombatReturnReplica, preCombatWriterSpeed, preCombatWriterTrailLength, Skinning.GetSkin(preCombatEnnemyHighlight), Skinning.GetSkin(preCombatEnnemyColor));
            }
            else
            {
                if (dialogueIndex > actualCombat.preCombatReplicas.Count - 1 || string.IsNullOrEmpty(actualCombat.preCombatReplicas[dialogueIndex].enemyLine))
                {
                    actualPhase = Phase.KATANA;

                    if (actualCombat.actualState == GameData.GameState.GAME_OVER_GENERAL)
                    {
                        actualCombat.actualState = GameData.GameState.RETURN_GENERAL;
                    }

                    enemyDialoguePosition.gameObject.SetActive(false);
                    playerDialoguePosition.gameObject.SetActive(false);

                    Destroy(lastWriter.gameObject);
                    return;
                }

                enemyDialoguePosition.gameObject.SetActive(true);
                lastWriter = Instantiate(writerPrefab, enemyDialoguePosition.GetChild(1));

                lastWriter.GetComponent <TextMeshProUGUI>().font        = normalFont;
                lastWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 0;
                lastWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
                lastWriter.Play(actualCombat.preCombatReplicas[dialogueIndex].enemyLine, preCombatWriterSpeed, preCombatWriterTrailLength, Skinning.GetSkin(preCombatEnnemyHighlight), Skinning.GetSkin(preCombatEnnemyColor));
            }

            dialogueIndex++;

            lastWriterEnemy = lastWriter;
        }

        isPlayer          = !isPlayer;
        writerIsCommanded = false;
    }