예제 #1
0
        protected static BubbleData GenerateBubble(NPC cha, string text, GameObject talker = null)
        {
            var newBubble = new BubbleData(text, new Vector2(40, 60), new Vector2(40, 45), talker)
            {
                TextColor        = cha.getTextFrontColor(),
                TextOutlineColor = cha.getTextBorderColor(),
                BaseColor        = cha.getBubbleBkgColor(),
                OutlineColor     = cha.getBubbleBorderColor()
            };

            if (talker != null)
            {
                Vector3 position = talker.transform.position;

                newBubble.Origin  = position;
                newBubble.Destiny = position + Camera.main.transform.up * talker.transform.lossyScale.y * 0.6f;
            }
            else
            {
                newBubble.Origin  = Camera.main.transform.position;
                newBubble.Destiny = Camera.main.transform.position + Camera.main.transform.up * 15;
            }

            return(newBubble);
        }
예제 #2
0
        public void ShowBubble(BubbleData data)
        {
            data.origin  = SceneVector2GuiVector(data.origin);
            data.destiny = SceneVector2GuiVector(data.destiny);

            if (bubble != null)
            {
                bubble.GetComponent <Bubble>().destroy();
            }
            if (data.Line.Length > 0 && data.Line[0] == '#')
            {
                if (data.Line[1] == 'O')
                {
                    bubble = GameObject.Instantiate(Think_Prefab);
                }
                else if (data.Line[1] == '!')
                {
                    bubble = GameObject.Instantiate(Yell_Prefab);
                }

                data.Line = data.Line.Substring(3, data.Line.Length - 3);
            }
            else
            {
                bubble = GameObject.Instantiate(Bubble_Prefab);
            }

            bubble.GetComponent <Bubble>().Data = data;
            bubble.transform.SetParent(this.transform);
            bubble.transform.localRotation = Quaternion.Euler(0, 0, 0);
            bubble.transform.localPosition = new Vector3(bubble.transform.localPosition.x, bubble.transform.localPosition.y, 0);
        }
예제 #3
0
 private void correctBoundaries(BubbleData bubble)
 {
     if (bubble.destiny.x <= 125f)
     {
         bubble.destiny.x = 125f;
     }
     else if (bubble.destiny.x >= (800f - 125f))
     {
         bubble.destiny.x = (800f - 125f);
     }
 }
예제 #4
0
        protected static BubbleData GenerateBubble(string text, int x, int y, bool showBorder, Color textColor, Color textOutlineColor, Color baseColor, Color outlineColor)
        {
            var destiny    = SceneMB.ToWorldSize(new Vector2(x, y));
            var bubbleData = new BubbleData(text, destiny, destiny - new Vector3(0, -15, 0))
            {
                TextColor        = textColor,
                TextOutlineColor = textOutlineColor
            };

            if (showBorder)
            {
                bubbleData.BaseColor    = baseColor;
                bubbleData.OutlineColor = outlineColor;
            }

            return(bubbleData);
        }
예제 #5
0
        public void Talk(string text, string talker_name = null)
        {
            last_text = text;
            if (talker_name == null || talker_name == Player.IDENTIFIER)
            {
                text = text.Replace("[]", "[" + Player.IDENTIFIER + "]");
                NPC        player = Game.Instance.GameState.getPlayer();
                BubbleData bubble;

                if (Game.Instance.GameState.isFirstPerson())
                {
                    bubble = generateBubble(player, text);
                }
                else
                {
                    GameObject talker_object = getTalker(talker_name);
                    if (talker_object == null)
                    {
                        return;
                    }
                    bubble = generateBubble(player, text, talker_object);
                }

                GUIManager.Instance.ShowBubble(bubble);
            }
            else
            {
                GameObject talker_object = getTalker(talker_name);
                if (talker_object == null)
                {
                    return;
                }

                NPC        cha    = Game.Instance.GameState.getCharacter(talker_name);
                BubbleData bubble = generateBubble(cha, text, talker_object);
                GUIManager.Instance.ShowBubble(bubble);
            }
        }