예제 #1
0
        private void OnSpeechBubbleFinished(SpeechBubbleBase sender, Transform followedObject)
        {
            SpeechBubbleFinishedEvent?.Invoke();

            if (followedObject == null)
            {
                return;
            }
            if (_actorBubblesMapping.TryGetValue(followedObject, out var actorBubbles))
            {
                actorBubbles.Remove(sender);
                UpdateActorSpeechBubblesOffsets(actorBubbles);
            }
        }
예제 #2
0
        /// <summary>
        /// Adds a speechbubble to a certain position
        /// </summary>
        /// <param name="position"></param>
        /// <param name="text"></param>
        /// <param name="type"></param>
        /// <param name="timeToLive"></param>
        /// <param name="color"></param>
        public SpeechBubbleBase AddSpeechBubble(Vector3 position, string text, SpeechbubbleType type = SpeechbubbleType.NORMAL, float timeToLive = 0, Color color = default(Color))
        {
            if (timeToLive == 0)
            {
                timeToLive = _defaultTimeToLive;
            }
            if (color == default)
            {
                color = _defaultColor;
            }
            SpeechBubbleBase bubbleBehaviour = GetBubble(type);

            bubbleBehaviour.Setup(position, text, timeToLive, color, Cam);
            _speechBubbleQueueDict[type].Enqueue(bubbleBehaviour);
            return(bubbleBehaviour);
        }
예제 #3
0
        /// <summary>
        /// Adds a speechbubble that will follow a certain transform.
        /// It is recommended you use a character's head or mouth transform.
        /// </summary>
        /// <param name="objectToFollow"></param>
        /// <param name="text"></param>
        /// <param name="type"></param>
        /// <param name="timeToLive">if 0 then will use default time to live</param>
        /// <param name="color">Color to tint, default will be white</param>
        /// <param name="offset">Offset from objectToFollow</param>
        public SpeechBubbleBase AddSpeechBubble(Transform objectToFollow, string text, SpeechbubbleType type = SpeechbubbleType.NORMAL, float timeToLive = 0, Color color = default(Color), Vector3 offset = new Vector3())
        {
            if (timeToLive == 0)
            {
                timeToLive = _defaultTimeToLive;
            }
            if (color == default)
            {
                color = _defaultColor;
            }

            SpeechBubbleBase bubbleBehaviour = GetBubble(type);

            bubbleBehaviour.Setup(objectToFollow, offset, text, timeToLive, color, Cam);
            _speechBubbleQueueDict[type].Enqueue(bubbleBehaviour);

            if (objectToFollow != null)
            {
                SetupSpeechBubbleOffsetInRelationToActor(objectToFollow, bubbleBehaviour);
            }

            return(bubbleBehaviour);
        }
예제 #4
0
        private void SetupSpeechBubbleOffsetInRelationToActor(Transform objectToFollow, SpeechBubbleBase bubbleBehaviour)
        {
            var actorBubbles = GetOrCreateSpeechBubblesCollectionForActor(objectToFollow);

            actorBubbles.Add(bubbleBehaviour);
            UpdateActorSpeechBubblesOffsets(actorBubbles);
        }