Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new CharacterInfo.
 /// </summary>
 /// <param name='actorID'>
 /// Actor ID.
 /// </param>
 /// <param name='actorName'>
 /// Name of the actor as defined in the dialogue database.
 /// </param>
 /// <param name='transform'>
 /// Transform.
 /// </param>
 /// <param name='characterType'>
 /// Character type.
 /// </param>
 /// <param name='portrait'>
 /// Portrait.
 /// </param>
 public CharacterInfo(int id, string nameInDatabase, Transform transform, CharacterType characterType, Texture2D portrait)
 {
     this.id             = id;
     this.nameInDatabase = nameInDatabase;
     this.characterType  = characterType;
     this.portrait       = portrait;
     this.transform      = transform;
     if ((transform == null) && !string.IsNullOrEmpty(nameInDatabase))
     {
         GameObject go = SequencerTools.FindSpecifier(nameInDatabase);
         if (go != null)
         {
             this.transform = go.transform;
         }
     }
     Name = (transform == null) ? nameInDatabase : OverrideActorName.GetActorName(transform);
 }
Ejemplo n.º 2
0
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            GameObject trackBinding = playerData as GameObject;

            if (!trackBinding)
            {
                return;
            }

            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <StartConversationBehaviour> inputPlayable = (ScriptPlayable <StartConversationBehaviour>)playable.GetInput(i);
                    StartConversationBehaviour input = inputPlayable.GetBehaviour();
                    if (Application.isPlaying)
                    {
                        if (input.entryID <= 0)
                        {
                            DialogueManager.StartConversation(input.conversation, trackBinding.transform, input.conversant);
                        }
                        else
                        {
                            DialogueManager.StartConversation(input.conversation, trackBinding.transform, input.conversant, input.entryID);
                        }
                    }
                    else
                    {
                        var message = OverrideActorName.GetActorName(trackBinding.transform) + " conversation: " + input.conversant;
                        PreviewUI.ShowMessage(message, 2, 0);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
Ejemplo n.º 3
0
        // NOTE: This function is called at runtime and edit time.  Keep that in mind when setting the values of properties.
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            GameObject trackBinding = playerData as GameObject;

            if (!trackBinding)
            {
                return;
            }

            int inputCount = playable.GetInputCount();

            for (int i = 0; i < inputCount; i++)
            {
                float inputWeight = playable.GetInputWeight(i);
                if (inputWeight > 0.001f && !played.Contains(i))
                {
                    played.Add(i);
                    ScriptPlayable <BarkBehaviour> inputPlayable = (ScriptPlayable <BarkBehaviour>)playable.GetInput(i);
                    BarkBehaviour input = inputPlayable.GetBehaviour();
                    if (Application.isPlaying)
                    {
                        if (input.useConversation)
                        {
                            DialogueManager.Bark(input.conversation, trackBinding.transform, input.listener);
                        }
                        else
                        {
                            DialogueManager.BarkString(input.text, trackBinding.transform, input.listener);
                        }
                    }
                    else
                    {
                        var message = OverrideActorName.GetActorName(trackBinding.transform) + " bark: " + input.GetEditorBarkText();
                        PreviewUI.ShowMessage(message, 2, 1);
                    }
                }
                else if (inputWeight <= 0.001f && played.Contains(i))
                {
                    played.Remove(i);
                }
            }
        }
Ejemplo n.º 4
0
 private string GetBarkerName()
 {
     return(OverrideActorName.GetActorName(GetBarker()));
 }