Skip to content

Commit

Permalink
Merge pull request FAR-Lab#16 from FAR-Lab/ImmersiveDriving
Browse files Browse the repository at this point in the history
Immersive driving
  • Loading branch information
DavidGoedicke authored Feb 6, 2022
2 parents 8a466d5 + 8a78c37 commit 2e13a31
Show file tree
Hide file tree
Showing 514 changed files with 69,215 additions and 709 deletions.
8 changes: 8 additions & 0 deletions .idea/.idea.ImmersiveDriving/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.ImmersiveDriving/.idea/projectSettingsUpdater.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/.idea.ImmersiveDriving/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

117 changes: 117 additions & 0 deletions .idea/.idea.ImmersiveDriving/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 68 additions & 20 deletions Assets/ConnectionAndSpawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ConnectionAndSpawing : MonoBehaviour {
public GameObject PlayerPrefab;
public GameObject CarPrefab;
public GameObject VRUIStartPrefab;

private GameObject[] TrafficLights;

public List<SceneField> IncludedScenes = new List<SceneField>();
public string WaitingRoomSceneName;
Expand Down Expand Up @@ -43,7 +43,7 @@ public class ConnectionAndSpawing : MonoBehaviour {
enum ParticipantObjectSpawnType {
MAIN,
CAR,
PEDESTRIAN
PEDESTRIAN,
}


Expand Down Expand Up @@ -268,6 +268,8 @@ private bool _prepareSpawing(ulong clientID, out Pose? tempPose) {
return success;
}



private bool SpawnACar(ulong clientID) {
ParticipantOrder temp = GetOrder(clientID);
if (temp == ParticipantOrder.None) return false;
Expand Down Expand Up @@ -619,55 +621,100 @@ void Update() {
}


void OnGUI() {
void OnGUI()
{
if (NetworkManager.Singleton == null && !ClientListInitDone) return;
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) {
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
GUI.Label(new Rect(5, 5, 150, 50), "Server: " + ParticipantOrder + " " +
NetworkManager.Singleton.ConnectedClients.Count + " " +
GetParticipantCount() + " " +
ServerState + " " + Time.timeScale);
if (ServerState == ActionState.WAITINGROOM) {
if (ServerState == ActionState.WAITINGROOM)
{
int y = 50;
foreach (SceneField f in IncludedScenes) {
if (GUI.Button(new Rect(5, 5 + y, 150, 25), f.SceneName)) { SwitchToLoading(f.SceneName); }
foreach (SceneField f in IncludedScenes)
{
if (GUI.Button(new Rect(5, 5 + y, 150, 25), f.SceneName))
{
SwitchToLoading(f.SceneName);
}

y += 27;
}

y = 50;
if (_OrderToClient == null) return;
foreach (var p in _OrderToClient.Keys) {

if (GUI.Button(new Rect(200, 200 + y, 100, 25), "Calibrate " + p)) {
foreach (var p in _OrderToClient.Keys)
{

if (GUI.Button(new Rect(200, 200 + y, 100, 25), "Calibrate " + p))
{
ulong clientID = _OrderToClient[p];
ClientRpcParams clientRpcParams = new ClientRpcParams {
Send = new ClientRpcSendParams {
ClientRpcParams clientRpcParams = new ClientRpcParams
{
Send = new ClientRpcSendParams
{
TargetClientIds = new ulong[] {clientID}
}
};

ClientObjects[clientID][ParticipantObjectSpawnType.MAIN].GetComponent<ParticipantInputCapture>()
.CalibrateClientRPC(clientRpcParams);
}

y += 50;
}
}

else if (ServerState == ActionState.QUESTIONS) {
else if (ServerState == ActionState.QUESTIONS)
{
int y = 50;
foreach (ParticipantOrder f in QNFinished.Keys) {
foreach (ParticipantOrder f in QNFinished.Keys)
{
GUI.Label(new Rect(5, 5 + y, 150, 25), f + " " + QNFinished[f].ToString());
y += 27;
}
}
}
else if (NetworkManager.Singleton.IsClient && !NetworkManager.Singleton.IsHost) {
GUI.Label(new Rect(5, 5, 150, 100), "Client: " +
ParticipantOrder + " " +
NetworkManager.Singleton.IsConnectedClient);
else if (ServerState == ActionState.READY)
{

if (GUI.Button(new Rect(20, 50, 80, 20), "TL to Green"))
{
SetTrafficLightsGreen(true);
}
if (GUI.Button(new Rect(20, 75, 80, 20), "TL to Red"))
{
SetTrafficLightsGreen(false);
}
else if (NetworkManager.Singleton.IsClient && !NetworkManager.Singleton.IsHost)
{
GUI.Label(new Rect(5, 5, 150, 100), "Client: " +
ParticipantOrder + " " +
NetworkManager.Singleton.IsConnectedClient);
}
}
}
}

private void SetTrafficLightsGreen(bool toGreen)
{
TrafficLights = GameObject.FindGameObjectsWithTag("TrafficLight");

foreach (GameObject oneLight in TrafficLights)
{
if (toGreen)
{
Debug.Log(oneLight.name + "Go Green");
oneLight.GetComponent<TrafficLightGreen>().StartGreenCoroutineClientRpc();
}
else
{
Debug.Log(oneLight.name + "Go Red");
oneLight.GetComponent<TrafficLightGreen>().StartRedCoroutineClientRpc();
}
}
}
private Dictionary<ParticipantOrder, bool> QNFinished;
private bool ClientListInitDone = false;

Expand All @@ -676,6 +723,7 @@ public void FinishedQuestionair(ulong clientID) {
QNFinished[po] = true;
}


#region GPSUpdate

private void SetStartingGPSDirections() {
Expand Down
30 changes: 15 additions & 15 deletions Assets/Logitech SDK/LogitechGArxControlEnginesWrapper.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Assets/Materials/CarMaterials/CarMats/backLeftLamp.mat
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.15686275, g: 0, b: 0, a: 0.75}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []
4 changes: 2 additions & 2 deletions Assets/Materials/CarMaterials/CarMats/backRightLamp.mat
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.15686275, g: 0, b: 0, a: 0.75}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Color: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 0}
m_BuildTextureStacks: []
Loading

0 comments on commit 2e13a31

Please sign in to comment.