You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
820 B
C#
29 lines
820 B
C#
3 weeks ago
|
using System;
|
||
|
using Unity.BossRoom.Infrastructure;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Unity.BossRoom.Gameplay.GameplayObjects
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// A runtime list of <see cref="PersistentPlayer"/> objects that is populated both on clients and server.
|
||
|
/// </summary>
|
||
|
[CreateAssetMenu]
|
||
|
public class PersistentPlayerRuntimeCollection : RuntimeCollection<PersistentPlayer>
|
||
|
{
|
||
|
public bool TryGetPlayer(ulong clientID, out PersistentPlayer persistentPlayer)
|
||
|
{
|
||
|
for (int i = 0; i < Items.Count; i++)
|
||
|
{
|
||
|
if (clientID == Items[i].OwnerClientId)
|
||
|
{
|
||
|
persistentPlayer = Items[i];
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
persistentPlayer = null;
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
}
|