```
feat(gameplay): 更新核心场景中的卡牌和能量豆配置 - 将能量豆5重命名为能量豆6,能量豆4重命名为能量豆7等,调整了所有 能量豆的命名顺序 - 将卡牌5重命名为卡牌1,并添加了新的组件包括召唤槽脚本和按钮交互 组件 - 为卡牌添加子对象Image用于显示卡牌内容 - 调整了卡牌和能量豆的层级结构和父子关系 - 实现了通过数字键1和2进行召唤的功能,支持指定召唤槽位 - 添加了UI元素的射线检测控制,部分元素设置为不响应射线点击 fix(input): 防止在UI元素上移动角色 - 在移动输入检查中增加了对EventSystem的判断,当鼠标指针位于 UI元素上方时禁止角色移动 - 避免了玩家在操作UI时意外移动角色的问题 ```
This commit is contained in:
1 parent
d4e8da8ab3
commit
2dfffd57fe
5 files changed
+266
-56
No files matched your search
@@ -119,30 +119,47 @@ public class MainCharacterCombat : MonoBehaviour
|
||||
|
||||
private void HandleSummonInput()
|
||||
{
|
||||
if (summoning || animator == null || movement == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Alpha2))
|
||||
{
|
||||
movement.StopMovement();
|
||||
if (attacking)
|
||||
{
|
||||
FinishAttack();
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Alpha1))
|
||||
{
|
||||
BeginSummon(humanSoldierPrefab);
|
||||
RequestSummon(1);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Alpha2))
|
||||
{
|
||||
BeginSummon(archerPrefab);
|
||||
RequestSummon(2);
|
||||
}
|
||||
}
|
||||
|
||||
public bool RequestSummon(int slot)
|
||||
{
|
||||
if (summoning || animator == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
GameObject prefab = slot == 1
|
||||
? humanSoldierPrefab
|
||||
: slot == 2
|
||||
? archerPrefab
|
||||
: null;
|
||||
if (prefab == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (movement != null)
|
||||
{
|
||||
movement.StopMovement();
|
||||
}
|
||||
|
||||
if (attacking)
|
||||
{
|
||||
FinishAttack();
|
||||
}
|
||||
|
||||
BeginSummon(prefab);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void BeginSummon(GameObject prefab)
|
||||
{
|
||||
if (prefab == null)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class MainCharacterDebugMovement : MonoBehaviour
|
||||
{
|
||||
@@ -71,6 +72,11 @@ public class MainCharacterDebugMovement : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (EventSystem.current != null && EventSystem.current.IsPointerOverGameObject())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
||||
if (!Physics.Raycast(ray, out RaycastHit hit))
|
||||
{
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof(Button))]
|
||||
public class SummonCardButton : MonoBehaviour
|
||||
{
|
||||
[Min(1)]
|
||||
public int summonSlot = 1;
|
||||
|
||||
private Button button;
|
||||
private MainCharacterCombat combat;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
button = GetComponent<Button>();
|
||||
combat = FindObjectOfType<MainCharacterCombat>();
|
||||
button.onClick.AddListener(OnClick);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.RemoveListener(OnClick);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
if (combat == null)
|
||||
{
|
||||
combat = FindObjectOfType<MainCharacterCombat>();
|
||||
}
|
||||
|
||||
if (combat != null)
|
||||
{
|
||||
combat.RequestSummon(summonSlot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: CylKsXykBSg0uwlH7D3NMglVNcpDcGUo3b0yJbyu49RAp3cINkikdpc=
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user