diff --git a/.idea/.idea.HALLUCINATE/.idea/workspace.xml b/.idea/.idea.HALLUCINATE/.idea/workspace.xml
index 05103c03..5a086632 100644
--- a/.idea/.idea.HALLUCINATE/.idea/workspace.xml
+++ b/.idea/.idea.HALLUCINATE/.idea/workspace.xml
@@ -7,17 +7,33 @@
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -187,7 +203,7 @@
-
+
diff --git a/Assets/Prefabs/NPC/xNPC.prefab b/Assets/Prefabs/NPC/xNPC.prefab
index fe08f0a0..d3ac66f4 100644
--- a/Assets/Prefabs/NPC/xNPC.prefab
+++ b/Assets/Prefabs/NPC/xNPC.prefab
@@ -609,7 +609,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7522161431095319480}
- m_Enabled: 1
+ m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 35bba55c2a743d042ab1fff35e29db50, type: 3}
m_Name:
diff --git a/Assets/Prefabs/projectile/_LazerPrọectile.prefab b/Assets/Prefabs/projectile/_LazerPrọectile.prefab
index 78737243..64fc3b19 100644
--- a/Assets/Prefabs/projectile/_LazerPrọectile.prefab
+++ b/Assets/Prefabs/projectile/_LazerPrọectile.prefab
@@ -14,6 +14,7 @@ GameObject:
- component: {fileID: 411349647056113735}
- component: {fileID: 2417107839128453854}
- component: {fileID: 6433774282585127385}
+ - component: {fileID: -8021594009672363794}
m_Layer: 0
m_Name: "_LazerPr\u1ECDectile"
m_TagString: Untagged
@@ -31,8 +32,8 @@ Transform:
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.69, z: 0.267}
- m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
- m_ConstrainProportionsScale: 0
+ m_LocalScale: {x: 0.05, y: 0.05, z: 0.05}
+ m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -108,7 +109,7 @@ SphereCollider:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
- m_IsTrigger: 0
+ m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
@@ -245,5 +246,34 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4e4f602386d4d484ea7a2a3b0c19ac21, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::LaserProjectile
- speed: 5
+ speed: 100
lifeTime: 5
+ damageAmount: 10
+ hitSound: Laser_Hit
+--- !u!54 &-8021594009672363794
+Rigidbody:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 3965388737199864462}
+ serializedVersion: 5
+ m_Mass: 1
+ m_LinearDamping: 0
+ m_AngularDamping: 0.05
+ m_CenterOfMass: {x: 0, y: 0, z: 0}
+ m_InertiaTensor: {x: 1, y: 1, z: 1}
+ m_InertiaRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_IncludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_ExcludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_ImplicitCom: 1
+ m_ImplicitTensor: 1
+ m_UseGravity: 1
+ m_IsKinematic: 1
+ m_Interpolate: 0
+ m_Constraints: 0
+ m_CollisionDetection: 0
diff --git a/Assets/Scenes/Cho môn AI/Only AI.unity b/Assets/Scenes/Cho môn AI/Only AI.unity
index 4692d679..4a1e9f7c 100644
--- a/Assets/Scenes/Cho môn AI/Only AI.unity
+++ b/Assets/Scenes/Cho môn AI/Only AI.unity
@@ -136487,7 +136487,7 @@ MonoBehaviour:
m_EditorClassIdentifier: Assembly-CSharp::Hallucinate.AI.GeminiService
apiKeys:
- AIzaSyC4DRm2dffDuDogYkY0Ag86p-EYLu67bDo
- - AIzaSyC4DRm2dffDuDogYkY0Ag86p-EYLu67bDo
+ - AQ.Ab8RN6JvwHD9tZXWlO7eb22ahV0rxUh5cAjB3-XfKW5H_KLiyQ
- AIzaSyC4DRm2dffDuDogYkY0Ag86p-EYLu67bDo
geminiURL: https://generativelanguage.googleapis.com/v1beta/models/gemini-flash-latest:generateContent
--- !u!1 &1143870345
diff --git a/Assets/Scripts/AI NPC/LaserProjectile.cs b/Assets/Scripts/AI NPC/LaserProjectile.cs
index 017700c6..a0155230 100644
--- a/Assets/Scripts/AI NPC/LaserProjectile.cs
+++ b/Assets/Scripts/AI NPC/LaserProjectile.cs
@@ -1,36 +1,66 @@
using UnityEngine;
using Hallucinate.Audio;
+using Invector;
public class LaserProjectile : MonoBehaviour
{
- public float speed = 5f;
+ public float speed = 15f; // Tăng tốc độ đạn để cảm giác mượt hơn
public float lifeTime = 5f;
+ public int damageAmount = 10;
[Header("Audio")]
public string hitSound = "Laser_Hit";
private void Start()
{
+ // Tự hủy sau một khoảng thời gian nếu không trúng gì
Destroy(gameObject, lifeTime);
}
private void Update()
{
- transform.position +=
- transform.forward *
- speed *
- Time.deltaTime;
+ // Di chuyển đạn
+ transform.position += transform.forward * speed * Time.deltaTime;
}
private void OnTriggerEnter(Collider other)
{
- if (other.CompareTag("Player"))
+ // Debug: Log tên và tag của bất cứ thứ gì đạn chạm vào
+ Debug.Log($"Laser collided with: {other.name} | Tag: {other.tag} | Layer: {LayerMask.LayerToName(other.gameObject.layer)}");
+
+ // Kiểm tra nếu trúng Player
+ if (other.CompareTag("Player") || other.GetComponentInParent() != null)
{
- Debug.Log("Player Hit");
+ var healthController = other.GetComponentInParent();
+
+ if (healthController != null)
+ {
+ Debug.Log($"HIT PLAYER! Found health controller on {healthController.gameObject.name}. Applying {damageAmount} damage.");
+ var damage = new vDamage(damageAmount);
+ damage.sender = transform;
+ damage.hitPosition = transform.position;
+ healthController.TakeDamage(damage);
+ }
+
+ // Luôn phá hủy đạn khi trúng Player
+ Impact();
+ return;
+ }
- AudioManager.Instance?.Play(hitSound, position: transform.position);
-
- Destroy(gameObject);
+ // Phá hủy đạn nếu trúng tường, sàn nhà (mọi thứ không phải trigger khác)
+ if (!other.isTrigger)
+ {
+ Debug.Log("Laser hit an obstacle (Wall/Floor).");
+ Impact();
}
}
+
+ private void Impact()
+ {
+ // Chạy âm thanh
+ AudioManager.Instance?.Play(hitSound, position: transform.position);
+
+ // Phá hủy đạn ngay lập tức
+ Destroy(gameObject);
+ }
}
\ No newline at end of file
diff --git a/Assets/Scripts/Player/CharacterController/vThirdPersonController.cs b/Assets/Scripts/Player/CharacterController/vThirdPersonController.cs
index f03a5a7a..c7c918b8 100644
--- a/Assets/Scripts/Player/CharacterController/vThirdPersonController.cs
+++ b/Assets/Scripts/Player/CharacterController/vThirdPersonController.cs
@@ -318,6 +318,14 @@ namespace Invector.vCharacterController
currentStaminaRecoveryDelay = 2f;
}
+ public override void TakeDamage(vDamage damage)
+ {
+ Debug.Log($"Player TakeDamage called. Damage: {damage.damageValue}. Current Health before: {currentHealth}");
+ base.TakeDamage(damage);
+ Debug.Log($"Player Health after: {currentHealth}");
+ // Additional logic for player-specific damage handling can be added here
+ }
+
#region Check Action Triggers
diff --git a/UIElementsSchema/Hallucinate.UI.Components.xsd b/UIElementsSchema/Hallucinate.UI.Components.xsd
new file mode 100644
index 00000000..66650ddc
--- /dev/null
+++ b/UIElementsSchema/Hallucinate.UI.Components.xsd
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/UIElementsSchema/UIElements.xsd b/UIElementsSchema/UIElements.xsd
index 87e75bca..66720b0f 100644
--- a/UIElementsSchema/UIElements.xsd
+++ b/UIElementsSchema/UIElements.xsd
@@ -1,5 +1,5 @@
-
+
@@ -22,4 +22,5 @@
+
\ No newline at end of file
diff --git a/UIElementsSchema/Unity.Multiplayer.PlayMode.Editor.xsd b/UIElementsSchema/Unity.Multiplayer.PlayMode.Editor.xsd
index f3cfe0c7..f405e94c 100644
--- a/UIElementsSchema/Unity.Multiplayer.PlayMode.Editor.xsd
+++ b/UIElementsSchema/Unity.Multiplayer.PlayMode.Editor.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/Unity.Profiling.Editor.UI.xsd b/UIElementsSchema/Unity.Profiling.Editor.UI.xsd
index f70d3a50..0c8042a8 100644
--- a/UIElementsSchema/Unity.Profiling.Editor.UI.xsd
+++ b/UIElementsSchema/Unity.Profiling.Editor.UI.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/Unity.Profiling.Editor.xsd b/UIElementsSchema/Unity.Profiling.Editor.xsd
index e61bc51e..e8aaa8a4 100644
--- a/UIElementsSchema/Unity.Profiling.Editor.xsd
+++ b/UIElementsSchema/Unity.Profiling.Editor.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/Unity.UI.Builder.xsd b/UIElementsSchema/Unity.UI.Builder.xsd
index f306e663..49c7c46b 100644
--- a/UIElementsSchema/Unity.UI.Builder.xsd
+++ b/UIElementsSchema/Unity.UI.Builder.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/Unity.UIToolkit.Editor.xsd b/UIElementsSchema/Unity.UIToolkit.Editor.xsd
index 9124366b..17076465 100644
--- a/UIElementsSchema/Unity.UIToolkit.Editor.xsd
+++ b/UIElementsSchema/Unity.UIToolkit.Editor.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Accessibility.xsd b/UIElementsSchema/UnityEditor.Accessibility.xsd
index 4921c116..4311a384 100644
--- a/UIElementsSchema/UnityEditor.Accessibility.xsd
+++ b/UIElementsSchema/UnityEditor.Accessibility.xsd
@@ -1,5 +1,5 @@
-
+
@@ -38,7 +38,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
@@ -70,7 +70,7 @@
-
+
@@ -93,7 +93,7 @@
-
+
@@ -117,5 +117,5 @@
-
+
\ No newline at end of file
diff --git a/UIElementsSchema/UnityEditor.Audio.UIElements.xsd b/UIElementsSchema/UnityEditor.Audio.UIElements.xsd
index 21c31779..74e05ec3 100644
--- a/UIElementsSchema/UnityEditor.Audio.UIElements.xsd
+++ b/UIElementsSchema/UnityEditor.Audio.UIElements.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Experimental.GraphView.xsd b/UIElementsSchema/UnityEditor.Experimental.GraphView.xsd
index bd6b835d..7f5f7d01 100644
--- a/UIElementsSchema/UnityEditor.Experimental.GraphView.xsd
+++ b/UIElementsSchema/UnityEditor.Experimental.GraphView.xsd
@@ -1,5 +1,5 @@
-
+
@@ -54,7 +54,7 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Inspector.GraphicsSettingsInspectors.xsd b/UIElementsSchema/UnityEditor.Inspector.GraphicsSettingsInspectors.xsd
index 01ed10db..2296bda4 100644
--- a/UIElementsSchema/UnityEditor.Inspector.GraphicsSettingsInspectors.xsd
+++ b/UIElementsSchema/UnityEditor.Inspector.GraphicsSettingsInspectors.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Inspector.xsd b/UIElementsSchema/UnityEditor.Inspector.xsd
index 392fb799..fdc2dacb 100644
--- a/UIElementsSchema/UnityEditor.Inspector.xsd
+++ b/UIElementsSchema/UnityEditor.Inspector.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Overlays.xsd b/UIElementsSchema/UnityEditor.Overlays.xsd
index 4632a4d6..5eaf771f 100644
--- a/UIElementsSchema/UnityEditor.Overlays.xsd
+++ b/UIElementsSchema/UnityEditor.Overlays.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.PackageManager.UI.Internal.xsd b/UIElementsSchema/UnityEditor.PackageManager.UI.Internal.xsd
index 46b52097..b58e3930 100644
--- a/UIElementsSchema/UnityEditor.PackageManager.UI.Internal.xsd
+++ b/UIElementsSchema/UnityEditor.PackageManager.UI.Internal.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Rendering.xsd b/UIElementsSchema/UnityEditor.Rendering.xsd
index 99dd0559..fd55f33e 100644
--- a/UIElementsSchema/UnityEditor.Rendering.xsd
+++ b/UIElementsSchema/UnityEditor.Rendering.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Search.xsd b/UIElementsSchema/UnityEditor.Search.xsd
index 5b6c9fe3..4e9ca54c 100644
--- a/UIElementsSchema/UnityEditor.Search.xsd
+++ b/UIElementsSchema/UnityEditor.Search.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.ShaderGraph.Drawing.xsd b/UIElementsSchema/UnityEditor.ShaderGraph.Drawing.xsd
index 7c7e46d5..68876f74 100644
--- a/UIElementsSchema/UnityEditor.ShaderGraph.Drawing.xsd
+++ b/UIElementsSchema/UnityEditor.ShaderGraph.Drawing.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.ShortcutManagement.xsd b/UIElementsSchema/UnityEditor.ShortcutManagement.xsd
index e3ce1d18..770aa66c 100644
--- a/UIElementsSchema/UnityEditor.ShortcutManagement.xsd
+++ b/UIElementsSchema/UnityEditor.ShortcutManagement.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.Toolbars.xsd b/UIElementsSchema/UnityEditor.Toolbars.xsd
index ee114446..bbfbf54b 100644
--- a/UIElementsSchema/UnityEditor.Toolbars.xsd
+++ b/UIElementsSchema/UnityEditor.Toolbars.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.U2D.Sprites.SpriteEditorTool.xsd b/UIElementsSchema/UnityEditor.U2D.Sprites.SpriteEditorTool.xsd
index 7a96da9a..93cd14bb 100644
--- a/UIElementsSchema/UnityEditor.U2D.Sprites.SpriteEditorTool.xsd
+++ b/UIElementsSchema/UnityEditor.U2D.Sprites.SpriteEditorTool.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.UIElements.Debugger.xsd b/UIElementsSchema/UnityEditor.UIElements.Debugger.xsd
index d863ebf2..b55d2e18 100644
--- a/UIElementsSchema/UnityEditor.UIElements.Debugger.xsd
+++ b/UIElementsSchema/UnityEditor.UIElements.Debugger.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.UIElements.ProjectSettings.xsd b/UIElementsSchema/UnityEditor.UIElements.ProjectSettings.xsd
index 2f969737..6beca655 100644
--- a/UIElementsSchema/UnityEditor.UIElements.ProjectSettings.xsd
+++ b/UIElementsSchema/UnityEditor.UIElements.ProjectSettings.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEditor.UIElements.xsd b/UIElementsSchema/UnityEditor.UIElements.xsd
index e88c8727..b32a6b74 100644
--- a/UIElementsSchema/UnityEditor.UIElements.xsd
+++ b/UIElementsSchema/UnityEditor.UIElements.xsd
@@ -1,5 +1,5 @@
-
+
diff --git a/UIElementsSchema/UnityEngine.UIElements.xsd b/UIElementsSchema/UnityEngine.UIElements.xsd
index 4edacdf1..f75da44b 100644
--- a/UIElementsSchema/UnityEngine.UIElements.xsd
+++ b/UIElementsSchema/UnityEngine.UIElements.xsd
@@ -1,5 +1,5 @@
-
+