Added sprint mechanic, unified options menu

This commit is contained in:
finnchen123
2026-02-15 11:40:42 +01:00
parent 55ba43401d
commit 395e58e45c
12 changed files with 11928 additions and 21072 deletions

View File

@@ -165,7 +165,7 @@ namespace Assets.Scripts.Player
return new PlayerObject(name, playerRace, playerClass, difficulty);
}
public void move(Vector3 input)
public void move(Vector3 input, bool isSprinting)
{
if(gameObject.GetComponent<Rigidbody>().linearVelocity.y <= 0.1f && gameObject.GetComponent<Rigidbody>().linearVelocity.y >= -0.1f){
jumpFrameCounter++;
@@ -185,8 +185,9 @@ namespace Assets.Scripts.Player
}
}
Vector3 movement = new Vector3(input.x, 0, input.z);
gameObject.transform.Translate(movement * speed * Time.deltaTime);
gameObject.GetComponent<Animator>().SetFloat("velocity", (movement * speed).z);
Vector3 force = movement * speed * (isSprinting ? 2f : 1f);
gameObject.transform.Translate(force * Time.deltaTime);
gameObject.GetComponent<Animator>().SetFloat("velocity", force.z);
GameObject.Find("QuestLog").GetComponent<QuestLog>().updateQuests("explore", gameObject, 1);
}