This commit is contained in:
DerTyp187
2021-10-07 19:08:00 +02:00
parent ddd0b98b70
commit e058b1ce5b
21 changed files with 745 additions and 5 deletions

View File

@@ -121,7 +121,7 @@ public class BuildingBlueprint : MonoBehaviour
isColliding = true;
}
Debug.Log("Colliding True");
// Debug.Log("Colliding True");
}
public void OnTriggerStay(Collider other)
{
@@ -129,7 +129,7 @@ public class BuildingBlueprint : MonoBehaviour
{
isColliding = true;
}
Debug.Log("Colliding True");
// Debug.Log("Colliding True");
}
public void OnTriggerExit(Collider other)
{
@@ -137,6 +137,6 @@ public class BuildingBlueprint : MonoBehaviour
{
isColliding = false;
}
Debug.Log("Colliding False");
// Debug.Log("Colliding False");
}
}

View File

@@ -5,12 +5,35 @@ using UnityEngine;
public class BuildingPlacement : MonoBehaviour
{
[SerializeField] private GameObject terrain;
[SerializeField] private GameObject prefab;
public GameObject prefab;
public TMPro.TextMeshProUGUI buildingText;
int i = 0;
Ray ray;
private void Start()
{
buildingText = GameObject.Find("SelectionText").GetComponent<TMPro.TextMeshProUGUI>();
}
void Update()
{
if (Input.GetKeyDown(KeyCode.H))
{
List<GameObject> registry = GameObject.Find("GameManager").GetComponent<BuildingsRegistry>().GetRegistry();
i++;
if(i >= registry.Count)
{
i = 0;
}
prefab = registry[i];
buildingText.text = prefab.name;
}
// Build Button Handler
if (Input.GetButtonDown("Build"))
{ // Wenn man den Button 'B'

View File

@@ -6,5 +6,8 @@ public class BuildingsRegistry : MonoBehaviour
{
[SerializeField] private List<GameObject> registered_buildings = new List<GameObject>();
public List<GameObject> GetRegistry()
{
return registered_buildings;
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fd22183ef08d3c148b89da7eb6ac6226
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SelectBuilding : MonoBehaviour
{
public GameObject select;
public void Select(GameObject select)
{
GameObject.Find("FirstPerson Player").GetComponent<BuildingPlacement>().prefab = select;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 07315fb4060a66e4b800f322b186d428
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: