Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / Colectible Inventory / SlotController.cs
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using UnityEngine.UI;
  6. public class SlotController : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
  7. {
  8. /* [HideInInspector]
  9. public string memoryName;
  10. [HideInInspector]
  11. public string description;*/
  12. public Item item;
  13. [HideInInspector]
  14. public Image imageComponent;
  15. private Image informationPanel;
  16. private Text infoText;
  17. void Start()
  18. {
  19. imageComponent = GetComponent<Image>();
  20. informationPanel = GameObject.Find("Information Panel").GetComponent<Image>();
  21. infoText = GameObject.Find("InfoText").GetComponent<Text>();
  22. }
  23. public void OnPointerEnter(PointerEventData pointerEventData)
  24. {
  25. //Output to console the GameObject's name and the following message
  26. informationPanel.color = new Color(1, 1, 1, 1);
  27. infoText.text = "You recall this memory by " + item.name + " where " + item.description;
  28. }
  29. //Detect when Cursor leaves the GameObject
  30. public void OnPointerExit(PointerEventData pointerEventData)
  31. {
  32. //Output the following message with the GameObject's name
  33. informationPanel.color = new Color(1, 1, 1, 0);
  34. infoText.text = "";
  35. }
  36. }