Added interaction text next to cursor

This commit is contained in:
janis
2022-02-14 19:17:10 +01:00
parent cd3d015226
commit d59bf90deb
4 changed files with 511 additions and 509 deletions

View File

@@ -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)

View File

@@ -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");
}
}