示例#1
0
    public void GainControl(EntityId entityId, string workerId)
    {
        Debug.LogWarning(workerId + " is attempting to gain control of: " + entityId);

        EntityAclWriter.Send(
            Acl.Build()
            .SetReadAccess(CommonPredicates.PhysicsOrVisual)
            .SetWriteAccess <EntityAcl>(CommonPredicates.PhysicsOnly)
            .SetWriteAccess <Crate>(CommonPredicates.PhysicsOnly)
            .SetWriteAccess <WorldTransform>(CommonPredicates.SpecificClientOnly(workerId))
            .SetWriteAccess <Controllable>(CommonPredicates.PhysicsOnly)
            );

        // Ensure crate is kinematic
        if (!GetComponent <Rigidbody>().isKinematic)
        {
            GetComponent <Rigidbody>().isKinematic = true;
        }
    }
 /// <summary>
 ///     Sends an update based on an Acl builder.
 /// </summary>
 public static void Send(this EntityAcl.Writer writer, Acls.Acl aclUpdate)
 {
     writer.Send(aclUpdate.ToUpdate());
 }