From 4944d7463e5ccf94f2180d47cf56b1f32529fb31 Mon Sep 17 00:00:00 2001 From: pbg2h23akl Date: Fri, 28 Jun 2024 11:24:09 +0200 Subject: [PATCH] UI Manager erstellt --- .../Assets/Scenes/KevinSceneGun.unity | 61 ++++++++++++++++--- .../Scripts/ScriptsKevin/BulletScript.cs | 13 +++- Plunderblock/Assets/UI_Manager.cs | 26 ++++++++ Plunderblock/Assets/UI_Manager.cs.meta | 11 ++++ 4 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 Plunderblock/Assets/UI_Manager.cs create mode 100644 Plunderblock/Assets/UI_Manager.cs.meta diff --git a/Plunderblock/Assets/Scenes/KevinSceneGun.unity b/Plunderblock/Assets/Scenes/KevinSceneGun.unity index 52be5f5..f8cbfc5 100644 --- a/Plunderblock/Assets/Scenes/KevinSceneGun.unity +++ b/Plunderblock/Assets/Scenes/KevinSceneGun.unity @@ -303,6 +303,50 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 322531732} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &417262697 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 417262698} + - component: {fileID: 417262699} + m_Layer: 0 + m_Name: UI_Manager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &417262698 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 417262697} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &417262699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 417262697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1271dbd420eb5b14dae4b24f833bb965, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &747170971 GameObject: m_ObjectHideFlags: 0 @@ -710,7 +754,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3286218375903244322, guid: 5bd04146a95212e41bc2c52b7079e131, type: 3} propertyPath: m_LocalPosition.x - value: 4.35 + value: 5.431 objectReference: {fileID: 0} - target: {fileID: 3286218375903244322, guid: 5bd04146a95212e41bc2c52b7079e131, type: 3} propertyPath: m_LocalPosition.y @@ -1677,31 +1721,31 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 5064384315330415458, guid: f063995f35533054d8f370458ee30f57, type: 3} propertyPath: m_LocalRotation.w - value: -0.8511778 + value: -0.30019215 objectReference: {fileID: 0} - target: {fileID: 5064384315330415458, guid: f063995f35533054d8f370458ee30f57, type: 3} propertyPath: m_LocalRotation.x - value: 0.52487755 + value: 0.40807855 objectReference: {fileID: 0} - target: {fileID: 5064384315330415458, guid: f063995f35533054d8f370458ee30f57, type: 3} propertyPath: m_LocalRotation.y - value: -0 + value: 0.58593726 objectReference: {fileID: 0} - target: {fileID: 5064384315330415458, guid: f063995f35533054d8f370458ee30f57, type: 3} propertyPath: m_LocalRotation.z - value: -0 + value: 0.6324825 objectReference: {fileID: 0} - target: {fileID: 5064384315330415458, guid: f063995f35533054d8f370458ee30f57, type: 3} propertyPath: m_LocalEulerAnglesHint.x - value: 296.68 + value: 279.53198 objectReference: {fileID: 0} - target: {fileID: 5064384315330415458, guid: f063995f35533054d8f370458ee30f57, type: 3} propertyPath: m_LocalEulerAnglesHint.y - value: 0 + value: -263.167 objectReference: {fileID: 0} - target: {fileID: 5064384315330415458, guid: f063995f35533054d8f370458ee30f57, type: 3} propertyPath: m_LocalEulerAnglesHint.z - value: 0 + value: 143.506 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -1776,3 +1820,4 @@ SceneRoots: - {fileID: 1544909526857362950} - {fileID: 1062964501} - {fileID: 1030353343} + - {fileID: 417262698} diff --git a/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs b/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs index e15621c..a806c12 100644 --- a/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs +++ b/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs @@ -24,7 +24,10 @@ public class BulletScript : MonoBehaviour private Ray ray; private RaycastHit hit; - + /// + /// Sobald life Time vorbei ist Destroy die Bullet. + /// + /// Lifetime der Bullet private void die(float lifetime){ if(time > lifetime){ GameObject.Destroy(this.gameObject); @@ -35,10 +38,18 @@ public class BulletScript : MonoBehaviour direction = hit.point - transform.position;//Richtung in die, die Kugel fliegt } } + /// + /// clashPartical spawned clashPartical am EinschlagPunkt der Kugel. + /// + /// Die Collision mit der Bullet. public void clashPartcal(Collision collision){ ContactPoint contact = collision.GetContact(0); Instantiate(particalClash,transform.position,Quaternion.LookRotation(contact.normal)); } + /// + /// Wenn die Bullet etwas behrührt zerstört sie sich selbst. + /// + /// Die Collision mit der Bullet private void OnCollisionEnter(Collision collision){ Debug.Log(collision.gameObject.name + " UND HIER IST DER TAG: " + collision.gameObject.tag); if(collision.transform.tag == "Enemy"){ diff --git a/Plunderblock/Assets/UI_Manager.cs b/Plunderblock/Assets/UI_Manager.cs new file mode 100644 index 0000000..94546ee --- /dev/null +++ b/Plunderblock/Assets/UI_Manager.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class UI_Manager : MonoBehaviour +{ + public Text anzahlKills; + + public Transform canvas; + + + void Start() + { + canvas = this.gameObject.GetComponentInChildren(); + anzahlKills = canvas.GetComponentInChildren(); + anzahlKills.text = "3"; + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Plunderblock/Assets/UI_Manager.cs.meta b/Plunderblock/Assets/UI_Manager.cs.meta new file mode 100644 index 0000000..5dbc943 --- /dev/null +++ b/Plunderblock/Assets/UI_Manager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1271dbd420eb5b14dae4b24f833bb965 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: