From 4ca5d3db4f7ddff380a91ac2ac9a381a3c215a8c Mon Sep 17 00:00:00 2001 From: pbg2h23akl Date: Wed, 3 Jul 2024 12:46:41 +0200 Subject: [PATCH] Refactoring --- Plunderblock/Assets/PrefabsJan/Player.prefab | 16 ++ .../Assets/PrefabsKevin/Bullet/Bullet.prefab | 6 +- .../Assets/Scenes/KevinSceneGun.unity | 144 +++++++++++++++++- .../Scripts/ScriptsKevin/BulletScript.cs | 8 +- .../ScriptsKevin/{Enemy.cs => EnemyHealth.cs} | 2 +- .../{Enemy.cs.meta => EnemyHealth.cs.meta} | 0 .../{ParticalClash.cs => ParticleClash.cs} | 2 +- ...calClash.cs.meta => ParticleClash.cs.meta} | 0 Plunderblock/ProjectSettings/TagManager.asset | 4 +- 9 files changed, 169 insertions(+), 13 deletions(-) rename Plunderblock/Assets/Scripts/ScriptsKevin/{Enemy.cs => EnemyHealth.cs} (95%) rename Plunderblock/Assets/Scripts/ScriptsKevin/{Enemy.cs.meta => EnemyHealth.cs.meta} (100%) rename Plunderblock/Assets/Scripts/ScriptsKevin/{ParticalClash.cs => ParticleClash.cs} (92%) rename Plunderblock/Assets/Scripts/ScriptsKevin/{ParticalClash.cs.meta => ParticleClash.cs.meta} (100%) diff --git a/Plunderblock/Assets/PrefabsJan/Player.prefab b/Plunderblock/Assets/PrefabsJan/Player.prefab index afb97d7..c56ecfa 100644 --- a/Plunderblock/Assets/PrefabsJan/Player.prefab +++ b/Plunderblock/Assets/PrefabsJan/Player.prefab @@ -364,6 +364,14 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 5950832400214244271} m_Modifications: + - target: {fileID: 5727695039551963900, guid: abb3f2146f967be4e9dfd6069915f42c, type: 3} + propertyPath: m_AnchoredPosition.x + value: 357 + objectReference: {fileID: 0} + - target: {fileID: 5727695039551963900, guid: abb3f2146f967be4e9dfd6069915f42c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 209 + objectReference: {fileID: 0} - target: {fileID: 5863193481701293955, guid: abb3f2146f967be4e9dfd6069915f42c, type: 3} propertyPath: m_LocalPosition.x value: 0 @@ -408,6 +416,14 @@ PrefabInstance: propertyPath: m_Name value: UI_Manager objectReference: {fileID: 0} + - target: {fileID: 8625755030761962559, guid: abb3f2146f967be4e9dfd6069915f42c, type: 3} + propertyPath: m_AnchoredPosition.x + value: 458 + objectReference: {fileID: 0} + - target: {fileID: 8625755030761962559, guid: abb3f2146f967be4e9dfd6069915f42c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 179 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Plunderblock/Assets/PrefabsKevin/Bullet/Bullet.prefab b/Plunderblock/Assets/PrefabsKevin/Bullet/Bullet.prefab index adf95bf..30ba54b 100644 --- a/Plunderblock/Assets/PrefabsKevin/Bullet/Bullet.prefab +++ b/Plunderblock/Assets/PrefabsKevin/Bullet/Bullet.prefab @@ -10,7 +10,7 @@ GameObject: m_Component: - component: {fileID: 601926406646660137} - component: {fileID: 5420977559640316239} - m_Layer: 0 + m_Layer: 9 m_Name: Trail m_TagString: Untagged m_Icon: {fileID: 0} @@ -157,7 +157,7 @@ GameObject: - component: {fileID: 7689678004430099734} - component: {fileID: 878037186990386657} - component: {fileID: 5994619817623951055} - m_Layer: 0 + m_Layer: 9 m_Name: Bullet m_TagString: Untagged m_Icon: {fileID: 0} @@ -257,7 +257,7 @@ GameObject: - component: {fileID: 2783922791344706728} - component: {fileID: 3511214472677508059} - component: {fileID: 1974950874428390090} - m_Layer: 0 + m_Layer: 9 m_Name: BulletMesh m_TagString: Untagged m_Icon: {fileID: 0} diff --git a/Plunderblock/Assets/Scenes/KevinSceneGun.unity b/Plunderblock/Assets/Scenes/KevinSceneGun.unity index 8a05172..5114702 100644 --- a/Plunderblock/Assets/Scenes/KevinSceneGun.unity +++ b/Plunderblock/Assets/Scenes/KevinSceneGun.unity @@ -1384,9 +1384,77 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 423185948905945774, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 666296827679288680, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 1409017717971667579, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 3230210169410262755, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} - target: {fileID: 3391868011099319290, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} propertyPath: m_Name - value: Player (1) + value: Player + objectReference: {fileID: 0} + - target: {fileID: 3391868011099319290, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 3601559577021101208, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 4093775944364614034, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalPosition.x + value: 0.55560887 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalPosition.y + value: -0.403 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalPosition.z + value: 0.60068274 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.w + value: -0.6547129 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.x + value: 0.042114396 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.y + value: 0.753147 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.z + value: -0.048446175 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 1.022 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 262.066 + objectReference: {fileID: 0} + - target: {fileID: 4163468239720933169, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 7.29 objectReference: {fileID: 0} - target: {fileID: 4231050703702953731, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} propertyPath: m_LocalPosition.x @@ -1428,8 +1496,78 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] + - target: {fileID: 4731377471211230426, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 4972354890819608722, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 5245801164585615012, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5842865707223673138, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 5846198897390256284, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 6608350815154232110, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalPosition.x + value: -0.06001303 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalPosition.y + value: 0.68006015 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalPosition.z + value: -0.1801692 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8477437862324887214, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8948127678283011642, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + propertyPath: m_Layer + value: 10 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 5245801164585615012, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} + m_RemovedGameObjects: + - {fileID: 4093775944364614034, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: abab2a81048fcb64ab6d31bc6bc8f529, type: 3} diff --git a/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs b/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs index a806c12..18588cc 100644 --- a/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs +++ b/Plunderblock/Assets/Scripts/ScriptsKevin/BulletScript.cs @@ -42,7 +42,7 @@ public class BulletScript : MonoBehaviour /// clashPartical spawned clashPartical am EinschlagPunkt der Kugel. /// /// Die Collision mit der Bullet. - public void clashPartcal(Collision collision){ + public void clashParticle(Collision collision){ ContactPoint contact = collision.GetContact(0); Instantiate(particalClash,transform.position,Quaternion.LookRotation(contact.normal)); } @@ -53,9 +53,9 @@ public class BulletScript : MonoBehaviour private void OnCollisionEnter(Collision collision){ Debug.Log(collision.gameObject.name + " UND HIER IST DER TAG: " + collision.gameObject.tag); if(collision.transform.tag == "Enemy"){ - collision.transform.GetComponent().takeDamage(damage); + collision.transform.GetComponent().takeDamage(damage); } - clashPartcal(collision); + clashParticle(collision); GameObject.Destroy(this.gameObject); } @@ -67,6 +67,8 @@ public class BulletScript : MonoBehaviour speed = dataBullet.speed; rb = this.GetComponent(); + + Physics.IgnoreCollision(GetComponent(),GameObject.Find("Player").GetComponent()); diff --git a/Plunderblock/Assets/Scripts/ScriptsKevin/Enemy.cs b/Plunderblock/Assets/Scripts/ScriptsKevin/EnemyHealth.cs similarity index 95% rename from Plunderblock/Assets/Scripts/ScriptsKevin/Enemy.cs rename to Plunderblock/Assets/Scripts/ScriptsKevin/EnemyHealth.cs index a6e5ad4..780ef07 100644 --- a/Plunderblock/Assets/Scripts/ScriptsKevin/Enemy.cs +++ b/Plunderblock/Assets/Scripts/ScriptsKevin/EnemyHealth.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Unity.VisualScripting; using UnityEngine; -public class Enemy : MonoBehaviour +public class EnemyHealth : MonoBehaviour { private int score = 1; private bool alive = true; diff --git a/Plunderblock/Assets/Scripts/ScriptsKevin/Enemy.cs.meta b/Plunderblock/Assets/Scripts/ScriptsKevin/EnemyHealth.cs.meta similarity index 100% rename from Plunderblock/Assets/Scripts/ScriptsKevin/Enemy.cs.meta rename to Plunderblock/Assets/Scripts/ScriptsKevin/EnemyHealth.cs.meta diff --git a/Plunderblock/Assets/Scripts/ScriptsKevin/ParticalClash.cs b/Plunderblock/Assets/Scripts/ScriptsKevin/ParticleClash.cs similarity index 92% rename from Plunderblock/Assets/Scripts/ScriptsKevin/ParticalClash.cs rename to Plunderblock/Assets/Scripts/ScriptsKevin/ParticleClash.cs index a765a58..ac505a6 100644 --- a/Plunderblock/Assets/Scripts/ScriptsKevin/ParticalClash.cs +++ b/Plunderblock/Assets/Scripts/ScriptsKevin/ParticleClash.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class ParticalClash : MonoBehaviour +public class ParticleClash : MonoBehaviour { public float lifeTime = 2; diff --git a/Plunderblock/Assets/Scripts/ScriptsKevin/ParticalClash.cs.meta b/Plunderblock/Assets/Scripts/ScriptsKevin/ParticleClash.cs.meta similarity index 100% rename from Plunderblock/Assets/Scripts/ScriptsKevin/ParticalClash.cs.meta rename to Plunderblock/Assets/Scripts/ScriptsKevin/ParticleClash.cs.meta diff --git a/Plunderblock/ProjectSettings/TagManager.asset b/Plunderblock/ProjectSettings/TagManager.asset index fd8a597..c498f6e 100644 --- a/Plunderblock/ProjectSettings/TagManager.asset +++ b/Plunderblock/ProjectSettings/TagManager.asset @@ -17,8 +17,8 @@ TagManager: - Ground - - - - - - + - Bullets + - Player - - -