Inheritance: MonoBehaviour
Esempio n. 1
0
 void Awake()
 {
     if (!ReplaySystem.initializedMain)
     {
         ReplaySystem.InitializeMain();
     }
 }
Esempio n. 2
0
        public KinectReplay(Stream stream)
        {
            this.stream            = stream; reader = new BinaryReader(stream);
            synchronizationContext = SynchronizationContext.Current;
            KinectRecordOptions options = (KinectRecordOptions)reader.ReadInt32();

            if ((options & KinectRecordOptions.Color) != 0)
            {
                colorReplay = new ReplaySystem <ReplayColorImageFrame>();
            }
            if ((options & KinectRecordOptions.Depth) != 0)
            {
                depthReplay = new ReplaySystem <ReplayDepthImageFrame>();
            }
            if ((options & KinectRecordOptions.Skeletons) != 0)
            {
                skeletonReplay = new ReplaySystem <ReplaySkeletonFrame>();
            }
            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                KinectRecordOptions header = (KinectRecordOptions)reader.ReadInt32(); switch (header)
                {
                case KinectRecordOptions.Color:                     colorReplay.AddFrame(reader); break;

                case KinectRecordOptions.Depth:                     depthReplay.AddFrame(reader); break;

                case KinectRecordOptions.Skeletons:                     skeletonReplay.AddFrame(reader); break;
                }
            }
        }
    // MonoBehaviour's interface

    protected override void Awake()
    {
        base.Awake();

        if (!ReplaySystem.initializedMain)
        {
            ReplaySystem.InitializeMain();
        }
    }
Esempio n. 4
0
 public void UpdateFrame()
 {
     ReplaySystem.UpdateFrame();
     ReplaySystem.GlobalFrame = _Frame;
     // ReplaySystem.GlobalTime = _Time;
     if (replayManager._State == Replayable.State.Stop)
     {
         return;
     }
     // _Time += timePerFrame;
     _Frame++;
 }
Esempio n. 5
0
 public void Dispose()
 {
     Stop();
     colorReplay = null; depthReplay = null; skeletonReplay = null;
     if (reader != null)
     {
         reader.Dispose(); reader = null;
     }
     if (stream != null)
     {
         stream.Dispose(); stream = null;
     }
 }
Esempio n. 6
0
    void Start()
    {
        k_Animator       = GetComponent <Animator>();
        k_SpriteRenderer = GetComponent <SpriteRenderer>();
        k_Controller     = GetComponent <Controller2D>();
        k_AudioSource    = GetComponent <AudioSource>();
        k_Gun            = GetComponent <Gun>();
        m_ReplaySystem   = m_ReplayObj.GetComponent <ReplaySystem>();
        m_InputDirector  = GetComponent <InputDirector>();

        k_Gravity      = -(2 * k_JumpHeight) / Mathf.Pow(k_TimeToJumpApex, 2);
        k_JumpVelocity = Mathf.Abs(k_Gravity) * k_TimeToJumpApex;
    }
Esempio n. 7
0
        public KinectReplay(Stream stream)
        {
            this.stream = stream;
            reader = new BinaryReader(stream);

            synchronizationContext = SynchronizationContext.Current;

            KinectRecordOptions options = (KinectRecordOptions) reader.ReadInt32();

            if ((options & KinectRecordOptions.Color) != 0)
            {
                colorReplay = new ReplaySystem<ReplayColorImageFrame>();
            }

            /*
            if ((options & KinectRecordOptions.Depth) != 0)
            {
                depthReplay = new ReplaySystem<ReplayDepthImageFrame>();
            }
             * */

            if ((options & KinectRecordOptions.Skeletons) != 0)
            {
                skeletonReplay = new ReplaySystem<ReplaySkeletonFrame>();
            }

            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                KinectRecordOptions header = (KinectRecordOptions)reader.ReadInt32();
                switch (header)
                {

                    case KinectRecordOptions.Color:
                        colorReplay.AddFrame(reader);
                        break;

                    case KinectRecordOptions.Skeletons:
                        skeletonReplay.AddFrame(reader);
                        break;

                    case KinectRecordOptions.ReplayFrame:
                        skeletonReplay.AddFrame(reader);
                        break;
                }
            }
        }
Esempio n. 8
0
 void Update()
 {
     if (Input.GetKeyDown(m_RecordKey))
     {
         if (ReplaySystem.isPlayingMain)
         {
             Debug.LogWarning("ReplaySystem is playing now. Stop and retry to record.");
         }
         else
         {
             if (ReplaySystem.isRecordingMain)
             {
                 ReplaySystem.StopRecordMain();
                 Debug.Log("Stop Record");
             }
             else
             {
                 ReplaySystem.StartRecordMain();
                 Debug.Log("Start Record");
             }
         }
     }
     else
     {
         if (Input.GetKeyDown(m_PlayKey))
         {
             if (ReplaySystem.isRecordingMain)
             {
                 Debug.LogWarning("ReplaySystem is recording now. Stop and retry to play.");
             }
             else
             {
                 if (ReplaySystem.isPlayingMain)
                 {
                     ReplaySystem.StopPlayMain();
                     Debug.Log("Stop Play");
                 }
                 else
                 {
                     ReplaySystem.StartPlayMain(0f);
                     Debug.Log("Start Play");
                 }
             }
         }
     }
 }
Esempio n. 9
0
    public override void Start()
    {
        base.Start();
        //Ball.SetActive(true);
        PowerupManager = gameObject.GetComponent <PowerupManager>();

        ReplaySystem = gameObject.GetComponent <ReplaySystem>();

        countdownSound         = gameObject.AddComponent <SoundComponent>();
        countdownSound.Clip    = countdownSoundClip;
        countdownSound.Looping = false;
        countdownSound.Volume  = 0.2f;

        endroundSound         = gameObject.AddComponent <SoundComponent>();
        endroundSound.Clip    = endroundSoundClip;
        endroundSound.Looping = false;
        endroundSound.Is3D    = false;
        endroundSound.Volume  = 0.2f;


        //StartCoroutine(ResetCoroutine(10));
    }
Esempio n. 10
0
 void Start()
 {
     m_ReplaySystem = GameObject.Find("ReplayManager").GetComponent <ReplaySystem>();
 }
 void OnDisable()
 {
     ReplaySystem.UnregisterViewMain(this);
 }
 void OnEnable()
 {
     ReplaySystem.RegisterViewMain(this);
 }
Esempio n. 13
0
        public void Dispose()
        {
            Stop();

            colorReplay = null;
            /*
            depthReplay = null;
             */

            skeletonReplay = null;

            if (reader != null)
            {
                reader.Dispose();
                reader = null;
            }

            if (stream != null)
            {
                stream.Dispose();
                stream = null;
            }
        }
Esempio n. 14
0
 // Use this for initialization
 void Start()
 {
     replaySystem = FindObjectOfType <ReplaySystem>();
 }
 public void Dispose()
 {
     Stop();
       if (reader != null) {
     reader.Dispose();
     reader = null;
       }
       allFramesReplay = null;
 }
Esempio n. 16
0
 void Start()
 {
     m_ReplaySystem = GameObject.Find("ReplayManager").GetComponent <ReplaySystem>();
     m_InputDir     = new bool[m_KeyCode.Length];
 }