Example #1
0
    void AttachToHand(ref HandData hand, GameObject gameObject)
    {
        NetworkInfo networkInfo = gameObject.GetComponent <NetworkInfo>();

        networkInfo.AttachCubeToLocalPlayer(this, hand);

#if DEBUG_AUTHORITY
        Debug.Log("client " + context.GetClientIndex() + " grabbed cube " + networkInfo.GetCubeId() + " and set ownership sequence to " + networkInfo.GetOwnershipSequence());
#endif // #if DEBUG_AUTHORITY

        if (!context.IsServer())
        {
            networkInfo.ClearConfirmed();
        }
        else
        {
            networkInfo.SetConfirmed();
        }

        for (int i = 0; i < ThrowRingBufferSize; ++i)
        {
            hand.throwRingBufferEntries[i].valid = false;
            hand.throwRingBufferEntries[i].speed = 0.0f;
        }
    }