Skip to content

Commit c50420a

Browse files
committed
Remove code repeat from PlayerAnimationController
1 parent 04ded35 commit c50420a

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Assets/Scripts/Game/PlatformGame/Player/PlayerAnimationController.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,11 @@ public void AnimateMove(bool isRunning, float speed, bool canMove, bool isSepara
1616
{
1717
if (canMove)
1818
{
19-
downPart.SetBool("IsRunning", isRunning);
20-
downPart.SetFloat("Speed", speed);
21-
upPart.SetBool("IsRunning", isRunning);
22-
upPart.SetFloat("Speed", speed);
19+
SetAnimationParams(isRunning, speed);
2320
}
2421
else
2522
{
26-
downPart.SetBool("IsRunning", false);
27-
downPart.SetFloat("Speed", 0f);
28-
upPart.SetBool("IsRunning", false);
29-
upPart.SetFloat("Speed", 0f);
23+
SetAnimationParams(false, 0f);
3024
}
3125
}
3226
}
@@ -35,6 +29,13 @@ public void AnimateShoot()
3529
{
3630
upPart.SetTrigger("Attack");
3731
}
38-
32+
33+
private void SetAnimationParams(bool isRunning, float speed)
34+
{
35+
downPart.SetBool("IsRunning", isRunning);
36+
downPart.SetFloat("Speed", speed);
37+
upPart.SetBool("IsRunning", isRunning);
38+
upPart.SetFloat("Speed", speed);
39+
}
3940
}
40-
}
41+
}

Assets/Scripts/Game/PlatformGame/Scenario/TileRules/RuleTileGenerator.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//This tool is a part of the VinTools Unity Package: https://vinarkgames.itch.io/vintools
2-
31
using System.Collections.Generic;
42
using UnityEditor;
53
using UnityEngine;

0 commit comments

Comments
 (0)