2020-07-30 19:57:39 +00:00
|
|
|
|
using System.Linq;
|
2020-07-30 20:27:14 +00:00
|
|
|
|
using QSB.Tools;
|
2020-07-30 19:57:39 +00:00
|
|
|
|
using QSB.Utility;
|
|
|
|
|
using UnityEngine;
|
2020-07-28 13:59:24 +00:00
|
|
|
|
|
|
|
|
|
namespace QSB
|
|
|
|
|
{
|
|
|
|
|
public class PlayerInfo
|
|
|
|
|
{
|
2020-07-30 19:57:39 +00:00
|
|
|
|
public uint NetId { get; }
|
2020-07-28 13:59:24 +00:00
|
|
|
|
public GameObject Body { get; set; }
|
|
|
|
|
public GameObject Camera { get; set; }
|
2020-08-07 19:39:07 +00:00
|
|
|
|
public GameObject ProbeBody { get; set; }
|
|
|
|
|
public QSBProbe Probe { get; set; }
|
2020-07-30 19:57:39 +00:00
|
|
|
|
public QSBFlashlight FlashLight => Camera.GetComponentInChildren<QSBFlashlight>();
|
|
|
|
|
public QSBTool Signalscope => GetToolByType(ToolType.Signalscope);
|
|
|
|
|
public QSBTool Translator => GetToolByType(ToolType.Translator);
|
2020-08-07 19:39:07 +00:00
|
|
|
|
public QSBTool ProbeLauncher => GetToolByType(ToolType.ProbeLauncher);
|
2020-07-28 13:59:24 +00:00
|
|
|
|
public string Name { get; set; }
|
2020-08-08 18:59:58 +00:00
|
|
|
|
public bool IsReady => Body != null;
|
2020-07-30 19:57:39 +00:00
|
|
|
|
public State State { get; private set; }
|
|
|
|
|
|
|
|
|
|
public PlayerInfo(uint id)
|
|
|
|
|
{
|
|
|
|
|
NetId = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateState(State state, bool value)
|
|
|
|
|
{
|
|
|
|
|
var states = State;
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
FlagsHelper.Set(ref states, state);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FlagsHelper.Unset(ref states, state);
|
|
|
|
|
}
|
|
|
|
|
State = states;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-07 19:39:07 +00:00
|
|
|
|
public bool GetState(State state)
|
|
|
|
|
{
|
|
|
|
|
return FlagsHelper.IsSet(State, state);
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-30 19:57:39 +00:00
|
|
|
|
private QSBTool GetToolByType(ToolType type)
|
|
|
|
|
{
|
|
|
|
|
return Camera.GetComponentsInChildren<QSBTool>().First(x => x.Type == type);
|
|
|
|
|
}
|
2020-07-28 13:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|