From e1f1e1712da2c54033afbb7941234815e9a81f09 Mon Sep 17 00:00:00 2001 From: Janis Meister Date: Fri, 24 Feb 2023 19:43:36 +0100 Subject: [PATCH] j --- Assets/Scenes/SampleScene.unity | 2 +- Assets/Scripts/Items/Hoe.cs | 15 +++++++++++++++ Assets/Scripts/PlayerController.cs | 1 - 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 9316669..71f3f54 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -424,7 +424,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 224768186} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -7.45, y: 4.21, z: 0} + m_LocalPosition: {x: -7.501, y: 2.978, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: diff --git a/Assets/Scripts/Items/Hoe.cs b/Assets/Scripts/Items/Hoe.cs index d73e866..e9afb44 100644 --- a/Assets/Scripts/Items/Hoe.cs +++ b/Assets/Scripts/Items/Hoe.cs @@ -3,9 +3,24 @@ using UnityEngine; [CreateAssetMenu(fileName = "Hoe", menuName = "Harvestdale/Tools/Hoe", order = 0)] public class Hoe : Tool { + + GameObject player; + private void Start() + { + player = GameObject.FindGameObjectWithTag("Player"); + } + + private Vector3 GetVector3IntInMouseDirection() + { + + Vector3 direction = (player.transform.position - GridBuildingSystem.Instance.GetSnappedMousePosition()).normalized; + Debug.Log(direction); + return direction; + } public override void OnUse() { Debug.Log("Hoe on use"); + GetVector3IntInMouseDirection(); } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index a05d1b9..c8c4640 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -59,7 +59,6 @@ public class PlayerController : MonoBehaviour else { Debug.Log("Not in range"); - } }