From c9eac314bbea9186084b4eca1a42db0a4a83fd0a Mon Sep 17 00:00:00 2001 From: Kassout Date: Mon, 10 Apr 2023 19:18:56 +0200 Subject: [PATCH] Final commit --- SOLID/SOLID/Assets/Scripts/Player.cs | 2 -- SOLID/SOLID/Assets/Scripts/PlayerAnimations.cs | 11 +++-------- SOLID/SOLID/Assets/Scripts/PlayerSounds.cs | 4 +--- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/SOLID/SOLID/Assets/Scripts/Player.cs b/SOLID/SOLID/Assets/Scripts/Player.cs index d7853f4..995bbc3 100644 --- a/SOLID/SOLID/Assets/Scripts/Player.cs +++ b/SOLID/SOLID/Assets/Scripts/Player.cs @@ -37,6 +37,4 @@ public void ReceiveDamaged() { _playerRenderer.FlashRed(); } - - } diff --git a/SOLID/SOLID/Assets/Scripts/PlayerAnimations.cs b/SOLID/SOLID/Assets/Scripts/PlayerAnimations.cs index 3090eb9..9a12b10 100644 --- a/SOLID/SOLID/Assets/Scripts/PlayerAnimations.cs +++ b/SOLID/SOLID/Assets/Scripts/PlayerAnimations.cs @@ -5,15 +5,10 @@ public class PlayerAnimations : MonoBehaviour [SerializeField] private Animator playerAnimator; + private static readonly int Walk = Animator.StringToHash("Walk"); + public void SetupAnimations(Vector2 movement) { - if (movement.magnitude > 0) - { - playerAnimator.SetBool("Walk", true); - } - else - { - playerAnimator.SetBool("Walk", false); - } + playerAnimator.SetBool(Walk, movement.magnitude > 0); } } diff --git a/SOLID/SOLID/Assets/Scripts/PlayerSounds.cs b/SOLID/SOLID/Assets/Scripts/PlayerSounds.cs index c64ac5b..836f426 100644 --- a/SOLID/SOLID/Assets/Scripts/PlayerSounds.cs +++ b/SOLID/SOLID/Assets/Scripts/PlayerSounds.cs @@ -1,6 +1,4 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; +using UnityEngine; public class PlayerSounds : MonoBehaviour {