// Update is called once per frame
    void Update()
    {
        float[]  data  = new float[bodyCount * jointCount * 3];
        int[]    state = new int[bodyCount * jointCount];
        int[]    id    = new int[bodyCount];
        GCHandle gch   = GCHandle.Alloc(data, GCHandleType.Pinned);
        GCHandle gch2  = GCHandle.Alloc(state, GCHandleType.Pinned);
        GCHandle gch3  = GCHandle.Alloc(id, GCHandleType.Pinned);
        int      n     = setSkeleton(kinect, gch.AddrOfPinnedObject(), gch2.AddrOfPinnedObject(), gch3.AddrOfPinnedObject());

        gch.Free();
        gch2.Free();
        gch3.Free();
        if (n > 0)
        {
            if (PhotonNetwork.IsMasterClient)
            {
                skeleton.set(data, state, 0, mirror, move);
            }
            object[]          datas             = new object[] { data, state, 0, mirror, move };
            RaiseEventOptions raiseEventOptions = new RaiseEventOptions {
                Receivers = ReceiverGroup.Others
            };
            PhotonNetwork.RaiseEvent(CHANGE, datas, raiseEventOptions, SendOptions.SendUnreliable);
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        float[]  data  = new float[bodyCount * jointCount * 3];
        int[]    state = new int[bodyCount * jointCount];
        int[]    id    = new int[bodyCount];
        GCHandle gch   = GCHandle.Alloc(data, GCHandleType.Pinned);
        GCHandle gch2  = GCHandle.Alloc(state, GCHandleType.Pinned);
        GCHandle gch3  = GCHandle.Alloc(id, GCHandleType.Pinned);
        int      n     = setSkeleton(kinect, gch.AddrOfPinnedObject(), gch2.AddrOfPinnedObject(), gch3.AddrOfPinnedObject());

        gch.Free();
        gch2.Free();
        gch3.Free();
        if (n > 0)
        {
            skeleton.set(data, state, 0, mirror, move);
        }
    }
 private void NetworkingClient_EventReceived(EventData obj)
 {
     if (obj.Code == CHANGE)
     {
         object[] datas  = (object[])obj.CustomData;
         float[]  data   = (float[])datas[0];
         int[]    state  = (int[])datas[1];
         bool     mirror = (bool)datas[3];
         bool     move   = (bool)datas[4];
         if (condition == 1)
         {
             skeleton1 = new CharacterSkeleton(humanoid);
             skeleton1.set(data, state, 0, mirror, move);
             condition = 0;
         }
         else
         {
             skeleton1.set(data, state, 0, mirror, move);
         }
     }
 }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        //gameObject.transform.position = init_position;
        if (doing_action)
        {
            System.Random rd = new System.Random();
            filecount = rd.Next(1, 100);


            //파일 선택
            if (filecount < 9)
            {
                filename      = "0" + filecount.ToString();
                next_filename = "0" + (filecount + 1).ToString();
            }
            else if (filecount == 9)
            {
                filename      = "0" + filecount.ToString();
                next_filename = "10";
            }
            else
            {
                filename      = filecount.ToString();
                next_filename = filecount.ToString();
            }



            one_action("cube(" + filename + ")");//throw 7



            doing_action = false;
            rdcount      = rd.Next(5, 8);
            count        = rdcount;
        }
        else
        {
            if (count == rdcount && frame < num_frame)//num_frame
            {
                Debug.Log("Update is called");
                float[] data = new float[jointCount * 3]; // 25*3


                count = 0;

                for (int i = 0; i < 25 * 3; i++)
                {
                    if (2 < frame && frame < num_frame - 2)
                    {
                        data[i] = aset[25 * 3 * frame + i] * (float)ret[2, 0] + (aset[25 * 3 * (frame - 1) + i] + aset[25 * 3 * (frame + 1) + i]) * (float)ret[1, 0] + (aset[25 * 3 * (frame - 2) + i] + aset[25 * 3 * (frame + 2) + i]) * (float)ret[0, 0];
                    }
                    else
                    {
                        data[i] = aset[25 * 3 * frame + i];
                    }
                    //Debug.Log(data[i]);
                }

                //criteria = skeleton.set(data, mirror, frame, criteria);
                criteria = skeleton.set(data, mirror, frame, criteria);

                //Debug.Log(frame);



                Array.Clear(data, 0, jointCount * 3);
                frame++;
            }

            if (frame % num_frame == 0) // % (큐브 하나의 총 프레임 수)
            {
                doing_action = true;
            }
            count++;
        }
    }