mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-04 03:39:55 +00:00
parent
46deed3d4e
commit
18a520bc78
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Animation
|
||||
{
|
||||
@ -13,6 +9,7 @@ namespace QSB.Animation
|
||||
public Transform _root;
|
||||
public Transform _basePivot;
|
||||
public Transform _wobblePivot;
|
||||
|
||||
private bool _flashlightOn;
|
||||
private Vector3 _baseForward;
|
||||
private Quaternion _baseRotation;
|
||||
@ -25,36 +22,38 @@ namespace QSB.Animation
|
||||
|
||||
public void TurnOn()
|
||||
{
|
||||
if (!_flashlightOn)
|
||||
if (_flashlightOn)
|
||||
{
|
||||
for (int i = 0; i < _lights.Length; i++)
|
||||
return;
|
||||
}
|
||||
foreach (var light in _lights)
|
||||
{
|
||||
_lights[i].GetLight().enabled = true;
|
||||
light.GetLight().enabled = true;
|
||||
}
|
||||
_flashlightOn = true;
|
||||
Quaternion rotation = _root.rotation;
|
||||
var rotation = _root.rotation;
|
||||
_basePivot.rotation = rotation;
|
||||
_baseRotation = rotation;
|
||||
_baseForward = _basePivot.forward;
|
||||
}
|
||||
}
|
||||
|
||||
public void TurnOff()
|
||||
{
|
||||
if (_flashlightOn)
|
||||
if (!_flashlightOn)
|
||||
{
|
||||
for (int i = 0; i < _lights.Length; i++)
|
||||
return;
|
||||
}
|
||||
foreach (var light in _lights)
|
||||
{
|
||||
_lights[i].GetLight().enabled = false;
|
||||
light.GetLight().enabled = false;
|
||||
}
|
||||
_flashlightOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
Quaternion lhs = Quaternion.FromToRotation(_basePivot.up, _root.up) * Quaternion.FromToRotation(_baseForward, _root.forward);
|
||||
Quaternion b = lhs * _baseRotation;
|
||||
var lhs = Quaternion.FromToRotation(_basePivot.up, _root.up) * Quaternion.FromToRotation(_baseForward, _root.forward);
|
||||
var b = lhs * _baseRotation;
|
||||
_baseRotation = Quaternion.Slerp(_baseRotation, b, 6f * Time.deltaTime);
|
||||
_basePivot.rotation = _baseRotation;
|
||||
_baseForward = _basePivot.forward;
|
||||
|
@ -1,23 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB
|
||||
{
|
||||
class DebugActions : MonoBehaviour
|
||||
public class DebugActions : MonoBehaviour
|
||||
{
|
||||
void GoToVessel()
|
||||
private void GoToVessel()
|
||||
{
|
||||
var spawnPoint = GameObject.Find("Spawn_Vessel").GetComponent<SpawnPoint>();
|
||||
|
||||
OWRigidbody playerBody = Locator.GetPlayerBody();
|
||||
var playerBody = Locator.GetPlayerBody();
|
||||
playerBody.WarpToPositionRotation(spawnPoint.transform.position, spawnPoint.transform.rotation);
|
||||
playerBody.SetVelocity(spawnPoint.GetPointVelocity());
|
||||
}
|
||||
|
||||
void InsertWarpCore()
|
||||
private void InsertWarpCore()
|
||||
{
|
||||
var warpCore = GameObject.Find("Prefab_NOM_WarpCoreVessel").GetComponent<WarpCoreItem>();
|
||||
var socket = GameObject.Find("Interactibles_VesselBridge").GetComponentInChildren<WarpCoreSocket>();
|
||||
@ -26,7 +22,7 @@ namespace QSB
|
||||
GetComponent<NomaiCoordinateInterface>().SetPillarRaised(true, true);
|
||||
}
|
||||
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
if (!QSB.DebugMode)
|
||||
{
|
||||
|
@ -62,8 +62,8 @@ namespace QSB
|
||||
//ToConsole("* " + JoinAll(logObjects));
|
||||
return;
|
||||
}
|
||||
var data = new NotificationData(NotificationTarget.Player, JoinAll(logObjects), 5f, true);
|
||||
NotificationManager.SharedInstance.PostNotification(data, false);
|
||||
var data = new NotificationData(NotificationTarget.Player, JoinAll(logObjects));
|
||||
NotificationManager.SharedInstance.PostNotification(data);
|
||||
}
|
||||
|
||||
public static void ToAll(params object[] logObjects)
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using OWML.ModHelper.Events;
|
||||
using QSB.Animation;
|
||||
using QSB.Messaging;
|
||||
using QSB.TransformSync;
|
||||
using UnityEngine;
|
||||
@ -47,8 +44,10 @@ namespace QSB.Events
|
||||
|
||||
private void OnClientReceiveMessage(EventMessage message)
|
||||
{
|
||||
if (message.SenderId != PlayerTransformSync.LocalInstance.netId.Value)
|
||||
if (message.SenderId == PlayerTransformSync.LocalInstance.netId.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch ((EventType)message.EventType)
|
||||
{
|
||||
case EventType.TurnOnFlashlight:
|
||||
@ -69,4 +68,3 @@ namespace QSB.Events
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Events
|
||||
{
|
||||
class EventListener : MonoBehaviour
|
||||
public class EventListener : MonoBehaviour
|
||||
{
|
||||
public static EventListener LocalInstance;
|
||||
|
||||
void Awake()
|
||||
private void Awake()
|
||||
{
|
||||
LocalInstance = this;
|
||||
foreach (var item in Enum.GetNames(typeof(EventType)))
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using QSB.Messaging;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.Events
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace QSB.Events
|
||||
namespace QSB.Events
|
||||
{
|
||||
public enum EventType
|
||||
{
|
||||
|
@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using QSB.Messaging;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.Events
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using QSB.Messaging;
|
||||
using QSB.TransformSync;
|
||||
using UnityEngine;
|
||||
|
@ -1,13 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using QSB.Messaging;
|
||||
using QSB.TransformSync;
|
||||
using UnityEngine;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace QSB.Events
|
||||
{
|
||||
class GameState : NetworkBehaviour
|
||||
public class GameState : NetworkBehaviour
|
||||
{
|
||||
public static GameState LocalInstance { get; private set; }
|
||||
|
||||
@ -28,10 +24,9 @@ namespace QSB.Events
|
||||
|
||||
public void Send()
|
||||
{
|
||||
|
||||
foreach (var player in PlayerRegistry.GetPlayers())
|
||||
foreach (var player in PlayerRegistry.PlayerList)
|
||||
{
|
||||
var message = new FullStateMessage()
|
||||
var message = new FullStateMessage
|
||||
{
|
||||
PlayerName = player.Name,
|
||||
SenderId = player.NetId
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using QSB.Messaging;
|
||||
using QSB.TransformSync;
|
||||
using UnityEngine;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using QSB.Messaging;
|
||||
using QSB.TransformSync;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
|
@ -1,21 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine.Networking;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.Events
|
||||
{
|
||||
public class StateRequestMessage : PlayerMessage
|
||||
{
|
||||
public override MessageType MessageType => MessageType.FullStateRequest;
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
}
|
||||
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
15
QSB/PlayerInfo.cs
Normal file
15
QSB/PlayerInfo.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB
|
||||
{
|
||||
public class PlayerInfo
|
||||
{
|
||||
public uint NetId { get; set; }
|
||||
public GameObject Body { get; set; }
|
||||
public GameObject Camera { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool Ready { get; set; }
|
||||
public Transform ReferenceSector { get; set; }
|
||||
public State State { get; set; }
|
||||
}
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using QSB.Animation;
|
||||
using QSB.Animation;
|
||||
using QSB.Events;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
@ -11,12 +9,7 @@ namespace QSB
|
||||
{
|
||||
public static class PlayerRegistry
|
||||
{
|
||||
private static readonly List<PlayerInfo> playerList = new List<PlayerInfo>();
|
||||
|
||||
public static List<PlayerInfo> GetPlayers()
|
||||
{
|
||||
return playerList;
|
||||
}
|
||||
public static List<PlayerInfo> PlayerList { get; } = new List<PlayerInfo>();
|
||||
|
||||
public static void RegisterPlayerBody(uint id, GameObject body)
|
||||
{
|
||||
@ -26,21 +19,22 @@ namespace QSB
|
||||
|
||||
public static bool PlayerExists(uint id)
|
||||
{
|
||||
return playerList.Any(x => x.NetId == id);
|
||||
return PlayerList.Any(x => x.NetId == id);
|
||||
}
|
||||
|
||||
public static void CreatePlayer(uint id, string name)
|
||||
{
|
||||
if (!PlayerExists(id))
|
||||
if (PlayerExists(id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
DebugLog.ToConsole($"Creating player: {id}");
|
||||
var player = new PlayerInfo()
|
||||
var player = new PlayerInfo
|
||||
{
|
||||
NetId = id,
|
||||
Name = name
|
||||
};
|
||||
playerList.Add(player);
|
||||
}
|
||||
PlayerList.Add(player);
|
||||
}
|
||||
|
||||
public static void RegisterPlayerCamera(uint id, GameObject camera)
|
||||
@ -52,12 +46,12 @@ namespace QSB
|
||||
public static void RemovePlayer(uint id)
|
||||
{
|
||||
DebugLog.ToConsole($"Removing player {id}");
|
||||
playerList.Remove(playerList.Find(x => x.NetId == id));
|
||||
PlayerList.Remove(PlayerList.Find(x => x.NetId == id));
|
||||
}
|
||||
|
||||
private static PlayerInfo GetPlayer(uint id)
|
||||
{
|
||||
return playerList.Find(x => x.NetId == id);
|
||||
return PlayerList.Find(x => x.NetId == id);
|
||||
}
|
||||
|
||||
public static GameObject GetPlayerCamera(uint id)
|
||||
@ -95,7 +89,7 @@ namespace QSB
|
||||
public static Dictionary<uint, string> GetPlayerNames()
|
||||
{
|
||||
var dict = new Dictionary<uint, string>();
|
||||
playerList.ForEach(x => dict.Add(x.NetId, x.Name));
|
||||
PlayerList.ForEach(x => dict.Add(x.NetId, x.Name));
|
||||
return dict;
|
||||
}
|
||||
|
||||
@ -139,25 +133,4 @@ namespace QSB
|
||||
return FlagsHelper.IsSet(states, state);
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerInfo
|
||||
{
|
||||
public uint NetId { get; set; }
|
||||
public GameObject Body { get; set; }
|
||||
public GameObject Camera { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool Ready { get; set; }
|
||||
public Transform ReferenceSector { get; set; }
|
||||
public State State { get; set; }
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum State
|
||||
{
|
||||
Flashlight = 0,
|
||||
Suit = 1,
|
||||
ProbeLauncher = 2,
|
||||
SignalScope = 4
|
||||
//Increment these in binary to add more states
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using OWML.Common;
|
||||
using OWML.ModHelper;
|
||||
using QSB.Events;
|
||||
using QSB.TimeSync;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
|
@ -134,6 +134,8 @@
|
||||
<Compile Include="Messaging\MessageHandler.cs" />
|
||||
<Compile Include="Messaging\MessageType.cs" />
|
||||
<Compile Include="Messaging\QSBMessage.cs" />
|
||||
<Compile Include="PlayerInfo.cs" />
|
||||
<Compile Include="State.cs" />
|
||||
<Compile Include="TimeSync\PreventShipDestruction.cs" />
|
||||
<Compile Include="TimeSync\RespawnOnDeath.cs" />
|
||||
<Compile Include="PlayerRegistry.cs" />
|
||||
|
@ -14,7 +14,7 @@ namespace QSB
|
||||
public class QSBNetworkManager : NetworkManager
|
||||
{
|
||||
public static UnityEvent OnNetworkManagerReady = new UnityEvent();
|
||||
public static bool IsReady = false;
|
||||
public static bool IsReady;
|
||||
|
||||
private const int MaxConnections = 128;
|
||||
|
||||
@ -77,11 +77,9 @@ namespace QSB
|
||||
profileManager.Initialize();
|
||||
var profile = profileManager.GetValue<StandaloneProfileManager.ProfileData>("_currentProfile");
|
||||
var profileName = profile?.profileName;
|
||||
if (!string.IsNullOrEmpty(profileName))
|
||||
{
|
||||
return profileName;
|
||||
}
|
||||
return _defaultNames.OrderBy(x => Guid.NewGuid()).First();
|
||||
return !string.IsNullOrEmpty(profileName)
|
||||
? profileName
|
||||
: _defaultNames.OrderBy(x => Guid.NewGuid()).First();
|
||||
}
|
||||
|
||||
private void ConfigureNetworkManager()
|
||||
|
14
QSB/State.cs
Normal file
14
QSB/State.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace QSB
|
||||
{
|
||||
[Flags]
|
||||
public enum State
|
||||
{
|
||||
Flashlight = 0,
|
||||
Suit = 1,
|
||||
ProbeLauncher = 2,
|
||||
SignalScope = 4
|
||||
//Increment these in binary to add more states
|
||||
}
|
||||
}
|
@ -21,9 +21,10 @@ namespace QSB.TimeSync
|
||||
|
||||
private void OnEvent(MonoBehaviour behaviour, OWML.Common.Events ev)
|
||||
{
|
||||
if (behaviour.GetType() == typeof(ShipDamageController) && ev == OWML.Common.Events.AfterAwake)
|
||||
if (behaviour is ShipDamageController shipDamageController &&
|
||||
ev == OWML.Common.Events.AfterAwake)
|
||||
{
|
||||
behaviour.SetValue("_exploded", true);
|
||||
shipDamageController.SetValue("_exploded", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
private static RespawnOnDeath _instance;
|
||||
|
||||
private static readonly DeathType[] _allowedDeathTypes = {
|
||||
private static readonly DeathType[] AllowedDeathTypes = {
|
||||
DeathType.BigBang,
|
||||
DeathType.Supernova,
|
||||
DeathType.TimeLoop
|
||||
@ -45,7 +45,7 @@ namespace QSB.TimeSync
|
||||
|
||||
private void OnEvent(MonoBehaviour behaviour, OWML.Common.Events ev)
|
||||
{
|
||||
if (behaviour.GetType() == typeof(PlayerResources) && ev == OWML.Common.Events.AfterStart)
|
||||
if (behaviour is PlayerResources && ev == OWML.Common.Events.AfterStart)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
@ -156,7 +156,7 @@ namespace QSB.TimeSync
|
||||
{
|
||||
public static bool PreFinishDeathSequence(DeathType deathType)
|
||||
{
|
||||
if (_allowedDeathTypes.Contains(deathType))
|
||||
if (AllowedDeathTypes.Contains(deathType))
|
||||
{
|
||||
// Allow real death
|
||||
return true;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using QSB.Messaging;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using UnityEngine.SceneManagement;
|
||||
@ -123,12 +122,11 @@ namespace QSB.TimeSync
|
||||
|
||||
if (diff < -TimeThreshold)
|
||||
{
|
||||
StartFastForwarding(diff);
|
||||
return;
|
||||
StartFastForwarding();
|
||||
}
|
||||
}
|
||||
|
||||
private void StartFastForwarding(float diff)
|
||||
private void StartFastForwarding()
|
||||
{
|
||||
if (_state == State.FastForwarding)
|
||||
{
|
||||
@ -217,8 +215,8 @@ namespace QSB.TimeSync
|
||||
Time.timeScale = _timeScale;
|
||||
}
|
||||
|
||||
bool isDoneFastForwarding = _state == State.FastForwarding && Time.timeSinceLevelLoad >= _serverTime;
|
||||
bool isDonePausing = _state == State.Pausing && Time.timeSinceLevelLoad < _serverTime;
|
||||
var isDoneFastForwarding = _state == State.FastForwarding && Time.timeSinceLevelLoad >= _serverTime;
|
||||
var isDonePausing = _state == State.Pausing && Time.timeSinceLevelLoad < _serverTime;
|
||||
|
||||
if (isDoneFastForwarding || isDonePausing)
|
||||
{
|
||||
|
@ -1,8 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using QSB.Animation;
|
||||
using QSB.Events;
|
||||
using QSB.Utility;
|
||||
using System.Collections.Generic;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.TransformSync
|
||||
@ -16,7 +12,7 @@ namespace QSB.TransformSync
|
||||
LocalInstance = this;
|
||||
}
|
||||
|
||||
uint GetAttachedNetId()
|
||||
private uint GetAttachedNetId()
|
||||
{
|
||||
/*
|
||||
Players are stored in PlayerRegistry using a specific ID. This ID has to remain the same
|
||||
|
@ -1,13 +1,8 @@
|
||||
using QSB.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.TransformSync
|
||||
{
|
||||
class PlayerHUDMarker : HUDDistanceMarker
|
||||
public class PlayerHUDMarker : HUDDistanceMarker
|
||||
{
|
||||
private uint _netId = uint.MaxValue;
|
||||
private bool _isReady;
|
||||
@ -36,10 +31,12 @@ namespace QSB.TransformSync
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
if (_isReady && PlayerRegistry.IsPlayerReady(_netId))
|
||||
if (!_isReady || !PlayerRegistry.IsPlayerReady(_netId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_markerLabel = PlayerRegistry.GetPlayerName(_netId);
|
||||
_isReady = false;
|
||||
|
||||
@ -47,4 +44,3 @@ namespace QSB.TransformSync
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,4 @@
|
||||
using OWML.ModHelper.Events;
|
||||
using QSB.Animation;
|
||||
using QSB.Events;
|
||||
using QSB.Utility;
|
||||
using System.Collections.Generic;
|
||||
using QSB.Animation;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.TransformSync
|
||||
@ -18,7 +14,7 @@ namespace QSB.TransformSync
|
||||
LocalInstance = this;
|
||||
}
|
||||
|
||||
uint GetAttachedNetId()
|
||||
private uint GetAttachedNetId()
|
||||
{
|
||||
/*
|
||||
Players are stored in PlayerRegistry using a specific ID. This ID has to remain the same
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using QSB.Messaging;
|
||||
using QSB.Messaging;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using UnityEngine.SceneManagement;
|
||||
@ -12,6 +11,7 @@ namespace QSB.TransformSync
|
||||
|
||||
private Sector[] _allSectors;
|
||||
private MessageHandler<SectorMessage> _sectorHandler;
|
||||
|
||||
private readonly Sector.Name[] _sectorWhitelist = {
|
||||
Sector.Name.BrambleDimension,
|
||||
Sector.Name.BrittleHollow,
|
||||
@ -71,14 +71,10 @@ namespace QSB.TransformSync
|
||||
{
|
||||
_allSectors = FindObjectsOfType<Sector>();
|
||||
}
|
||||
foreach (var sector in _allSectors)
|
||||
{
|
||||
if (sectorName == sector.GetName())
|
||||
{
|
||||
return sector.transform;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return _allSectors
|
||||
.Where(sector => sectorName == sector.GetName())
|
||||
.Select(sector => sector.transform)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
private void OnClientReceiveMessage(SectorMessage message)
|
||||
|
@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace QSB.Utility
|
||||
namespace QSB.Utility
|
||||
{
|
||||
// Stolen from here : https://stackoverflow.com/questions/3261451/using-a-bitmask-in-c-sharp
|
||||
|
||||
@ -11,24 +6,24 @@ namespace QSB.Utility
|
||||
{
|
||||
public static bool IsSet<T>(T flags, T flag) where T : struct
|
||||
{
|
||||
int flagsValue = (int)(object)flags;
|
||||
int flagValue = (int)(object)flag;
|
||||
var flagsValue = (int)(object)flags;
|
||||
var flagValue = (int)(object)flag;
|
||||
|
||||
return (flagsValue & flagValue) != 0;
|
||||
}
|
||||
|
||||
public static void Set<T>(ref T flags, T flag) where T : struct
|
||||
{
|
||||
int flagsValue = (int)(object)flags;
|
||||
int flagValue = (int)(object)flag;
|
||||
var flagsValue = (int)(object)flags;
|
||||
var flagValue = (int)(object)flag;
|
||||
|
||||
flags = (T)(object)(flagsValue | flagValue);
|
||||
}
|
||||
|
||||
public static void Unset<T>(ref T flags, T flag) where T : struct
|
||||
{
|
||||
int flagsValue = (int)(object)flags;
|
||||
int flagValue = (int)(object)flag;
|
||||
var flagsValue = (int)(object)flags;
|
||||
var flagValue = (int)(object)flag;
|
||||
|
||||
flags = (T)(object)(flagsValue & (~flagValue));
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.Utility
|
||||
{
|
||||
class PlayerToolsManager
|
||||
public class PlayerToolsManager
|
||||
{
|
||||
private static Transform _cameraBody;
|
||||
private static readonly Vector3 FlashlightOffset = new Vector3(0.7196316f, -0.2697681f, 0.3769455f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user