Advertisement
dronkowitz

TalkablePerson.cs

Nov 4th, 2022 (edited)
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. [RequireComponent(typeof(ActionScheduler))]
  6. public class TalkablePerson : MonoBehaviour, IInteractable
  7. {
  8.     public ConversationPiece[] conversationPieces;
  9.     public UnityEvent startHoverEvent;
  10.     public UnityEvent endHoverEvent;
  11.  
  12.     public bool CanInteract(bool isPlayerInteraction)
  13.     {
  14.         return true;
  15.     }
  16.  
  17.     public void Interact(PlayerMovement player)
  18.     {
  19.         GetComponent<ActionScheduler>().CancelCurrentAction();
  20.         HUD.Instance.StartConverstation(conversationPieces);
  21.     }
  22.  
  23.    
  24.  
  25.     public void StartHover()
  26.     {
  27.         startHoverEvent?.Invoke();
  28.     }
  29.  
  30.     public void StopHover()
  31.     {
  32.         endHoverEvent?.Invoke();
  33.     }
  34.  
  35.    
  36.  
  37.    
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement