-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathINetworkManager.cs
More file actions
36 lines (30 loc) · 1.06 KB
/
INetworkManager.cs
File metadata and controls
36 lines (30 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public delegate void EventDataDelegate(byte eventId, int playerId, object data);
public delegate void PlayerJoinedDelegate(int playerId);
public delegate void MasterClientChangedDelegate(int oldMasterClientId, int newMasterClientId);
public delegate void PlayerLeftDelegate(int playerId);
public interface INetworkManager {
int LocalPlayerID { get; }
bool IsMaster { get; }
bool IsConnectedAndReady { get; }
event EventDataDelegate OnEventData;
event PlayerJoinedDelegate OnPlayerJoined;
event PlayerLeftDelegate OnPlayerLeft;
event Action OnDisconnected;
event MasterClientChangedDelegate OnMasterClientChanged;
void Update();
void SendMessage(byte eventId, byte[] data, bool reliable, NetworkEventOptions networkEventOptions);
int GetNetworkId();
}
public struct NetworkEventOptions {
public NetworkReceiverGroup Receiver;
public int[] TargetActors;
}
public enum NetworkReceiverGroup {
Others,
MasterClient,
Target,
}