public static BulletBehavior Build(SubjectBehavior subject) { BulletBehavior bullet = subject.gameObject.AddComponent <BulletBehavior>(); bullet.subject = subject; return(bullet); }
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); }
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; }
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); } } }
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(); }
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(); } } }
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()); }