Passion & UI
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cielonos.MainGame;
|
||||
using SickscoreGames.HUDNavigationSystem;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
@@ -49,6 +50,21 @@ namespace Cielonos.Core.Interaction
|
||||
{
|
||||
interactionTrigger.GetComponent<Collider>().enabled = enabled;
|
||||
navigation.showIndicator = enabled && navigation.showIndicator;
|
||||
|
||||
if (!enabled)
|
||||
{
|
||||
var player = MainGameManager.Player;
|
||||
if (player != null && player.interactionSc != null && player.interactionSc.currentInteractable == this)
|
||||
{
|
||||
// 从玩家的选择列表中移除此物体的所有选项,防止残留选项造成后续按 R 键误触发
|
||||
foreach (var choice in choices)
|
||||
{
|
||||
player.interactionSc.currentChoices.Remove(choice);
|
||||
}
|
||||
// 清除控制器引用的当前交互对象,并隐藏 UI Area
|
||||
player.interactionSc.RemoveCurrentInteractable(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,11 +97,16 @@ namespace Cielonos.Core.Interaction
|
||||
{
|
||||
public string choiceName;
|
||||
public Action action;
|
||||
|
||||
public InteractionChoice(string name, Action action)
|
||||
/// <summary>
|
||||
/// 此选项是否可执行。false 时 UI 灰显,按下 R 键也不会触发 action。
|
||||
/// </summary>
|
||||
public bool isInteractable;
|
||||
|
||||
public InteractionChoice(string name, Action action, bool isInteractable = true)
|
||||
{
|
||||
this.choiceName = name;
|
||||
this.action = action;
|
||||
this.isInteractable = isInteractable;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user