Controlevents are now working

This commit is contained in:
finnchen123
2026-01-25 13:23:03 +01:00
parent 93f02eee13
commit b657de5ea0
7 changed files with 75 additions and 33 deletions

View File

@@ -11,6 +11,16 @@ namespace Assets.Scripts.Player
UIHandler uihandler;
GameObject interact;
private void OnEnable()
{
ControlEvents.OnLookingInput += LookAround;
}
private void OnDisable()
{
ControlEvents.OnLookingInput -= LookAround;
}
// Start is called before the first frame update
void Start()
{
@@ -43,7 +53,7 @@ namespace Assets.Scripts.Player
return null;
}
public void LookAround(float pitch)
public void LookAround(float pitch, float yaw)
{
transform.localRotation = Quaternion.Euler(pitch, 0f, 0f);
}

View File

@@ -38,6 +38,14 @@ namespace Assets.Scripts.Player
#if UNITY_EDITOR
SceneHandler.switchGameToMenu();
#endif
ControlEvents.OnLookingInput += rotate;
ControlEvents.OnMovingInput += move;
}
private void OnDisable()
{
ControlEvents.OnLookingInput -= rotate;
ControlEvents.OnMovingInput -= move;
}
void Start()
@@ -179,7 +187,7 @@ namespace Assets.Scripts.Player
GameObject.Find("QuestLog").GetComponent<QuestLog>().updateQuests("explore", gameObject, 1);
}
public void rotate(float yaw){
public void rotate(float pitch, float yaw){
transform.rotation = Quaternion.Euler(0f, yaw, 0f);
}