コード例 #1
0
    /// <summary>
    /// Inform all clients about this despawn event
    /// </summary>
    /// <param name="result">results of the despawn that was already performed server side</param>
    /// <returns></returns>
    public static void SendToAll(DespawnResult result)
    {
        DespawnMessage msg = new DespawnMessage
        {
            DespawnedObject = result.GameObject.NetId()
        };

        msg.SendToAll();
    }
コード例 #2
0
    /// <summary>
    /// Note - for internal use by spawn system only. Fires all server side despawn hooks then informs
    /// client to call client side despawn hooks
    /// </summary>
    /// <param name="result"></param>
    public static void _ServerFireDespawnHooks(DespawnResult result)
    {
        //fire server hooks
        var comps = result.GameObject.GetComponents <IServerDespawn>();

        if (comps != null)
        {
            foreach (var comp in comps)
            {
                comp.OnDespawnServer(result.DespawnInfo);
            }
        }

        //fire client hooks
        DespawnMessage.SendToAll(result);
    }