Ejemplo n.º 1
0
 public void Initialize(Recorder recorder)
 {
     bulletsFired    = 0;
     this.recorder   = recorder;
     subjectBehavior = SubjectBehavior.Build(gameObject, recorder, 5, "Player", new Dictionary <string, string>()
     {
         { "Bullets Fired", "0" }
     }, 0.0001f);
 }
Ejemplo n.º 2
0
 private void SetUpObjectsToTrack()
 {
     for (int i = 0; i < positions.Length; i++)
     {
         objectsToTrack[i] = GameObject.CreatePrimitive(PrimitiveType.Cube);
         objectsToTrack[i].AddComponent <Rigidbody>();
         objectsToTrack[i].transform.position = positions[i];
         SubjectBehavior.Build(objectsToTrack[i], recorder);
     }
     recorder.Register(player.gameObject.GetComponent <SubjectBehavior>().GetSubjectRecorder());
     boxesDestroyed = 0;
 }
Ejemplo n.º 3
0
 public void OnSourceDetected(SourceStateEventData eventData)
 {
     Debug.Log("new source");
     if (eventData.Controller != null)
     {
         if (recording)
         {
             Debug.Log("Source added to record");
             SubjectBehavior.Build(eventData.Controller.Visualizer.GameObjectProxy, recorder);
         }
     }
 }
Ejemplo n.º 4
0
    public void StartRecording()
    {
        Debug.Log("Started Recording");
        recorder = ScriptableObject.CreateInstance <Recorder>();
        foreach (var hand in GetHandsToRecord())
        {
            if (hand != null)
            {
                Utility.ForEachChild(hand.transform, child =>
                {
                    SubjectBehavior.Build(child.gameObject, recorder);
                });
            }
        }

        recorder.Start();
    }
Ejemplo n.º 5
0
        private void DisplayRecordingControls()
        {
            if (currentRecordingMethod == RecordingMethod.Recorder)
            {
                if (recorder == null)
                {
                    return;
                }
                switch (recorder.CurrentState())
                {
                case RecordingState.Stopped:
                    if (GUILayout.Button("Start Recording"))
                    {
                        recorder.Start();
                        timeStartedRecording = Time.realtimeSinceStartup;
                    }
                    break;

                case RecordingState.Recording:
                    RenderCurrentlyRecordingSection();
                    break;
                }
            }
            else if (currentRecordingMethod == RecordingMethod.Subjects)
            {
                if ((recorder == null || recorder.CurrentlyStopped()) && GUILayout.Button("Start Recording"))
                {
                    if (recorder == null)
                    {
                        recorder = ScriptableObject.CreateInstance <Recorder>();
                    }
                    recorder.ClearSubjects();
                    foreach (var subject in subjects)
                    {
                        SubjectBehavior.Build(subject, recorder);
                    }
                    recorder.Start();
                    timeStartedRecording = Time.realtimeSinceStartup;
                }
                else if (recorder != null && recorder.CurrentlyRecording())
                {
                    RenderCurrentlyRecordingSection();
                }
            }
        }
Ejemplo n.º 6
0
        private void Fire()
        {
            var bullet = GameObject.CreatePrimitive(PrimitiveType.Sphere);

            bullet.transform.localScale = Vector3.one * .4f;
            bullet.transform.position   = bulletSpawn.position;

            BulletBehavior.Build(SubjectBehavior.Build(bullet, recorder, "Bullet"));

            var rb = bullet.AddComponent <Rigidbody>();

            rb.velocity = transform.forward * 15;
            rb.mass     = 3;

            Destroy(bullet, 5);
            bulletsFired++;
            subjectBehavior.SetMetaData("Bullets Fired", bulletsFired.ToString());
        }