mirror of
https://github.com/DerTyp7/fps-citybuild-unity.git
synced 2025-10-30 12:37:08 +01:00
Added Disable/Enable HUD
This commit is contained in:
@@ -9,7 +9,7 @@ public abstract class BuildingBlueprint : MonoBehaviour
|
|||||||
public GameObject constructionPrefab;
|
public GameObject constructionPrefab;
|
||||||
|
|
||||||
private GameObject terrain;
|
private GameObject terrain;
|
||||||
|
private Canvas hud;
|
||||||
|
|
||||||
Ray ray;
|
Ray ray;
|
||||||
|
|
||||||
@@ -20,13 +20,21 @@ public abstract class BuildingBlueprint : MonoBehaviour
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
hud = GameObject.Find("HUD").GetComponent<Canvas>();
|
||||||
|
|
||||||
|
//Bug Fix Blueprints already existing
|
||||||
GameObject[] blueprints = GameObject.FindGameObjectsWithTag("Blueprint");
|
GameObject[] blueprints = GameObject.FindGameObjectsWithTag("Blueprint");
|
||||||
|
|
||||||
foreach (GameObject blueprint in blueprints)
|
foreach (GameObject blueprint in blueprints)
|
||||||
GameObject.Destroy(blueprint);
|
Destroy(blueprint);
|
||||||
|
|
||||||
|
|
||||||
gameObject.tag = "Blueprint";
|
gameObject.tag = "Blueprint";
|
||||||
|
|
||||||
terrain = GameObject.FindGameObjectWithTag("Terrain");
|
terrain = GameObject.FindGameObjectWithTag("Terrain");
|
||||||
|
|
||||||
|
hud.enabled = false;
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +75,7 @@ public abstract class BuildingBlueprint : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Instantiate(constructionPrefab, transform.position, transform.rotation);
|
Instantiate(constructionPrefab, transform.position, transform.rotation);
|
||||||
Destroy(this.gameObject);
|
Destroy(this.gameObject);
|
||||||
|
hud.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Collinding Callbacks
|
//Collinding Callbacks
|
||||||
|
|||||||
Reference in New Issue
Block a user