added: label over hover
This commit is contained in:
@@ -3,4 +3,5 @@ using UnityEngine;
|
||||
public interface IInteractable{
|
||||
public void Interact();
|
||||
public void CancelInteract();
|
||||
public void OnObserverDetected(EnvironmentObserver observer);
|
||||
}
|
||||
|
||||
@@ -3,5 +3,8 @@ using UnityEngine;
|
||||
namespace Reset.Items{
|
||||
public class Ability : Item, IEquipable{
|
||||
public NodeCanvas.Framework.Graph behaviourGraph;
|
||||
public override void DrawItemInfo(Vector3 position){
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
namespace Reset.Items{
|
||||
public abstract class Item : ScriptableObject{
|
||||
public string itemName{ get; set; }
|
||||
public string itemName;
|
||||
|
||||
public float permanency;
|
||||
public float essenceRequiredForPermanency;
|
||||
@@ -20,5 +20,7 @@ namespace Reset.Items{
|
||||
newItemDrop.item = this;
|
||||
return newItemDrop;
|
||||
}
|
||||
|
||||
public abstract void DrawItemInfo(Vector3 position);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Drawing;
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -34,5 +35,11 @@ namespace Reset.Items{
|
||||
public void DestroyOnOwnerRpc(){
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
public void OnObserverDetected(EnvironmentObserver observer){
|
||||
Draw.ingame.Label2D(transform.position + Vector3.up * 2f, item.itemName, 24);
|
||||
|
||||
item.DrawItemInfo(transform.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Drawing;
|
||||
using NodeCanvas.StateMachines;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -11,5 +12,11 @@ namespace Reset.Items{
|
||||
void Awake(){
|
||||
|
||||
}
|
||||
|
||||
public override void DrawItemInfo(Vector3 position){
|
||||
Debug.Log("hiuh");
|
||||
Draw.ingame.Label2D(position + Vector3.up * 1.6f, "Damage goes here");
|
||||
Draw.ingame.Label2D(position + Vector3.up * 1.35f, "Speed goes here");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,6 +127,9 @@ public class EnvironmentObserver{
|
||||
}
|
||||
|
||||
if (hit.transform != null) {
|
||||
if (hit.transform.GetComponent<IInteractable>() != null) {
|
||||
hit.transform.GetComponent<IInteractable>().OnObserverDetected(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user