示例#1
0
 public PlaybackStateInfo(Recording recording, IActorBuilder actorBuilder, IPlaybackCustomEventHandler eventHandler, Transform actorsParent, bool loop)
 {
     this.recording    = recording;
     this.actorBuilder = actorBuilder;
     this.eventHandler = eventHandler;
     this.actorsParent = actorsParent;
     this.loop         = loop;
     playbackSpeed     = 1;
 }
 /// <summary>
 /// Build a new ActorPlaybackControl.
 /// </summary>
 /// <param name="representation">The actor meant to represent the subject during playback.</param>
 /// <param name="customEventHandler">Handles custom events that occurs to the subject in the recording.</param>
 /// <param name="recording">The recording containing this subject's recording and potentially others.</param>
 /// <param name="subjectRecording">The recording we will be acting out with the representaion provided.</param>
 public ActorPlaybackControl(GameObject representation, IPlaybackCustomEventHandler customEventHandler, Recording recording, SubjectRecording subjectRecording)
 {
     this.representation     = representation;
     this.customEventHandler = customEventHandler;
     this.recording          = recording;
     this.subjectRecording   = subjectRecording;
     hasStartEvent           = HasStartEvent();
     lastTimeThroughPlayback = 0;
     lastPositionIndex       = 0;
 }
示例#3
0
 /// <summary>
 /// Create a new actor with a null event handler.
 /// </summary>
 /// <param name="representation">The object to represent the subject.</param>
 public Actor(GameObject representation)
 {
     this.representation     = representation;
     this.customEventHandler = null;
 }
示例#4
0
        /// <summary>
        /// Creates an empty GameObject and attatches an instance of the PlaybackBehavior to it.
        /// </summary>
        /// <param name="recording">The recording to playback.</param>
        /// <param name="actorBuilder">What is used to build the actors.</param>
        /// <param name="onEvent">What to call when an event occurs.</param>
        /// <param name="loop">Whether or not for the recoding playback to start over when it reaches the end.</param>
        /// <returns></returns>
        public static PlaybackBehavior Build(Recording recording, IActorBuilder actorBuilder, IPlaybackCustomEventHandler onEvent, bool loop)
        {
            PlaybackBehavior playbackBehavior = new GameObject("PLAYBACK OBJECT").AddComponent <PlaybackBehavior>();

            playbackBehavior.stateInfo            = new PlaybackStateInfo(recording, actorBuilder, onEvent, playbackBehavior.transform, loop);
            playbackBehavior.currentPlaybackState = new StoppedPlaybackState(playbackBehavior.stateInfo);

            return(playbackBehavior);
        }
示例#5
0
 /// <summary>
 /// Create a new actor.
 /// </summary>
 /// <param name="representation">The object to represent the subject.</param>
 /// <param name="customEventHandler">The handler for all events that occur to the specific subject.</param>
 public Actor(GameObject representation, IPlaybackCustomEventHandler customEventHandler)
 {
     this.representation     = representation;
     this.customEventHandler = customEventHandler;
 }