quakeball/Assets/Scripts/Networking/Instances/NetInstance.cs
2020-08-08 03:35:46 +03:00

36 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NeonTea.Quakeball.Networking.Packets;
using NeonTea.Quakeball.TeaNet.Peers;
using NeonTea.Quakeball.TeaNet.Packets;
namespace NeonTea.Quakeball.Networking.Instances {
public abstract class NetInstance {
protected static byte[] Fingerprint = new byte[] { 0xFF, 0xF7 };
public Peer Peer;
public List<ulong> Connections = new List<ulong>();
public abstract void Start(string address, int port, PeerMessageListener listener);
public abstract void Connected(Connection conn);
public abstract void Disconnected(Connection conn);
public abstract void Handle(Connection conn, Packet packet);
public abstract void UpdateLocalPlayer();
public abstract void SendPlayerSync();
public abstract void LocalPlayerJump();
public virtual void Update() { }
public void Stop() {
if (Peer != null) {
Peer.Stop();
Peer.MessageListener.Message("Stopping");
Peer = null;
}
}
}
}