Ejemplo n.º 1
0
    /// <summary>
    /// Ask the server to destroy a specific object
    /// </summary>
    /// <param name="toClone">GameObject to destroy, must have a network identity</param>
    /// <returns></returns>
    public static void Send(GameObject toClone)
    {
        DevDestroyMessage msg = new DevDestroyMessage
        {
            ToDestroy = toClone ? toClone.GetComponent <NetworkIdentity>().netId : NetId.Invalid
        };

        msg.Send();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Ask the server to destroy a specific object
    /// </summary>
    /// <param name="toClone">GameObject to destroy, must have a network identity</param>
    /// <param name="adminId">user id of the admin trying to perform this action</param>
    /// <param name="adminToken">token of the admin trying to perform this action</param>
    /// <returns></returns>
    public static void Send(GameObject toClone, string adminId, string adminToken)
    {
        DevDestroyMessage msg = new DevDestroyMessage
        {
            ToDestroy  = toClone ? toClone.GetComponent <NetworkIdentity>().netId : NetId.Invalid,
            AdminId    = adminId,
            AdminToken = adminToken
        };

        msg.Send();
    }
Ejemplo n.º 3
0
 private void UpdateMe()
 {
     // check which objects we are over, pick the top one to delete
     if (CommonInput.GetMouseButtonDown(0))
     {
         var hits = MouseUtils.GetOrderedObjectsUnderMouse(layerMask,
                                                           go => go.GetComponent <CustomNetTransform>() != null);
         if (hits.Any())
         {
             if (CustomNetworkManager.IsServer)
             {
                 _ = Despawn.ServerSingle(hits.First().GetComponentInParent <CustomNetTransform>().gameObject);
             }
             else
             {
                 DevDestroyMessage.Send(hits.First().GetComponentInParent <CustomNetTransform>().gameObject);
             }
         }
     }
 }