Skip to content

Commit 75b4242

Browse files
author
MathewHDYT
committed
Adjust methodcalls to animationerror enum.
1 parent 4954551 commit 75b4242

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

Example Project/Assets/Scripts/AnimationManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public enum AnimationError {
4040
/// <param name="startTime">Time we want to start the animation from.</param>
4141
/// <param name="layer">Layer we find the given animation name on.</param>
4242
/// <returns>AnimationError, showing wheter and how playing the file failed.</returns>
43-
private AnimationError PlayAnimation(Animator animator, string newAnimation, float delayTime = 0.0f, float startTime = 0.0f, int layer = 0) {
43+
public AnimationError PlayAnimation(Animator animator, string newAnimation, float delayTime = 0.0f, float startTime = 0.0f, int layer = 0) {
4444
AnimationError message = AnimationError.OK;
4545

4646
// Fetch the current Animation clips information for the base layer.

Example Project/Assets/Scripts/MethodCalls.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,33 @@ private void Start() {
1717
}
1818

1919
public void PlayAnimationClicked() {
20-
AnimationManager.AninmationError error = am.PlayAnimation(animator, inputField.text);
21-
output.text = GetStringFromError(error);
20+
AnimationManager.AnimationError err = am.PlayAnimation(animator, inputField.text);
21+
output.text = GetStringFromError(err);
2222
}
2323

2424
public void GetCurrentAnimationLengthClicked() {
2525
float length = am.GetCurrentAnimationLength(animator);
2626
output.text = "Length of the currently playing animation in seconds: " + length;
2727
}
2828

29-
private string GetStringFromError(AninmationManager.AnimationError error) {
30-
switch (error) {
29+
private string GetStringFromError(AnimationManager.AnimationError err) {
30+
string warning = "";
31+
32+
switch (err) {
3133
case AnimationManager.AnimationError.OK:
32-
// No Message
33-
return;
34+
warning = "Succesfully executed playing animation.";
35+
break;
3436
case AnimationManager.AnimationError.ALREADY_PLAYING:
35-
// No Message
36-
return;
37+
warning = "Method is already playing.";
38+
break;
3739
case AnimationManager.AnimationError.DOES_NOT_EXIST:
3840
warning = "Given Animation Name does not exist on the given Animator.";
3941
break;
4042
default:
41-
warning = "Given AnimatonError State not defined.";
43+
// Invalid AnimationManager.AnimationError argument.
4244
break;
4345
}
46+
47+
return warning;
4448
}
4549
}

Example Project/Packages/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"dependencies": {
33
"com.unity.collab-proxy": "1.7.1",
44
"com.unity.ide.rider": "2.0.7",
5-
"com.unity.ide.visualstudio": "2.0.11",
6-
"com.unity.ide.vscode": "1.2.3",
7-
"com.unity.test-framework": "1.1.27",
5+
"com.unity.ide.visualstudio": "2.0.12",
6+
"com.unity.ide.vscode": "1.2.4",
7+
"com.unity.test-framework": "1.1.30",
88
"com.unity.textmeshpro": "3.0.6",
99
"com.unity.timeline": "1.4.8",
1010
"com.unity.ugui": "1.0.0",

Example Project/Packages/packages-lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"url": "https://packages.unity.com"
2727
},
2828
"com.unity.ide.visualstudio": {
29-
"version": "2.0.11",
29+
"version": "2.0.12",
3030
"depth": 0,
3131
"source": "registry",
3232
"dependencies": {
@@ -35,7 +35,7 @@
3535
"url": "https://packages.unity.com"
3636
},
3737
"com.unity.ide.vscode": {
38-
"version": "1.2.3",
38+
"version": "1.2.4",
3939
"depth": 0,
4040
"source": "registry",
4141
"dependencies": {},
@@ -49,7 +49,7 @@
4949
"url": "https://packages.unity.com"
5050
},
5151
"com.unity.test-framework": {
52-
"version": "1.1.27",
52+
"version": "1.1.30",
5353
"depth": 0,
5454
"source": "registry",
5555
"dependencies": {

Example Project/ProjectSettings/EditorBuildSettings.asset

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
EditorBuildSettings:
55
m_ObjectHideFlags: 0
66
serializedVersion: 2
7-
m_Scenes: []
7+
m_Scenes:
8+
- enabled: 1
9+
path: Assets/Scenes/Main.unity
10+
guid: 9fc0d4010bbf28b4594072e72b8655ab
811
m_configObjects: {}

0 commit comments

Comments
 (0)