Added ServerOnly option to NetworkedObject

This commit is contained in:
Albin Corén 2018-01-07 05:32:39 +01:00
Родитель 24c03f6324
Коммит dbc6ac1370
2 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -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);