mirror of
https://github.com/DerTyp7/example-top-down-unity.git
synced 2025-10-29 12:32:09 +01:00
Added interaction text next to cursor
This commit is contained in:
@@ -19,8 +19,8 @@ public class PlayerInteraction : MonoBehaviour
|
||||
{
|
||||
// Debug.Log("Target Position: " + hit.collider.gameObject.transform.position);
|
||||
HandleInteraction(interactable);
|
||||
interactionText.text = interactable.GetDescription();
|
||||
successfulHit = true;
|
||||
HandleInteractionText(interactable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ public class PlayerInteraction : MonoBehaviour
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HandleInteractionText() // interaction text has to follow mouse cursor
|
||||
void HandleInteractionText(Interactable interactable)
|
||||
{
|
||||
|
||||
}
|
||||
interactionText.text = interactable.GetDescription();
|
||||
interactionText.transform.position = new Vector3(Input.mousePosition.x + interactionText.rectTransform.sizeDelta.x / 2 + 20, Input.mousePosition.y - 5, Input.mousePosition.z);
|
||||
|
||||
}
|
||||
void HandleInteraction(Interactable interactable)
|
||||
{
|
||||
switch (interactable.interactionType)
|
||||
|
||||
@@ -7,8 +7,10 @@ public class TreeInteraction : Interactable
|
||||
public override string GetDescription() => "Baum muss schreie";
|
||||
public override void Interact()
|
||||
{
|
||||
if(isInRange())
|
||||
if (isInRange())
|
||||
Debug.Log("AaaaaaaaaaAaAAaAaAAaAaAaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
|
||||
else
|
||||
Debug.Log("Tree is not in range");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user