Skip to content
This repository was archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
Moved HUD Name label to top and removed display of main name when pic…
Browse files Browse the repository at this point in the history
…ked up
  • Loading branch information
alanrenouf committed Apr 8, 2018
1 parent 8307b7b commit 0eb7419
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 83 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions Assets/SteamVR/Scripts/SteamVR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static bool enabled
{
get
{
if (!UnityEngine.VR.VRSettings.enabled)
if (!UnityEngine.XR.XRSettings.enabled)
enabled = false;
return _enabled;
}
Expand Down Expand Up @@ -58,7 +58,7 @@ public static SteamVR instance

public static bool usingNativeSupport
{
get { return UnityEngine.VR.VRDevice.GetNativePtr() != System.IntPtr.Zero; }
get { return UnityEngine.XR.XRDevice.GetNativePtr() != System.IntPtr.Zero; }
}

static SteamVR CreateInstance()
Expand Down
4 changes: 2 additions & 2 deletions Assets/SteamVR/Scripts/SteamVR_Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public Ray GetRay()

static public float sceneResolutionScale
{
get { return UnityEngine.VR.VRSettings.renderScale; }
set { UnityEngine.VR.VRSettings.renderScale = value; }
get { return UnityEngine.XR.XRSettings.eyeTextureResolutionScale; }
set { UnityEngine.XR.XRSettings.eyeTextureResolutionScale = value; }
}

#region Enable / Disable
Expand Down
5 changes: 3 additions & 2 deletions Assets/VR-DC-Exp/Scripts/HUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void updateHud(IHudVisible hudVisible) {
}

if (hudVisible.Type != null && hudVisible.Name != null) {
title.text = hudVisible.Type + " " + hudVisible.Name;
title.text = hudVisible.Name;
}

if (hudVisible.Statistics.Count >= 3) {
Expand Down Expand Up @@ -141,7 +141,8 @@ public void updateHud(IHudVisible hudVisible) {
GameObject tagGameObj = (GameObject)Instantiate(tagPrefab);

Text label = tagGameObj.transform.Find("Label").GetComponent<Text>();
label.text = tag.Key + ": " + tag.Value;
label.alignment = TextAnchor.MiddleCenter;
label.text = tag.Key + ": " + tag.Value;

tagCounter++;

Expand Down
124 changes: 64 additions & 60 deletions Assets/VR-DC-Exp/Scripts/ShowInfo.cs
Original file line number Diff line number Diff line change
@@ -1,60 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using vapitypes;

public class ShowInfo : MonoBehaviour, HUD.IHudVisible {
public string name;
public string type;
public List<HUD.Resource> resources;
public List<HUD.Statistic> statistics;
public Dictionary<string, string> tags;
public HUD.ColorFamily colorFamily;

private UnityEngine.UI.Text[] VMDetails;
private HUD HUD;
private UI UI;

// Use this for initialization

void Start () {
VMDetails = this.GetComponentsInChildren<UnityEngine.UI.Text>();
VMDetails[1].enabled = false;

HUD = GameObject.Find("HUD").GetComponent<HUD> ();
UI = GameObject.Find("GUI").GetComponent<UI> ();
}

// Update is called once per frameo =
void Update () {

}

public void OnTriggerEnter()
{
VMDetails = this.GetComponentsInChildren<UnityEngine.UI.Text>();
VMDetails[1].enabled = true;

UI.transform.position = transform.position;
UI.transform.SetParent(transform);
HUD.updateHud(this);
}


public void OnTriggerExit()
{
VMDetails = this.GetComponentsInChildren<UnityEngine.UI.Text>();
VMDetails[1].enabled = false;

HUD.updateHud(null);
}

// IHudVisible implementation
public string Name { get { return name; } }
public string Type { get { return type; } }
public HUD.ColorFamily ColorFamily { get { return colorFamily; } }
public List<HUD.Statistic> Statistics { get { return statistics; } }
public List<HUD.Resource> Resources { get { return resources; } }
public Dictionary<string, string> Tags { get { return tags; } }
}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using vapitypes;

public class ShowInfo : MonoBehaviour, HUD.IHudVisible {
public string name;
public string type;
public List<HUD.Resource> resources;
public List<HUD.Statistic> statistics;
public Dictionary<string, string> tags;
public HUD.ColorFamily colorFamily;

private UnityEngine.UI.Text[] VMDetails;
private HUD HUD;
private UI UI;

// Use this for initialization

void Start () {
VMDetails = this.GetComponentsInChildren<UnityEngine.UI.Text>();
VMDetails[1].enabled = false;

HUD = GameObject.Find("HUD").GetComponent<HUD> ();
UI = GameObject.Find("GUI").GetComponent<UI> ();

}

// Update is called once per frameo =
void Update () {

}

public void OnTriggerEnter()
{
VMDetails = this.GetComponentsInChildren<UnityEngine.UI.Text>();
VMDetails[0].enabled = false;
VMDetails[1].enabled = true;

UI.transform.position = transform.position;
UI.transform.SetParent(transform);
HUD.updateHud(this);
}


public void OnTriggerExit()
{
VMDetails = this.GetComponentsInChildren<UnityEngine.UI.Text>();
VMDetails[0].enabled = true;
VMDetails[1].enabled = false;

HUD.updateHud(null);

}

// IHudVisible implementation
public string Name { get { return name; } }
public string Type { get { return type; } }
public HUD.ColorFamily ColorFamily { get { return colorFamily; } }
public List<HUD.Statistic> Statistics { get { return statistics; } }
public List<HUD.Resource> Resources { get { return resources; } }
public Dictionary<string, string> Tags { get { return tags; } }
}

5 changes: 4 additions & 1 deletion ProjectSettings/EditorBuildSettings.asset
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_Scenes:
- enabled: 1
path: Assets/VR-DC-Exp/Scene/Datacenter.unity
guid: 938be9627016040b4bbe362e0f91ec24
Loading

0 comments on commit 0eb7419

Please sign in to comment.