update hehehe
This commit is contained in:
@@ -20,6 +20,7 @@ GameObject:
|
||||
- component: {fileID: 5773292363125757170}
|
||||
- component: {fileID: 504047695906043424}
|
||||
- component: {fileID: -5076913349690967641}
|
||||
- component: {fileID: 591040529181574494}
|
||||
m_Layer: 0
|
||||
m_Name: Player
|
||||
m_TagString: Player
|
||||
@@ -399,6 +400,7 @@ MonoBehaviour:
|
||||
_NetworkedCameraRotation: {x: 0, y: 0, z: 0, w: 0}
|
||||
_NetworkedMoveInput: {x: 0, y: 0}
|
||||
_NetworkedSpeed: 0
|
||||
_NetworkedPosition: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &3043298118541876184
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -497,6 +499,23 @@ MonoBehaviour:
|
||||
- {fileID: 830356296960548640}
|
||||
- {fileID: 504047695906043424}
|
||||
ForceRemoteRenderTimeframe: 0
|
||||
--- !u!114 &591040529181574494
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1054594849095937263}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: bf6aff0b7e11d41439ac80f4963a0795, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::OnlyScove.Scripts.PlayerDebugProvider
|
||||
stateMachine: {fileID: 830356296960548640}
|
||||
debugCanvas: {fileID: 0}
|
||||
followOffset: {x: 1.5, y: 2, z: 0}
|
||||
smoothTime: 0.15
|
||||
lookAtCamera: 1
|
||||
--- !u!1 &3751838835891881608
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -987,13 +987,13 @@ RectTransform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1222728863}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
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:
|
||||
- {fileID: 1880766867}
|
||||
m_Father: {fileID: 1579856156}
|
||||
m_Father: {fileID: 1493821250}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
@@ -1186,6 +1186,42 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1493821249
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1493821250}
|
||||
m_Layer: 5
|
||||
m_Name: PromptGroup
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1493821250
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1493821249}
|
||||
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:
|
||||
- {fileID: 1222728864}
|
||||
m_Father: {fileID: 1579856156}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!1 &1579856151
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1219,8 +1255,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::UI.MyUIDisplay
|
||||
playerDebugProvider: {fileID: 0}
|
||||
interactionPromptContainer: {fileID: 1222728863}
|
||||
interactionPromptText: {fileID: 0}
|
||||
interactionPromptContainer: {fileID: 1493821249}
|
||||
interactionPromptText: {fileID: 1222728865}
|
||||
--- !u!114 &1579856153
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -1296,7 +1332,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1222728864}
|
||||
- {fileID: 1493821250}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
@@ -1337,7 +1373,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::OnlyScove.Scripts.DoorInteractable
|
||||
interactionData: {fileID: 11400000, guid: d3011be1ae644ac4e8430e89705cf443, type: 2}
|
||||
woodDoorScript: {fileID: 0}
|
||||
woodDoorScript: {fileID: 1771364118}
|
||||
animator: {fileID: 0}
|
||||
boolParameterName: IsOpen
|
||||
--- !u!65 &1667007659
|
||||
@@ -1682,7 +1718,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::OnlyScove.Scripts.DoorInteractable
|
||||
interactionData: {fileID: 11400000, guid: d3011be1ae644ac4e8430e89705cf443, type: 2}
|
||||
woodDoorScript: {fileID: 0}
|
||||
woodDoorScript: {fileID: 1771364118}
|
||||
animator: {fileID: 0}
|
||||
boolParameterName: IsOpen
|
||||
--- !u!4 &1907283845
|
||||
|
||||
@@ -19,6 +19,16 @@ namespace OnlyScove.Scripts
|
||||
private Material lampMaterial;
|
||||
private Color originalEmissionColor;
|
||||
|
||||
public override string InteractionPrompt
|
||||
{
|
||||
get
|
||||
{
|
||||
string action = isOn ? "Tắt " : "Bật ";
|
||||
string name = interactionData != null ? interactionData.promptText : "Đèn";
|
||||
return action + name;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// Khởi tạo Material (tạo bản thực thi riêng để không lỗi Shader)
|
||||
|
||||
@@ -1,47 +1,75 @@
|
||||
using OnlyScove.Scripts;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class MyUIDisplay : MonoBehaviour
|
||||
public class MyUIDisplay : MonoBehaviour
|
||||
{
|
||||
[Header("References")]
|
||||
public PlayerDebugProvider playerDebugProvider;
|
||||
|
||||
[Header("UI Prompt")]
|
||||
public GameObject interactionPromptContainer;
|
||||
|
||||
public UnityEngine.UI.Text interactionPromptText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
public PlayerDebugProvider playerDebugProvider;
|
||||
|
||||
[Header("UI Prompt")]
|
||||
public GameObject interactionPromptContainer;
|
||||
public TextMeshProUGUI interactionPromptText;
|
||||
//if (playerDebugProvider == null)
|
||||
//playerDebugProvider = FindFirstObjectByType<PlayerDebugProvider>();
|
||||
|
||||
private void Start()
|
||||
// Luôn ẩn lúc bắt đầu
|
||||
if (interactionPromptContainer != null)
|
||||
interactionPromptContainer.SetActive(false);
|
||||
|
||||
TryFindPlayer();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (playerDebugProvider == null)
|
||||
{
|
||||
if (playerDebugProvider == null)
|
||||
playerDebugProvider = FindFirstObjectByType<PlayerDebugProvider>();
|
||||
|
||||
// Luôn ẩn lúc bắt đầu
|
||||
if (interactionPromptContainer != null)
|
||||
interactionPromptContainer.SetActive(false);
|
||||
TryFindPlayer();
|
||||
if (playerDebugProvider == null) return;
|
||||
}
|
||||
if (interactionPromptContainer == null) return;
|
||||
|
||||
private void Update()
|
||||
IInteractable interactable = playerDebugProvider.GetActiveInteractable();
|
||||
|
||||
if (interactable != null)
|
||||
{
|
||||
if (playerDebugProvider == null || interactionPromptContainer == null) return;
|
||||
// Hiện UI tại vị trí cố định bạn đã đặt trong Canvas
|
||||
interactionPromptContainer.SetActive(true);
|
||||
|
||||
IInteractable interactable = playerDebugProvider.GetActiveInteractable();
|
||||
|
||||
if (interactable != null)
|
||||
if (!interactionPromptContainer.activeSelf)
|
||||
{
|
||||
// Hiện UI tại vị trí cố định bạn đã đặt trong Canvas
|
||||
interactionPromptContainer.SetActive(true);
|
||||
}
|
||||
|
||||
if (interactionPromptText != null)
|
||||
{
|
||||
interactionPromptText.text = interactable.InteractionPrompt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (interactionPromptText != null)
|
||||
interactionPromptText.text = interactable.InteractionPrompt;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (interactionPromptContainer.activeSelf)
|
||||
interactionPromptContainer.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TryFindPlayer()
|
||||
{
|
||||
if (PlayerStateMachine.Local != null)
|
||||
{
|
||||
playerDebugProvider = PlayerStateMachine.Local.GetComponent<PlayerDebugProvider>();
|
||||
}
|
||||
|
||||
if (playerDebugProvider == null)
|
||||
{
|
||||
playerDebugProvider = Object.FindFirstObjectByType<PlayerDebugProvider>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user