-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Player Walk Animations + Animation Handler Script
I made so walk and idle sprites and made the player play the walk animations when the corresponding button is pressed.
- Loading branch information
Showing
26 changed files
with
2,165 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using UnityEngine; | ||
|
||
public class PlayerAnimator : MonoBehaviour | ||
{ | ||
private Animator animator; | ||
|
||
private void Start() | ||
{ | ||
animator = GetComponent<Animator>(); | ||
} | ||
|
||
private void Update() | ||
{ | ||
UpdateAnimator(); | ||
} | ||
|
||
private void UpdateAnimator() | ||
{ | ||
float horizontalInput = Input.GetAxis("Horizontal"); | ||
float verticalInput = Input.GetAxis("Vertical"); | ||
|
||
animator.SetFloat("Horizontal", horizontalInput); | ||
animator.SetFloat("Vertical", verticalInput); | ||
animator.SetBool("IsMoving", GetComponent<GridMovement>().IsMoving()); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.