Added sprint mechanic, unified options menu
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user