mirror of
https://github.com/DerTyp7/fps-citybuild-unity.git
synced 2025-11-05 06:58:58 +01:00
idk
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -6,5 +6,8 @@ public class BuildingsRegistry : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private List<GameObject> registered_buildings = new List<GameObject>();
|
||||
|
||||
|
||||
public List<GameObject> GetRegistry()
|
||||
{
|
||||
return registered_buildings;
|
||||
}
|
||||
}
|
||||
|
||||
8
Assets/Buildings/Scripts/UI.meta
Normal file
8
Assets/Buildings/Scripts/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd22183ef08d3c148b89da7eb6ac6226
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/Buildings/Scripts/UI/SelectBuilding.cs
Normal file
12
Assets/Buildings/Scripts/UI/SelectBuilding.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
11
Assets/Buildings/Scripts/UI/SelectBuilding.cs.meta
Normal file
11
Assets/Buildings/Scripts/UI/SelectBuilding.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07315fb4060a66e4b800f322b186d428
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user