Ejemplo n.º 1
0
    public void RemoveTempNetObject(ITempNetObject obj)
    {
        TempObjID tempId = obj.GetID();

        RemoveLocalNetObject(tempId);
        // remove from queue
        NetworkManager.RemoveBufferedMessage(obj.GetNetMessage());
        NetWriter writer = NetworkManager.StartNetworkMessage("destroy_temp_obj", thisNetworkID);

        tempId.WriteBytes(writer);
        NetworkManager.SendMessageToOtherClients(writer, NetworkCore.ReliableSequencedMsg, false);
    }
Ejemplo n.º 2
0
    public ITempNetObject SpawnNewTempNetObject(int prefabID, Vector3 pos, Quaternion rot)
    {
        TempObjID newID = new TempObjID(nextNum, prefabID);

        nextNum++;
        ITempNetObject comp = CreateLocalNetObject(prefabID, newID, pos, rot);

        // send the creation message
        NetWriter writer = NetworkManager.StartNetworkMessage("create_temp_obj", thisNetworkID);

        newID.WriteBytes(writer);
        writer.WriteVector3(comp.GetPosition());
        writer.WriteVector3(comp.GetEulerAngles());
        comp.WriteInitialBytes(writer);
        BufferedMessage msg = NetworkManager.SendMessageToOtherClients(writer, NetworkCore.ReliableSequencedMsg, true);

        comp.SetNetMessage(msg);
        mapping.Add(newID, comp);
        return(comp);
    }