From 96391fa3bb06946ec2a182891a45720e0894d329 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E5=8F=B7=E6=95=AC?= <153802103@qq.com>
Date: Tue, 24 Dec 2024 10:58:23 +0800
Subject: [PATCH] =?UTF-8?q?=E7=81=AD=E7=81=ABbug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
xiaofang/Assets/Scenes/Tmap 1.unity | 100 +++++++++---------
.../Script/Character/Skills/Skill_watering.cs | 17 +--
.../Script/Character/Skills/UseSkill.cs | 10 +-
xiaofang/Assets/Script/Item/Fire.cs | 5 +-
4 files changed, 73 insertions(+), 59 deletions(-)
diff --git a/xiaofang/Assets/Scenes/Tmap 1.unity b/xiaofang/Assets/Scenes/Tmap 1.unity
index bcabd31a..f7367d3c 100644
--- a/xiaofang/Assets/Scenes/Tmap 1.unity
+++ b/xiaofang/Assets/Scenes/Tmap 1.unity
@@ -704,6 +704,52 @@ Transform:
m_CorrespondingSourceObject: {fileID: 470742, guid: 1a983474f33e2a3448edad336be6c954, type: 3}
m_PrefabInstance: {fileID: 39914477}
m_PrefabAsset: {fileID: 0}
+--- !u!1 &41603123
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 41603125}
+ - component: {fileID: 41603124}
+ m_Layer: 0
+ m_Name: BurstCollisionWorld
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &41603124
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 41603123}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ cellSpans:
+ m_AlignBytes: 16
+--- !u!4 &41603125
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 41603123}
+ 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_RootOrder: 38
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &51381387
GameObject:
m_ObjectHideFlags: 0
@@ -7951,10 +7997,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 177156116ddbf5a4c811e0da050f8c9d, type: 3}
m_Name:
m_EditorClassIdentifier:
- detectionRadius: 10
+ detectionRadius: 2
fireLayerMask:
serializedVersion: 2
- m_Bits: 0
+ m_Bits: 1
--- !u!114 &382802819
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -26375,7 +26421,7 @@ Transform:
- {fileID: 1043610486}
- {fileID: 437592030}
m_Father: {fileID: 0}
- m_RootOrder: 38
+ m_RootOrder: 37
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1670656696
GameObject:
@@ -26796,7 +26842,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
- m_IsActive: 1
+ m_IsActive: 0
--- !u!81 &1707678917
AudioListener:
m_ObjectHideFlags: 0
@@ -27568,52 +27614,6 @@ Transform:
m_CorrespondingSourceObject: {fileID: 425252, guid: c1d713571e37c7945aadfdbabc6c59a4, type: 3}
m_PrefabInstance: {fileID: 1750111327}
m_PrefabAsset: {fileID: 0}
---- !u!1 &1755366624
-GameObject:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- serializedVersion: 6
- m_Component:
- - component: {fileID: 1755366626}
- - component: {fileID: 1755366625}
- m_Layer: 0
- m_Name: BurstCollisionWorld
- m_TagString: Untagged
- m_Icon: {fileID: 0}
- m_NavMeshLayer: 0
- m_StaticEditorFlags: 0
- m_IsActive: 1
---- !u!114 &1755366625
-MonoBehaviour:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 1755366624}
- m_Enabled: 1
- m_EditorHideFlags: 0
- m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3}
- m_Name:
- m_EditorClassIdentifier:
- cellSpans:
- m_AlignBytes: 16
---- !u!4 &1755366626
-Transform:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 1755366624}
- 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_RootOrder: 37
- m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1755977750
PrefabInstance:
m_ObjectHideFlags: 0
diff --git a/xiaofang/Assets/Script/Character/Skills/Skill_watering.cs b/xiaofang/Assets/Script/Character/Skills/Skill_watering.cs
index e879310c..01bcf6f3 100644
--- a/xiaofang/Assets/Script/Character/Skills/Skill_watering.cs
+++ b/xiaofang/Assets/Script/Character/Skills/Skill_watering.cs
@@ -19,13 +19,10 @@ public class Skill_watering : MonoBehaviour
/// 需要一个物体
public void StartWatering(GameObject currentItem)
{
- CharacterAin.SetSkillAin(CharacterSkill.Watering);
+
// 检测附近的火源并调整角色朝向
- DetectAndLookAtFire();
- if (currentItem.GetComponent() != null)
- {
- currentItem.GetComponent().StartFire();
- }
+ DetectAndLookAtFire(currentItem);
+
}
///
@@ -44,8 +41,9 @@ public class Skill_watering : MonoBehaviour
///
/// 检测周围的火源,并让角色朝向最近的火源
///
- private void DetectAndLookAtFire()
+ private void DetectAndLookAtFire(GameObject currentItem)
{
+
Collider[] objectsInRange = Physics.OverlapSphere(transform.position, detectionRadius, fireLayerMask);
// 遍历范围内的所有对象,查找标签为 "fire" 的对象
@@ -61,6 +59,11 @@ public class Skill_watering : MonoBehaviour
{
nearestFire = obj;
minDistance = distance;
+ CharacterAin.SetSkillAin(CharacterSkill.Watering);
+ if (currentItem.GetComponent() != null)
+ {
+ currentItem.GetComponent().StartFire();
+ }
}
}
}
diff --git a/xiaofang/Assets/Script/Character/Skills/UseSkill.cs b/xiaofang/Assets/Script/Character/Skills/UseSkill.cs
index 05586585..42ad61bd 100644
--- a/xiaofang/Assets/Script/Character/Skills/UseSkill.cs
+++ b/xiaofang/Assets/Script/Character/Skills/UseSkill.cs
@@ -57,6 +57,10 @@ public class UseSkill : MonoBehaviour
{
currentItem.transform.Rotate(180f, -80f, -30f);
}
+ if (currentItem.transform.name == "gun")
+ {
+ currentItem.transform.Rotate(0, 180f, 0);
+ }
}
if (Input.GetKeyDown(KeyCode.Q))
{
@@ -75,7 +79,11 @@ public class UseSkill : MonoBehaviour
}
if (Input.GetMouseButtonDown(0))
{
-
+ if (currentItem == null)
+ {
+ return;
+ }
+ Debug.Log(00000000000000000);
_skill_Watering.StartWatering(currentItem);
if (currentItem.gameObject.name == "gun")
{
diff --git a/xiaofang/Assets/Script/Item/Fire.cs b/xiaofang/Assets/Script/Item/Fire.cs
index 65ec710b..b3756071 100644
--- a/xiaofang/Assets/Script/Item/Fire.cs
+++ b/xiaofang/Assets/Script/Item/Fire.cs
@@ -129,7 +129,10 @@ public class Fire : MonoBehaviour
// 如果玩家按住键达到指定时间,停止火焰
StopFire();
isExtinguishing = true; // 防止重复触发灭火
- XFS.instance.water.SetActive(false);
+ if (XFS.instance.IShavewater)
+ {
+ XFS.instance.water.SetActive(false);
+ }
}
}
}