Exemple #1
0
    public void PreInit(CombatDialogue actualCombat)
    {
        // assign backgrounds
        for (int i = 0; i < backgrounds.Length; i++)
        {
            backgrounds[i].sprite = actualCombat.sceneBackgrounds[i];
            backgrounds[i].color  = ColorTools.LerpColorValues(Skinning.GetSkin(backgrounds[i].GetComponent <SkinGraphic>().skin_tag), ColorTools.Value.SV, new int[2] {
                backgroundSvalue, backgroundVvalue
            });
            backgrounds[i].GetComponent <SkinGraphic>().enabled = false;
        }

        this.actualCombat = actualCombat;

        enemyHealth          = new List <SubCategory>(actualCombat.weaknesses);
        enemyGraph.sprite    = actualCombat.enemySprites[4 + enemyHealth.Count];
        bigEnemyGraph.sprite = enemyGraph.sprite;

        playerGraph.sprite = playerSprites[0];

        actualPhase = Phase.INTRO;

        if (actualCombat.actualState == GameData.GameState.GAME_OVER_FINISHER)
        {
            enemyHealth.Clear();
            enemyGraph.sprite = actualCombat.enemySprites[4];
        }
    }
Exemple #2
0
    public void Init()
    {
        writer.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
        writer.Play("Fin de la démo\n\n\n\n\n\n\nMerci d'avoir joué", Skinning.GetSkin(SkinTag.DELETE));

        initializableInterface.InitInternal();
    }
Exemple #3
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));
    }
Exemple #4
0
    public void Init(Transform start, SkinTag normal, SkinTag validated, SkinTag wrong, SkinTag old, SubCategory startClue = SubCategory.EMPTY)
    {
        this.start = start;

        this.startClue = startClue;
        endClue        = SubCategory.EMPTY;

        normalColor    = Skinning.GetSkin(normal);
        validatedColor = Skinning.GetSkin(validated);
        wrongColor     = Skinning.GetSkin(wrong);
        oldColor       = Skinning.GetSkin(old);

        initializableInterface.InitInternal();
    }
Exemple #5
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;
    }
Exemple #6
0
    public void Skin()
    {
        is_skinned = true;

        if (graphicText == null && graphic == null)
        {
            Debug.LogError("<b>[" + GetType() + "] : </b>" + "Doesn't have attached graphic component", gameObject);
            Destroy(this);
            return;
        }

        if (graphicText != null)
        {
            graphicText.color = Skinning.GetSkin(skin_tag);
        }
        else
        {
            graphic.color = Skinning.GetSkin(skin_tag);
        }
    }
Exemple #7
0
    public void PreInit(GameData.GameState targetState, GeneralDialogue dialogue, Func <Clue, bool> findClue)
    {
        findClueEvent = findClue;

        background.color = ColorTools.LerpColorValues(Skinning.GetSkin(SkinTag.PICTO), ColorTools.Value.SV, new int[2] {
            8, 10
        });

        characterPortrait.Hide();
        characters.ForEach(item => item.Init(() => ChangeCharacter(item.character)));

        ColorBlock block = dialogueScroll.colors;

        block.normalColor      = Skinning.GetSkin(SkinTag.SECONDARY_ELEMENT);
        block.highlightedColor = Skinning.GetSkin(SkinTag.SECONDARY_WINDOW);
        block.pressedColor     = Skinning.GetSkin(SkinTag.CONTRAST);
        dialogueScroll.colors  = block;

        scrollButton.Init(this);

        block                      = scrollButton.button.colors;
        block.normalColor          = Skinning.GetSkin(SkinTag.PRIMARY_ELEMENT);
        block.highlightedColor     = Skinning.GetSkin(SkinTag.PRIMARY_WINDOW);
        block.pressedColor         = Skinning.GetSkin(SkinTag.CONTRAST);
        block.disabledColor        = block.normalColor;
        scrollButton.button.colors = block;

        // when you come back to shogun after defeat
        if (targetState != GameData.GameState.NORMAL)
        {
            // unlocks all clues
            foreach (Clue clue in dialogue.GetAllClues())
            {
                findClue.Invoke(clue);
                AddClueToList(clue, true);
            }
        }

        actualState = targetState;
    }
Exemple #8
0
    void SpawnPlayerChoice(string selectionLine, string displayLine, Color textColor, int index)
    {
        Button spawned = Instantiate(playerChoicePrefab, dialogueScrollList).GetComponent <Button>();

        ColorBlock block = spawned.colors;

        block.normalColor      = textColor;
        block.highlightedColor = Skinning.GetSkin(playerChoiceHighlightColor);
        block.pressedColor     = Skinning.GetSkin(SkinTag.CONTRAST);
        spawned.colors         = block;

        TextMeshProUGUI spawnedText = spawned.transform.GetChild(0).GetComponent <TextMeshProUGUI>();

        spawnedText.text  = selectionLine;
        spawnedText.color = Color.white;

        spawned.onClick.AddListener(() => SelectChoice(displayLine, index));

        lastSpawnedDialogueObjects.Add(spawned.gameObject);

        waitForPlayerChoice = true;
    }
Exemple #9
0
    public void Init(Action startGameCallback)
    {
        startGame = startGameCallback;

        scrolls      = new List <Animator>();
        actualScroll = 0;

        foreach (string tuto in tutos)
        {
            GameObject scroll = Instantiate(scrollPrefab, transform);
            scroll.SetActive(false);
            scroll.transform.localScale = Vector3.one * 1.2f;

            scroll.GetComponent <Button>().enabled = false;
            scroll.transform.GetChild(1).GetComponent <Image>().color = Skinning.GetSkin(SkinTag.PRIMARY_ELEMENT);

            TextMeshProUGUI scrollText = scroll.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>();
            scrollText.text      = tuto;
            scrollText.fontSize  = 22;
            scrollText.fontStyle = FontStyles.Bold;

            Animator scrollAnimator = scroll.GetComponent <Animator>();
            scrollAnimator.speed = 0;

            scrolls.Add(scrollAnimator);
        }

        if (ShouldSkip())
        {
            panel.Play("Fade");
            Invoke("StartGame", 0.5f);
        }
        else
        {
            StartAnimation(scrolls[0]);
        }

        initializableInterface.InitInternal();
    }
Exemple #10
0
    public void SetCharacterPortrait(ShogunCharacter shogunCharacter, Button button = null)
    {
        clothes.sprite = shogunCharacter.characterClothes;
        skin.sprite    = shogunCharacter.characterSkin;
        detail.sprite  = shogunCharacter.characterDetail;
        eyes.sprite    = shogunCharacter.characterEyes;
        over.sprite    = shogunCharacter.characterOver;

        if (button != null)
        {
            selfButton = button;

            ColorBlock block = button.colors;
            block.normalColor      = Skinning.GetSkin(normalTag);
            block.highlightedColor = GameData.GetColorFromCharacter(shogunCharacter.character);
            block.disabledColor    = Skinning.GetSkin(normalTag);
            button.colors          = block;
        }

        Show();
        Grey(false);
    }
Exemple #11
0
    // add settings callback when we have one
    public void Init(Action playButtonCallback, Action quitButtonCallback)
    {
        if (playButtonCallback != null)
        {
            playButtonCallback += () => AudioManager.PlaySound("Button");
            playButton.onClick.AddListener(playButtonCallback.Invoke);

            ColorBlock block = new ColorBlock()
            {
                normalColor      = Skinning.GetSkin(buttonNormal),
                highlightedColor = Skinning.GetSkin(buttonHighlight),
                pressedColor     = Skinning.GetSkin(buttonPressed),
                colorMultiplier  = 1,
                fadeDuration     = 0.1f
            };

            playButton.colors = block;
        }

        if (quitButtonCallback != null)
        {
            quitButtonCallback += () => AudioManager.PlaySound("Button");
            quitButton.onClick.AddListener(quitButtonCallback.Invoke);

            ColorBlock block = new ColorBlock()
            {
                normalColor      = Skinning.GetSkin(buttonNormal),
                highlightedColor = Skinning.GetSkin(buttonHighlight),
                pressedColor     = Skinning.GetSkin(buttonPressed),
                colorMultiplier  = 1,
                fadeDuration     = 0.1f
            };

            quitButton.colors = block;
        }

        initializableInterface.InitInternal();
    }
Exemple #12
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;
    }
Exemple #13
0
    void Update()
    {
        // sets character grey state
        if (actualDialogue != null && actualDialogue.GetCharacterDialogue(Character.SHOGUN).IsDone())
        {
            if (!firstCharacterSelection && !cluesPanelAnim.GetCurrentAnimatorStateInfo(0).IsName("Tutorial"))
            {
                cluesPanelAnim.Play("ShowTutorial");
            }

            List <UICharacter> notGreyed = new List <UICharacter>();

            characters.ForEach(item =>
            {
                if (item.character != actualCharacter)
                {
                    item.selectionButton.interactable = true;
                    item.UI.Grey(false);
                }

                if (!item.UI.IsGreyed())
                {
                    notGreyed.Add(item.UI);
                }
            });

            // if shogun dialogue is already done
            if (notGreyed.Count > 1)
            {
                characterMoveTimer += Time.deltaTime;
            }

            // animates characters
            if (characterMoveTimer >= characterMoveDelay)
            {
                characterMoveTimer = 0;

                // select random character except shogun
                List <ShogunCharacter> allButShogunAndSelected = new List <ShogunCharacter>();

                foreach (ShogunCharacter shogunCharacter in characters)
                {
                    if (shogunCharacter.character != Character.SHOGUN && shogunCharacter.character != actualCharacter && shogunCharacter.character != lastAnimated)
                    {
                        allButShogunAndSelected.Add(shogunCharacter);
                    }
                }

                int index = UnityEngine.Random.Range(0, allButShogunAndSelected.Count);

                // select random animation
                int animationIndex = UnityEngine.Random.Range(0, characterAnimationTag.Length);

                // give random animation to random character
                allButShogunAndSelected[index].UI.movementAnimator.Play(characterAnimationTag[animationIndex]);

                // stores last animated
                lastAnimated = allButShogunAndSelected[index].character;
            }
        }

        scrollDown.SetActive(cluesScrollList.anchoredPosition.y < cluesScrollList.rect.height / 2);
        scrollUp.SetActive(cluesScrollList.anchoredPosition.y > cluesScrollList.parent.GetComponent <RectTransform>().rect.height - (cluesScrollList.rect.height / 2));

        // unlock all cheat
        if (Input.GetKeyDown(unlockAllClues) && !didCheat && useCheats)
        {
            foreach (Clue clue in actualDialogue.GetAllClues())
            {
                if (findClueEvent.Invoke(clue))
                {
                    AddClueToList(clue);
                }
            }

            Debug.Log(debugableInterface.debugLabel + "Unlocked all clues");

            didCheat = true;
        }

        // timer for clues panel
        if (cluesAddTimer > 0)
        {
            cluesAddTimer -= Time.deltaTime;

            if (cluesAddTimer <= 0)
            {
                cluesAddTimer = 0;
                cluesOpen     = false;

                cluesPanelAnim.Play("Close");
                AudioManager.PlaySound("CluesPanel");
            }
        }

        // when character writer is done
        if (lastWriter != null && lastWriter.isDone)
        {
            // prevents update from spawning lines if we are waiting for the player to choose a dialogue line
            if (waitForPlayerChoice)
            {
                return;
            }

            characterDone = true;

            // previous line was a character line
            if (needsPlayerSpawn)
            {
                {
                    // sets shogun dialogue done if return dialogue done
                    CharacterDialogue selected = actualDialogue.charactersDialogues.Find(item => { return(item.character == Character.SHOGUN); });

                    if (actualDialogue.shogunReturnDialogues.IsDone() && !selected.IsDone())
                    {
                        actualDialogue.charactersDialogues.Find(item => { return(item.character == Character.SHOGUN); }).ForceSetAsDone();
                    }
                }

                // spawns next dialogues choices
                if (Input.GetMouseButtonDown(0) || forceClick)
                {
                    forceClick = false;

                    Dialogue[] availableDialogues;

                    // if we are not at beginning of dialogue
                    if (actualCharacterDialogue.indexesPath.Count > 0)
                    {
                        // adds clue to player clue list if there was one
                        if (actualCharacterDialogue.indexesPath.Count > 1 && actualCharacterDialogue.GetActualDialogue().hasClue)
                        {
                            if (findClueEvent.Invoke(actualCharacterDialogue.GetActualDialogue().clue))
                            {
                                AddClueToList(actualCharacterDialogue.GetActualDialogue().clue);
                            }
                        }

                        availableDialogues = actualCharacterDialogue.GetActualDialogue().nextDialogues;

                        // resets indexes path if branch can't go any further
                        if (availableDialogues == null || availableDialogues.Length == 0)
                        {
                            actualCharacterDialogue.ResetDialoguePath();
                            return;
                        }
                    }
                    else
                    {
                        availableDialogues = actualCharacterDialogue.initialDialogues.ToArray();
                    }

                    for (int i = 0; i < availableDialogues.Length; i++)
                    {
                        int    j      = i;
                        Color  actual = Skinning.GetSkin(availableDialogues[i].IsDone() ? playerChoiceDone : playerChoiceUndone);
                        string line   = availableDialogues[i].playerQuestion;

                        if (availableDialogues[i].IsDone())
                        {
                            line = "<s>" + line + "</s>";
                        }

                        SpawnPlayerChoice(line, availableDialogues[i].playerQuestion, actual, j);
                    }
                }
            }
            else             // previous line was player line
            {
                SpawnCharacterLine(actualCharacterDialogue.GetActualDialogue().characterAnswer, characterTextColor);
            }
        }
        else if (Input.GetMouseButtonDown(0) || forceClick)
        {
            forceClick = false;

            if (lastWriter != null)
            {
                lastWriter.Finish();
            }
        }
    }
Exemple #14
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();
        }
    }
Exemple #15
0
    void SelectChoice(string line, int index)
    {
        actualCharacterDialogue.MoveToDialogue(index);

        AudioManager.PlaySound("Knob");

        // deletes all previously spawned texts except selected one
        for (int i = 0; i < lastSpawnedDialogueObjects.Count; i++)
        {
            if (i != index)
            {
                Destroy(lastSpawnedDialogueObjects[i]);
            }
            else
            {
                lastSpawnedDialogueObjects[i].transform.GetChild(0).GetComponent <TextMeshProUGUI>().color = Skinning.GetSkin(playerTextColor);
            }
        }

        lastSpawnedDialogueObjects.Clear();

        needsPlayerSpawn    = false;
        waitForPlayerChoice = false;
    }
Exemple #16
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;
    }
Exemple #17
0
    public void Init(bool useCheats, GeneralPunchlines punchlines, GeneralDialogue dialogue, AudioProjectManager audioProject, Action toConsequencesCallback)
    {
        normalFont = FindObjectOfType <TextMeshProUGUI>().font;
        initializableInterface.InitInternal();

        this.useCheats      = useCheats;
        gamePunchlines      = punchlines;
        toConsequences      = toConsequencesCallback;
        audioProjectManager = audioProject;

        foreach (Transform child in sakuraParent)
        {
            child.GetComponent <Image>().color = sakuraColor;
        }

        katanaSlider.gameObject.SetActive(false);
        gongSlider.Init(() =>
        {
            audioProjectManager.FadeMusicOut(0);
            AudioManager.PlaySound("Gong");
        }, StartFinalPunchlines);

        lifePoints = new List <Animator>();

        // spawns life points
        for (int i = 0; i < actualCombat.allowedErrors; i++)
        {
            Animator spawned = null;

            spawned = Instantiate(lifePrefab, triesHolder).GetComponent <Animator>();

            lifePoints.Add(spawned);
        }

        categoryButtons.ForEach(item => item.Init(ShowPunchlines, gamePunchlines, streetFont));

        spawnedConclusions = new List <ConclusionCard>();

        // spawns conclusions
        foreach (Conclusion conclusion in dialogue.unlockableConclusions)
        {
            ConclusionCard spawned = Instantiate(conclusionPrefab, conclusionScroll);
            spawned.Init(conclusion);

            spawned.comment.font        = streetFont;
            spawned.comment.wordSpacing = 5;

            spawnedConclusions.Add(spawned);
        }

        // finisher buttons
        for (int i = 0; i < finisherPunchlineButtons.Length; i++)
        {
            finisherPunchlineButtons[i].transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().text        = actualCombat.finisherPunchlines.finishers[i];
            finisherPunchlineButtons[i].transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().font        = streetFont;
            finisherPunchlineButtons[i].transform.GetChild(2).GetChild(0).GetComponent <TextMeshProUGUI>().wordSpacing = 5;

            int j = i;

            finisherPunchlineButtons[i].onClick.AddListener(() =>
            {
                selectedFinisher = actualCombat.finisherPunchlines.finishers[j];
                isGoodFinisher   = j == actualCombat.finisherPunchlines.correctOne;

                canvasAnimator.Play("PanDown");
                Invoke("ShowAttackLines", 1);

                AudioManager.PlaySound("Button");

                SetCanvasInterractable(false);
                actualPhase = Phase.EFFECT_FINAL;
            });

            ColorBlock colors = finisherPunchlineButtons[i].colors;
            colors.normalColor                 = Skinning.GetSkin(SkinTag.SECONDARY_WINDOW);
            colors.highlightedColor            = Skinning.GetSkin(SkinTag.PRIMARY_WINDOW);
            colors.pressedColor                = Skinning.GetSkin(SkinTag.CONTRAST);
            finisherPunchlineButtons[i].colors = colors;
        }

        errorCount         = 0;
        sakuraTimer        = 0;
        trueSakuraDelay    = UnityEngine.Random.Range(sakuraDelay.x, sakuraDelay.y);
        isGoodFinisher     = false;
        gotToFinisher      = false;
        invokedTransition  = false;
        destructionAsked   = false;
        isStartingGameOver = false;

        usedPunchlines = new List <Punchline>();

        canvasAnimator.Play("Intro");
        AudioManager.PlaySound("Wind");
        Invoke("StartDialogue", 3);

        Debug.Log(debugableInterface.debugLabel + "Initializing done");
    }
Exemple #18
0
    void SpawnPlayerLine()
    {
        if (actualDialogue >= dialogues.Length || string.IsNullOrEmpty(dialogues[actualDialogue].playerLine))
        {
            toShogunCallback.Invoke();
            blockInput = true;
            return;
        }

        FlushWriter();

        if (actualDialogue != 0)
        {
            deityAnim.Play("Hide");
        }

        actualWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
        actualWriter.Play(dialogues[actualDialogue].playerLine, playerSpeed, playerTrail, Skinning.GetSkin(playerHighlight), Skinning.GetSkin(playerText));

        actualWriter.GetComponent <TextMeshProUGUI>().font        = playerFont;
        actualWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 5;

        isPlayerNext = false;
        spawnAsked   = false;
    }
Exemple #19
0
    void SpawnDeityLine()
    {
        if (actualDialogue >= dialogues.Length || string.IsNullOrEmpty(dialogues[actualDialogue].deityLine))
        {
            toShogunCallback.Invoke();
            blockInput = true;
            return;
        }

        FlushWriter();

        if (actualDialogue == 0)
        {
            deityAnim.Play("Spawn");
            AudioManager.PlaySound("DeityIntro");
        }
        else
        {
            deityAnim.Play("Show");
        }

        actualWriter.SetAudio(() => AudioManager.PlaySound("Writting"), () => AudioManager.StopSound("Writting"));
        actualWriter.Play(dialogues[actualDialogue].deityLine, deitySpeed, deityTrail, Skinning.GetSkin(deityHighlight), Skinning.GetSkin(deityText));

        actualWriter.GetComponent <TextMeshProUGUI>().font        = deityFont;
        actualWriter.GetComponent <TextMeshProUGUI>().wordSpacing = 0;

        spawnAsked   = false;
        isPlayerNext = true;
        actualDialogue++;
    }
Exemple #20
0
    void ShowPunchlines(List <Punchline> punchlines, Category buttonCategory)
    {
        selectedCategory = buttonCategory;

        AudioManager.PlaySound("Button");
        Invoke("Swish", 0.4f);

        foreach (Transform transform in punchlineScroll)
        {
            Destroy(transform.gameObject);
        }

        foreach (Punchline punchline in punchlines)
        {
            Button temp = Instantiate(punchlinePrefab, punchlineScroll);
            temp.onClick.AddListener(() =>
            {
                usedPunchlines.Add(punchline);
                selectedPunchline = punchline;

                actualPhase = Phase.EFFECT_GENERAL;

                canvasAnimator.Play("PanDown");
                Invoke("ShowAttackLines", 1);

                AudioManager.PlaySound("Button");

                ConclusionCard selected = null;

                spawnedConclusions.ForEach(item =>
                {
                    if (item.IsCorrelated(punchline))
                    {
                        selected = item;
                    }
                });

                if (selected != null)
                {
                    spawnedConclusions.Remove(selected);
                    Destroy(selected.gameObject);
                }

                SetCanvasInterractable(false);

                foreach (Transform transform in punchlineScroll)
                {
                    Destroy(transform.gameObject);
                }
            });

            if (string.IsNullOrEmpty(punchline.line))
            {
                temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponentInChildren <TextMeshProUGUI>().text = punchline.subCategory.ToString();
            }
            else
            {
                temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponentInChildren <TextMeshProUGUI>().text = punchline.line;
            }

            Color categoryColor = GameData.GetColorFromCategory(GameData.GetCategoryFromSubCategory(punchline.subCategory));

            ColorBlock colors = temp.colors;
            colors.normalColor      = Skinning.GetSkin(SkinTag.SECONDARY_WINDOW);
            colors.pressedColor     = categoryColor;
            colors.highlightedColor = ColorTools.LerpColorValues(categoryColor, ColorTools.Value.SV, new int[2] {
                -20, -30
            });
            colors.disabledColor = Skinning.GetSkin(SkinTag.PRIMARY_WINDOW);
            temp.colors          = colors;

            temp.interactable = !usedPunchlines.Contains(punchline);
            temp.transform.GetChild(0).GetComponent <Image>().color = temp.interactable ? Skinning.GetSkin(SkinTag.SECONDARY_ELEMENT) : Skinning.GetSkin(SkinTag.SECONDARY_WINDOW);

            temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().font        = streetFont;
            temp.transform.GetChild(2).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().wordSpacing = 5;
            temp.GetComponent <Animator>().Play("Open");
        }
    }