Implemented Animation Clip asset and animation controller #410

Merged
XiaoQiDigipen merged 66 commits from SP3-22-AnimationController into main 2023-03-09 16:19:40 +08:00
4 changed files with 74 additions and 4 deletions
Showing only changes of commit 5669babc0f - Show all commits

View File

@ -10,6 +10,7 @@
Color: {x: 1, y: 1, z: 1, w: 1} Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 1 Strength: 1
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 2 - EID: 2
@ -23,11 +24,33 @@
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 148542784 Mesh: 149697411
Material: 121518381 Material: 128805346
IsActive: true IsActive: true
Animator Component: Animator Component:
Rig: 76586906 Rig: 76586906
Clip: 76586906 AnimationController: 0
IsActive: true
Scripts:
- Type: SHADE.Test.AnimTest
Enabled: true
idleClip: 227450439
runClip: 229125027
pickUpClip: 219605278
- EID: 1
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Camera Component:
Position: {x: 0, y: 0.5, z: 0.699999988}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1920
Near: 0.00999999978
Far: 10000
Perspective: true
FOV: 90
IsActive: true IsActive: true
Scripts: ~ Scripts: ~

View File

@ -0,0 +1,41 @@
namespace SHADE.Test
{
public class AnimTest : Script
{
#region Serialized Fields
[SerializeField]
private AnimationClipAsset idleClip;
[SerializeField]
private AnimationClipAsset runClip;
[SerializeField]
private AnimationClipAsset pickUpClip;
#endregion
#region Components
public Animator Animator { get; private set; }
#endregion
#region Lifecycle Functions
protected override void awake()
{
Animator = GetComponent<Animator>();
}
protected override void update()
{
if (Input.GetKeyUp(Input.KeyCode.Alpha1))
{
Animator.Play(idleClip);
}
else if (Input.GetKeyUp(Input.KeyCode.Alpha2))
{
Animator.Play(runClip);
}
else if (Input.GetKeyUp(Input.KeyCode.Alpha3))
{
Animator.Play(pickUpClip);
}
}
#endregion
}
}

View File

@ -0,0 +1,3 @@
Name: AnimTest
ID: 165676130
Type: 9

View File

@ -32,6 +32,8 @@ of DigiPen Institute of Technology is prohibited.
#include "UI\SHUIComponent.h" #include "UI\SHUIComponent.h"
#include "UI\SHSliderComponent.h" #include "UI\SHSliderComponent.h"
#include "UI\SHCanvasComponent.h" #include "UI\SHCanvasComponent.h"
#include "Animation\SHAnimatorComponent.h"
#include "Graphics\MiddleEnd\TrajectoryRendering\SHTrajectoryRenderableComponent.h"
// Project Headers // Project Headers
#include "Utility/Convert.hxx" #include "Utility/Convert.hxx"
#include "Utility/Debug.hxx" #include "Utility/Debug.hxx"
@ -47,7 +49,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Components\Canvas.hxx" #include "Components\Canvas.hxx"
#include "Components\Slider.hxx" #include "Components\Slider.hxx"
#include "Components\TrajectoryRenderable.hxx" #include "Components\TrajectoryRenderable.hxx"
#include "Graphics\MiddleEnd\TrajectoryRendering\SHTrajectoryRenderableComponent.h" #include "Components\Animator.hxx"
@ -338,6 +340,7 @@ namespace SHADE
componentMap.Add(createComponentSet<SHCanvasComponent, Canvas>()); componentMap.Add(createComponentSet<SHCanvasComponent, Canvas>());
componentMap.Add(createComponentSet<SHSliderComponent, Slider>()); componentMap.Add(createComponentSet<SHSliderComponent, Slider>());
componentMap.Add(createComponentSet<SHTrajectoryRenderableComponent, TrajectoryRenderable>()); componentMap.Add(createComponentSet<SHTrajectoryRenderableComponent, TrajectoryRenderable>());
componentMap.Add(createComponentSet<SHAnimatorComponent, Animator>());
} }
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/