Example #1
0
 /// <summary>
 /// Add a chunk to the body, becomes the sole SpeechChunk
 /// if it is a SpeechChunk.
 /// </summary>
 /// <param name="chunk">The chunk to add</param>
 public void AddChunk(BMLChunk chunk)
 {
     if (chunk.Type == BMLChunkType.Speech)
         SpeechChunk = chunk as Speech;
     else {
         if (chunks.ContainsKey(chunk.ID)) return;
         chunks.Add(chunk.ID, chunk);
         latestEnd = Math.Max(latestEnd, chunk.End);
     }
 }
Example #2
0
 public void ScheduleBehaviour(BMLChunk chunk)
 {
     //Debug.Log ("executing " + chunk.ID + " at " + Time.time + " in " + chunk.Start);
     switch (chunk.Type) {
         case BMLChunkType.Face:
             StartCoroutine(Schedule(chunk as Face));
             break;
         case BMLChunkType.FaceEmotion:
             StartCoroutine(Schedule(chunk as FaceEmotion));
             break;
         case BMLChunkType.Gaze:
             StartCoroutine(Schedule(chunk as Gaze));
             break;
         case BMLChunkType.GazeShift:
             StartCoroutine(Schedule(chunk as GazeShift));
             break;
         case BMLChunkType.Gesture:
             StartCoroutine(Schedule(chunk as Gesture));
             break;
         case BMLChunkType.Pointing:
             StartCoroutine(Schedule(chunk as Pointing));
             break;
         case BMLChunkType.Grasping:
             StartCoroutine(Schedule(chunk as Grasp));
             break;
         case BMLChunkType.Placing:
             StartCoroutine(Schedule(chunk as Place));
             break;
         case BMLChunkType.Head:
             StartCoroutine(Schedule(chunk as Head));
             break;
         case BMLChunkType.Locomotion:
             StartCoroutine(Schedule(chunk as Locomotion));
             break;
         case BMLChunkType.Posture:
             StartCoroutine(Schedule(chunk as Posture));
             break;
         case BMLChunkType.Speech:
             StartCoroutine(Schedule(chunk as Speech));
             break;
         case BMLChunkType.Vocalisation:
             StartCoroutine(Schedule(chunk as Vocalisation));
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Example #3
0
        public void Spawn(BMLChunk chunk)
        {
            //Debug.Log ("spawninating");
            float x = Time.time * TimeScaler;
            if (x > ContentBox.sizeDelta.x) {
                ContentBox.sizeDelta = new Vector2(x + 20f * TimeScaler, ContentBox.sizeDelta.y);
            }
            Color color;
            Vector2 position = new Vector2(x, Random.Range(0, ContentBox.rect.height - DotPrefab.GetComponent<RectTransform>().rect.height));
            string text = Time.time + "  (" + chunk.ID + ") ";
            switch (chunk.Type) {
                case BMLChunkType.Face:
                    var fchunk = chunk as Face;
                    text += fchunk.ToString();
                    color = Face;
                    break;
                case BMLChunkType.FaceEmotion:
                    var fechunk = chunk as FaceEmotion;
                    text += fechunk.ToString();
                    color = Face;
                    break;
                case BMLChunkType.Gaze:
                    color = Gaze;
                    var gchunk = chunk as Gaze;
                    text += gchunk.ToString();
                    break;
                case BMLChunkType.GazeShift:
                    var gschunk = chunk as GazeShift;
                    text += gschunk.ToString();
                    color = Gaze;
                    break;
                case BMLChunkType.Gesture:
                    var gechunk = chunk as Gesture;
                    text += gechunk.ToString();
                    color = Gesture;
                    break;
                case BMLChunkType.Head:
                    var hchunk = chunk as Head;
                    text += hchunk.ToString();
                    color = Head;
                    break;
                case BMLChunkType.Locomotion:
                    var lchunk = chunk as Locomotion;
                    text += lchunk.ToString();
                    color = Locomotion;
                    break;
                case BMLChunkType.Posture:
                    var pchunk = chunk as Posture;
                    text += pchunk.ToString() + " ";
                    foreach (var pose in pchunk.Poses) {
                        text += pose.ToString() + " ";
                    }
                    color = Posture;
                    break;
                case BMLChunkType.Speech:
                    color = Speech;
                    var schunk = chunk as Speech;
                    text += schunk.ToString();
                    break;
                case BMLChunkType.Pointing:
                    color = Pointing;
                    Pointing pointchunk = chunk as Pointing;
                    text += pointchunk.ToString();
                    break;
                case BMLChunkType.Placing:
                    color = Pointing;
                    Place placeChunk = chunk as Place;
                    text += placeChunk.ToString();
                    break;
                case BMLChunkType.Grasping:
                    color = Pointing;
                    Grasp graspChunk = chunk as Grasp;
                    text += graspChunk.ToString();
                    break;
                default:
                    throw new System.ArgumentOutOfRangeException();
            }

            GameObject dot = Instantiate(DotPrefab);
            dot.transform.SetParent(ContentBox.transform, false);
            Image img = dot.GetComponent<Image>();
            RectTransform rt = dot.GetComponent<RectTransform>();
            UIHoverInfo hi = dot.AddComponent<UIHoverInfo>();
            img.CrossFadeColor(color, 0f, true, false);
            rt.anchoredPosition = position;
            hi.Text = text;
            hi.TextField = HoverText;
        }
Example #4
0
 public void OnChunkStart(BMLChunk chunk)
 {
     bmlDebug.Spawn(chunk);
 }