Ejemplo n.º 1
0
 public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     if (scene.name != "MenuScene" && scene.name != "CreditsScene")
     {
         inkTypewriterText = GameObject.Find("DialogueCanvas").GetComponent <InkTypewriterText>();
         StartCoroutine(LateStart());
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        inkTypewriterText  = GameObject.Find("DialogueCanvas").GetComponent <InkTypewriterText>();
        playerAchievements = GameObject.Find("PlayerStats").GetComponent <PlayerAchievements>();
        turnBarScript      = GameObject.Find("TurnBar").GetComponent <TurnBarScript>();

        turnBarScript.SpeedModifier = 0;

        dodgeInitial = playerAchievements.ConsecutiveProjectilesDodged;



        FindObjectOfType <PlayerScript>().moveEvent += OnPlayerMove;
        objectPooler = ObjectPooler.Instance;

        GameObject.Find("PlayerCombat").GetComponent <EntityStatus>().StatusEffects.Add(StatusEffect.Endure);

        StartCoroutine(LateStart());
    }
Ejemplo n.º 3
0
        void GetLastCharData(InkTypewriterText typewriterText)
        {
            string taglessText       = TextTagParser.RemoveAllTags(currentText);
            int    totalPrintedChars = taglessText.Length;
            int    lastChar          = totalPrintedChars - 1;

            //typewriterText.TagSetSpeaker(this.speakerAssetTriggers[totalPrintedChars - 1]);
            //typewriterText.TagSetExpression(this.characterExpressionTriggers[totalPrintedChars - 1]);
            //typewriterText.TagSetAlignment(this.alignmentTriggers[totalPrintedChars - 1]);

            this.UpdateMeshAndAnims();

            this.OnCharacterPrinted(taglessText[totalPrintedChars - 1].ToString());



            if (this.speakerAssetTriggers[totalPrintedChars - 1] != typewriterText.changeSpeaker)
            {
                typewriterText.TagSetSpeaker(this.speakerAssetTriggers[totalPrintedChars - 1]);
            }

            if (this.characterExpressionTriggers[totalPrintedChars - 1] != typewriterText.changeExpression)
            {
                typewriterText.TagSetExpression(this.characterExpressionTriggers[totalPrintedChars - 1]);
            }

            if (this.characterExpressionTriggers[totalPrintedChars - 1] != (int)typewriterText.dialogueBoxPosition)
            {
                typewriterText.TagSetAlignment(this.alignmentTriggers[totalPrintedChars - 1]);
            }

            if (this.invokeTriggers[totalPrintedChars - 1] != null)
            {
                typewriterText.Invoke(this.invokeTriggers[totalPrintedChars - 1], 0);
            }

            if (this.refreshTriggers[totalPrintedChars - 1] != false)
            {
                typewriterText.RefreshSpeaker();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Types the text into the Text component character by character, using the specified (optional) print delay per character.
        /// </summary>
        /// <param name="text">Text to type.</param>
        /// <param name="printDelay">Print delay (in seconds) per character.</param>
        public void TypeText(string text, InkTypewriterText typewriterText, float printDelay = -1)
        {
            advancedTypewriterText = typewriterText;
            currentText            = text;
            defaultSpeaker         = typewriterText.changeSpeaker;

            this.CleanupCoroutine();



            // Remove all existing TextAnimations
            // TODO - Would be better to pool/reuse these components
            foreach (var anim in GetComponents <TextAnimation>( ))
            {
                Destroy(anim);
            }

            this.defaultPrintDelay = printDelay > 0 ? printDelay : PrintDelaySetting;
            this.ProcessCustomTags(text);

            this.typeTextCoroutine = this.StartCoroutine(this.TypeTextCharByChar(text, typewriterText));
        }
 // Start is called before the first frame update
 void Start()
 {
     inkTypewriterText = GameObject.Find("DialogueCanvas").GetComponent <InkTypewriterText>();
     objectPooler      = ObjectPooler.Instance;
     StartCoroutine(LateStart());
 }
Ejemplo n.º 6
0
        private IEnumerator TypeTextCharByChar(string text, InkTypewriterText typewriterText)
        {
            string taglessText       = TextTagParser.RemoveAllTags(text);
            int    totalPrintedChars = taglessText.Length;

            int currPrintedChars = 1;

            this.TextComponent.text = TextTagParser.RemoveCustomTags(text);

            typewriterText.TagSetSpeaker(this.speakerAssetTriggers[currPrintedChars]);

            typewriterText.TagSetExpression(this.characterExpressionTriggers[currPrintedChars]);

            if (this.invokeTriggers[currPrintedChars] != null)
            {
                typewriterText.Invoke(this.invokeTriggers[currPrintedChars], 0);
            }

            typewriterText.TagSetAlignment(this.alignmentTriggers[currPrintedChars]);
            typewriterText.RefreshSpeaker();

            do
            {
                this.TextComponent.maxVisibleCharacters = currPrintedChars;
                this.UpdateMeshAndAnims();

                this.OnCharacterPrinted(taglessText[currPrintedChars - 1].ToString());

                if (this.speakerAssetTriggers[currPrintedChars - 1] != typewriterText.changeSpeaker)
                {
                    typewriterText.TagSetSpeaker(this.speakerAssetTriggers[currPrintedChars - 1]);
                }

                if (this.characterExpressionTriggers[currPrintedChars - 1] != typewriterText.changeExpression)
                {
                    typewriterText.TagSetExpression(this.characterExpressionTriggers[currPrintedChars - 1]);
                }

                if (this.characterExpressionTriggers[currPrintedChars - 1] != (int)typewriterText.dialogueBoxPosition)
                {
                    typewriterText.TagSetAlignment(this.alignmentTriggers[currPrintedChars - 1]);
                }

                if (this.invokeTriggers[currPrintedChars - 1] != null)
                {
                    typewriterText.Invoke(this.invokeTriggers[currPrintedChars - 1], 0);
                }

                if (this.refreshTriggers[currPrintedChars - 1] != false)
                {
                    typewriterText.RefreshSpeaker();
                }


                yield return(new WaitForSecondsRealtime(this.characterPrintDelays[currPrintedChars - 1]));

                ++currPrintedChars;
            }while (currPrintedChars <= totalPrintedChars);

            this.typeTextCoroutine = null;
            this.OnTypewritingComplete();
        }