Added ServerOnly option to NetworkedObject
This commit is contained in:
Родитель
24c03f6324
Коммит
dbc6ac1370
|
@ -6,10 +6,15 @@ namespace MLAPI
|
|||
//Will be used for objects which will be spawned automatically across clients
|
||||
public class NetworkedObject : MonoBehaviour
|
||||
{
|
||||
[HideInInspector]
|
||||
public uint NetworkId;
|
||||
[HideInInspector]
|
||||
public int OwnerClientId = -1;
|
||||
[HideInInspector]
|
||||
public int SpawnablePrefabId;
|
||||
internal bool IsPlayerObject = false;
|
||||
[HideInInspector]
|
||||
public bool IsPlayerObject = false;
|
||||
public bool ServerOnly = false;
|
||||
public bool isLocalPlayer
|
||||
{
|
||||
get
|
||||
|
|
|
@ -744,9 +744,19 @@ namespace MLAPI
|
|||
}
|
||||
if (NetworkConfig.HandleObjectSpawning)
|
||||
{
|
||||
writer.Write(spawnedObjectIds.Count);
|
||||
int amountOfObjectsToSend = 0;
|
||||
for (int i = 0; i < spawnedObjectIds.Count; i++)
|
||||
{
|
||||
if (spawnedObjects[spawnedObjectIds[i]].ServerOnly)
|
||||
continue;
|
||||
else
|
||||
amountOfObjectsToSend++;
|
||||
}
|
||||
writer.Write(amountOfObjectsToSend);
|
||||
for (int i = 0; i < spawnedObjectIds.Count; i++)
|
||||
{
|
||||
if (spawnedObjects[spawnedObjectIds[i]].ServerOnly)
|
||||
continue;
|
||||
writer.Write(spawnedObjects[spawnedObjectIds[i]].IsPlayerObject);
|
||||
writer.Write(spawnedObjects[spawnedObjectIds[i]].NetworkId);
|
||||
writer.Write(spawnedObjects[spawnedObjectIds[i]].OwnerClientId);
|
||||
|
|
Загрузка…
Ссылка в новой задаче