Add Timeline Handler for BTC; integrate first chatbot anims to story
This commit is contained in:
		
							parent
							
								
									18d04fc29e
								
							
						
					
					
						commit
						dbc8f9dc1a
					
				@ -495,11 +495,11 @@ MonoBehaviour:
 | 
			
		||||
  - {fileID: 5507569759037005138}
 | 
			
		||||
  - {fileID: 3818191983791096580}
 | 
			
		||||
  - {fileID: 6311139388440893090}
 | 
			
		||||
  m_FixedDuration: 0
 | 
			
		||||
  m_FixedDuration: 5.433333333333334
 | 
			
		||||
  m_EditorSettings:
 | 
			
		||||
    m_Framerate: 60
 | 
			
		||||
    m_ScenePreview: 1
 | 
			
		||||
  m_DurationMode: 0
 | 
			
		||||
  m_DurationMode: 1
 | 
			
		||||
  m_MarkerTrack: {fileID: 3035553712261358546}
 | 
			
		||||
--- !u!114 &3035553712261358546
 | 
			
		||||
MonoBehaviour:
 | 
			
		||||
 | 
			
		||||
@ -12,8 +12,11 @@
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Composite(Sequence) {
 | 
			
		||||
                RunTree("26_Castello_Castelli_di_Bellinzona_Intro")
 | 
			
		||||
                //RunTree("26_Castello_Castelli_di_Bellinzona_Intro")
 | 
			
		||||
                //RunTree("26_Castello_Castelli_di_Bellinzona_Geschichte_Castelli")
 | 
			
		||||
 | 
			
		||||
                RunTree("26_Castello_Castelli_di_Bellinzona_Chatbot_Init") 
 | 
			
		||||
                RunTree("26_Castello_Castelli_di_Bellinzona_Chatbot_Burgen")
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -408,10 +411,15 @@ Tree("26_Castello_Castelli_di_Bellinzona_Chatbot_Burgen") {
 | 
			
		||||
        BTC.Run("Depthkit.VIDEOS.ChatbotBurgen1Cast")
 | 
			
		||||
        BTC.Hide("Depthkit.VIDEOS.ChatbotBurgen1Cast")
 | 
			
		||||
 | 
			
		||||
        BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_Start")
 | 
			
		||||
 | 
			
		||||
        BTC.Show("Depthkit.VIDEOS.ChatbotBurgen2Cast")
 | 
			
		||||
        BTC.Run("Depthkit.VIDEOS.ChatbotBurgen2Cast")
 | 
			
		||||
        BTC.Hide("Depthkit.VIDEOS.ChatbotBurgen2Cast")
 | 
			
		||||
 | 
			
		||||
        BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_ThinkStart")
 | 
			
		||||
        BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_ThinkEnd")
 | 
			
		||||
 | 
			
		||||
        BTC.SynthesizeText("Per proteggere la città dagli attacchi nemici. Vuoi saperne di più?")
 | 
			
		||||
        BTC.SpeechOutputEnded()
 | 
			
		||||
 | 
			
		||||
@ -509,6 +517,9 @@ Tree("26_Castello_Castelli_di_Bellinzona_Geschichte_Castelli_Bot") {
 | 
			
		||||
        BTC.Run("Depthkit.VIDEOS.GeschichteCastelli_Bot1_02")
 | 
			
		||||
        BTC.Hide("Depthkit.VIDEOS.GeschichteCastelli_Bot1_02")
 | 
			
		||||
 | 
			
		||||
        BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_ThinkStart")
 | 
			
		||||
        BTC.Run("Timeline.TIMELINES.TimelineCastelloCh_atbot_ThinkEnd")
 | 
			
		||||
 | 
			
		||||
        BTC.SynthesizeText("La valle veniva chiusa costruendo la cinta muraria della città e la Murata. In questo modo nessuno poteva attraversare i passi alpini del Gottardo, del San Bernardino, della Novena e del Lucomagno. Bellinzona si trovava su un'importante via commerciale tra il nord e il sud dell'Europa.")
 | 
			
		||||
        BTC.SpeechOutputEnded()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										96
									
								
								Viagg-io/Assets/Packages/MyBT/BTC/Handlers/NamedTimeline.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								Viagg-io/Assets/Packages/MyBT/BTC/Handlers/NamedTimeline.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,96 @@
 | 
			
		||||
//============= Copyright (c) Ludic GmbH, All rights reserved. ==============
 | 
			
		||||
//
 | 
			
		||||
// Purpose: Part of the My Behaviour Tree Controller Code
 | 
			
		||||
//
 | 
			
		||||
//=============================================================================
 | 
			
		||||
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using UnityEngine;
 | 
			
		||||
using MyBT;
 | 
			
		||||
using UnityEngine.Playables;
 | 
			
		||||
 | 
			
		||||
#if UNITY_EDITOR
 | 
			
		||||
using UnityEditor;
 | 
			
		||||
[CustomEditor(typeof(NamedTimeline))]
 | 
			
		||||
public class NamedTimelineInspector : ComponentHandlerInspector
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
[System.Serializable]
 | 
			
		||||
public class NamedTimeline : ComponentHandler
 | 
			
		||||
{
 | 
			
		||||
    public override string TypeLabel()
 | 
			
		||||
    {
 | 
			
		||||
        return "Timeline";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public override string ContentLabel()
 | 
			
		||||
    {
 | 
			
		||||
        UpdateComponent();
 | 
			
		||||
        return _playableDirector?.playableAsset.name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public override void UpdateComponent()
 | 
			
		||||
    {
 | 
			
		||||
        base.UpdateComponent();
 | 
			
		||||
        _playableDirector = GetComponent<PlayableDirector>();
 | 
			
		||||
        //playableDuration = _playableDirector.duration;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //public double playableDuration;
 | 
			
		||||
 | 
			
		||||
    private PlayableDirector _playableDirector;
 | 
			
		||||
    //private double _startTime;
 | 
			
		||||
 | 
			
		||||
    public override string titleText
 | 
			
		||||
    {
 | 
			
		||||
        get
 | 
			
		||||
        {
 | 
			
		||||
            return "Run Timeline";
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public override string[][] helpText
 | 
			
		||||
    {
 | 
			
		||||
        get
 | 
			
		||||
        {
 | 
			
		||||
            return new string[][] {
 | 
			
		||||
                new string[] {"Run", null, $"BTC.Run(\"{roomId}\", \"{gameObject.name}\")"},
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public override void Run(MyBT.NodeState nodeState)
 | 
			
		||||
    {
 | 
			
		||||
        // at start
 | 
			
		||||
        if (nodeState == NodeState.FirstRun)
 | 
			
		||||
        {
 | 
			
		||||
            if (_playableDirector == null)
 | 
			
		||||
            {
 | 
			
		||||
                Task.SetFailed();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            _playableDirector.Play();
 | 
			
		||||
          //  _startTime = Time.time;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // during runtime
 | 
			
		||||
        if (nodeState == NodeState.Running)
 | 
			
		||||
        {
 | 
			
		||||
          /*  if (Time.time - _startTime >= playableDuration)
 | 
			
		||||
            {
 | 
			
		||||
                Task.SetSucceeded();
 | 
			
		||||
                return;
 | 
			
		||||
            }*/
 | 
			
		||||
            if (_playableDirector?.state != PlayState.Playing)
 | 
			
		||||
            {
 | 
			
		||||
                Task.SetSucceeded();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,11 @@
 | 
			
		||||
fileFormatVersion: 2
 | 
			
		||||
guid: e625e8f4b064a455293d51adea1c73b3
 | 
			
		||||
MonoImporter:
 | 
			
		||||
  externalObjects: {}
 | 
			
		||||
  serializedVersion: 2
 | 
			
		||||
  defaultReferences: []
 | 
			
		||||
  executionOrder: 0
 | 
			
		||||
  icon: {instanceID: 0}
 | 
			
		||||
  userData: 
 | 
			
		||||
  assetBundleName: 
 | 
			
		||||
  assetBundleVariant: 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user