22 lines
559 B
C#
22 lines
559 B
C#
|
using Godot;
|
||
|
|
||
|
public abstract class Peer : Object {
|
||
|
|
||
|
private PacketPeerUDP PacketPeer;
|
||
|
|
||
|
private int LastConnectionSended = -1;
|
||
|
|
||
|
public Peer(PacketPeerUDP packetPeer) {
|
||
|
PacketPeer = packetPeer;
|
||
|
}
|
||
|
|
||
|
public abstract void Initialize(string address, int port);
|
||
|
public abstract void Update(float delta);
|
||
|
|
||
|
public void SendBuffer(byte[] buffer, Connection to) {
|
||
|
GD.print("Putting stuff to " + to.Address + ":" + to.Port);
|
||
|
PacketPeer.SetDestAddress(to.Address, to.Port);
|
||
|
PacketPeer.PutPacket(buffer);
|
||
|
}
|
||
|
|
||
|
}
|