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_Name:
m_EditorClassIdentifier:
interactionPrompt: press [E] to open lift door
interactionPrompt:
door: {fileID: 0}
liftController: {fileID: 0}
--- !u!65 &6504267406812371461

View file

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

View file

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

View file

@ -4,20 +4,26 @@
* description: interaction prompt demo with a probuilder donut
*/
using UnityEngine;
/// <summary>
/// demo donut interactable class
/// </summary>
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)
{
GameManager.Instance.ClearInteractionPrompt();
}
// private void OnTriggerEnter(Collider other)
// {
// GameManager.Instance.SetInteractionPrompt("This is a Donut");
// }
//
// private void OnTriggerExit(Collider other)
// {
// GameManager.Instance.ClearInteractionPrompt();
// }
}