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.

40 lines
1.4 KiB
C#

using Unity.BossRoom.Infrastructure;
using Unity.Multiplayer.Samples.BossRoom;
using UnityEngine;
namespace Unity.BossRoom.ConnectionManagement
{
public struct SessionPlayerData : ISessionPlayerData
{
public string PlayerName;
public int PlayerNumber;
public Vector3 PlayerPosition;
public Quaternion PlayerRotation;
/// Instead of using a NetworkGuid (two ulongs) we could just use an int or even a byte-sized index into an array of possible avatars defined in our game data source
public NetworkGuid AvatarNetworkGuid;
public int CurrentHitPoints;
public bool HasCharacterSpawned;
public SessionPlayerData(ulong clientID, string name, NetworkGuid avatarNetworkGuid, int currentHitPoints = 0, bool isConnected = false, bool hasCharacterSpawned = false)
{
ClientID = clientID;
PlayerName = name;
PlayerNumber = -1;
PlayerPosition = Vector3.zero;
PlayerRotation = Quaternion.identity;
AvatarNetworkGuid = avatarNetworkGuid;
CurrentHitPoints = currentHitPoints;
IsConnected = isConnected;
HasCharacterSpawned = hasCharacterSpawned;
}
public bool IsConnected { get; set; }
public ulong ClientID { get; set; }
public void Reinitialize()
{
HasCharacterSpawned = false;
}
}
}