Пример #1
0
    // Use this for initialization
    void Start()
    {
        PlayerAdded = (Player, SkeletonIndex) =>
        {
            if (TotalPlayers < MaxPlayers)
            {
                Players[TotalPlayers].Active     = true;
                Players[TotalPlayers].PlayerID   = Player;
                Players[TotalPlayers].SkeletonID = SkeletonIndex;
                TotalPlayers++;
            }
        };

        PlayerRemoved = (Player) =>
        {
            for (int I = 0; I < TotalPlayers; ++I)
            {
                if (Players[I].Active && Players[I].PlayerID == Player)
                {
                    Players[I].Active = false;
                    for (int J = I + 1; J < TotalPlayers; ++J)
                    {
                        if (Players[J].Active)
                        {
                            Players[J - 1]    = Players[J];
                            Players[J].Active = false;
                        }
                    }
                    TotalPlayers--;
                }
            }
        };
    }
Пример #2
0
    public void SetPlayerAddedCallback(PlayerAddedCallback Delegate)
    {
        IntPtr ptr = Marshal.GetFunctionPointerForDelegate(Delegate);

        KinectInterface.GAKSetPlayerAddedCallback(ptr);
    }