game(scripts): interim prompt

This commit is contained in:
Mark Joshwel 2024-08-16 22:54:49 +08:00
parent 9f81a7a6ab
commit 164e31ad88
4 changed files with 31 additions and 9 deletions

View file

@ -190,7 +190,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3a46a62138bd3774aa62b76560629f46, type: 3} m_Script: {fileID: 11500000, guid: 3a46a62138bd3774aa62b76560629f46, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
interactionPrompt: press [E] to open lift door interactionPrompt:
door: {fileID: 0} door: {fileID: 0}
liftController: {fileID: 0} liftController: {fileID: 0}
--- !u!65 &6504267406812371461 --- !u!65 &6504267406812371461

View file

@ -48,6 +48,14 @@ public enum DoorType
/// </summary> /// </summary>
[HideInInspector] public bool opening; [HideInInspector] public bool opening;
/// <summary>
/// set the interaction prompt
/// </summary>
private void Awake()
{
interactionPrompt = "Press [E] to open the door";
}
/// <summary> /// <summary>
/// to interact with the door /// to interact with the door
/// </summary> /// </summary>

View file

@ -21,6 +21,14 @@ public class LiftDoorController : CommonInteractable
/// </summary> /// </summary>
[SerializeField] private LiftController liftController; [SerializeField] private LiftController liftController;
/// <summary>
/// set the interaction prompt
/// </summary>
private void Awake()
{
interactionPrompt = "Press [E] to call the lift";
}
/// <summary> /// <summary>
/// to call the open door function /// to call the open door function
/// </summary> /// </summary>

View file

@ -4,20 +4,26 @@
* description: interaction prompt demo with a probuilder donut * description: interaction prompt demo with a probuilder donut
*/ */
using UnityEngine;
/// <summary> /// <summary>
/// demo donut interactable class /// demo donut interactable class
/// </summary> /// </summary>
public class PlaygroundDonut : CommonInteractable public class PlaygroundDonut : CommonInteractable
{ {
private void OnTriggerEnter(Collider other) /// <summary>
/// set the interaction prompt
/// </summary>
private void Awake()
{ {
GameManager.Instance.SetInteractionPrompt("This is a Donut"); interactionPrompt = "This is a Donut";
} }
private void OnTriggerExit(Collider other) // private void OnTriggerEnter(Collider other)
{ // {
GameManager.Instance.ClearInteractionPrompt(); // GameManager.Instance.SetInteractionPrompt("This is a Donut");
} // }
//
// private void OnTriggerExit(Collider other)
// {
// GameManager.Instance.ClearInteractionPrompt();
// }
} }