Reworked Physics Simulate Body #429
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
Start in Fullscreen: false
|
Start in Fullscreen: false
|
||||||
Starting Scene ID: 91478134
|
Starting Scene ID: 97158628
|
||||||
Window Size: {x: 1920, y: 1080}
|
Window Size: {x: 1920, y: 1080}
|
||||||
Window Title: SHADE Engine
|
Window Title: SHADE Engine
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Cinematics
|
||||||
|
ID: 197932678
|
||||||
|
Type: 11
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,11 +1,11 @@
|
||||||
0 StaticObject 1110000000000000
|
0 StaticObject 1100000000000000
|
||||||
1 Player 1100000000000000
|
1 Player 1100000000000000
|
||||||
2 Food 1000000000000000
|
2 Food 1000000000000000
|
||||||
3 Breakable 1100000000000000
|
3 Breakable 1100000000000000
|
||||||
4 ScoringWallCollider 0110000000000000
|
4 ScoringWallCollider 0110000000000000
|
||||||
5 Homeowner 1100000000000000
|
5 Homeowner 1100000000000000
|
||||||
6 Camera 0010000000000000
|
6 Camera 0010000000000000
|
||||||
7 8 0000000000000000
|
7 StaticWithCameraCollision 1110000000000000
|
||||||
8 9 0000000000000000
|
8 9 0000000000000000
|
||||||
9 10 0000000000000000
|
9 10 0000000000000000
|
||||||
10 11 0000000000000000
|
10 11 0000000000000000
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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: 0
|
Strength: 0
|
||||||
|
Casting Shadows: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
|
@ -73,10 +74,10 @@
|
||||||
sceneID: 97158628
|
sceneID: 97158628
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 6
|
- EID: 6
|
||||||
|
@ -108,10 +109,10 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 3
|
- EID: 3
|
||||||
|
@ -152,7 +153,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
- Type: TweenManager
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 450
|
- EID: 450
|
||||||
Name: TransitionCanvas
|
Name: TransitionCanvas
|
||||||
|
|
|
@ -100,10 +100,10 @@
|
||||||
sceneID: 91947920
|
sceneID: 91947920
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 6
|
- EID: 6
|
||||||
|
@ -135,10 +135,10 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 7
|
- EID: 7
|
||||||
|
@ -168,10 +168,10 @@
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||||
|
@ -204,10 +204,10 @@
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||||
|
@ -240,10 +240,10 @@
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||||
|
@ -276,10 +276,10 @@
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||||
|
@ -297,6 +297,7 @@
|
||||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
Layer: 4294967295
|
Layer: 4294967295
|
||||||
Strength: 0
|
Strength: 0
|
||||||
|
Casting Shadows: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 3
|
- EID: 3
|
||||||
|
@ -337,7 +338,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
- Type: TweenManager
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 13
|
- EID: 13
|
||||||
Name: How To Play Canvas
|
Name: How To Play Canvas
|
||||||
|
@ -428,10 +429,10 @@
|
||||||
multiImageList: 15
|
multiImageList: 15
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 17
|
- EID: 17
|
||||||
|
@ -465,10 +466,10 @@
|
||||||
multiImageList: 15
|
multiImageList: 15
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 18
|
- EID: 18
|
||||||
|
@ -501,10 +502,10 @@
|
||||||
canvasToActivate: 0
|
canvasToActivate: 0
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 19
|
- EID: 19
|
||||||
|
@ -575,10 +576,10 @@
|
||||||
canvasToActivate: 0
|
canvasToActivate: 0
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 22
|
- EID: 22
|
||||||
|
@ -1262,10 +1263,10 @@
|
||||||
canvasToActivate: 0
|
canvasToActivate: 0
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 49
|
- EID: 49
|
||||||
|
@ -1371,10 +1372,10 @@
|
||||||
canvasToActivate: 0
|
canvasToActivate: 0
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 53
|
- EID: 53
|
||||||
|
|
|
@ -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: 0
|
Strength: 0
|
||||||
|
Casting Shadows: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 1
|
- EID: 1
|
||||||
|
@ -73,10 +74,10 @@
|
||||||
sceneID: 97158628
|
sceneID: 97158628
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 6
|
- EID: 6
|
||||||
|
@ -108,10 +109,10 @@
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- Type: SHADE_Scripting.UI.ButtonFX
|
- Type: SHADE_Scripting.UI.ButtonFX
|
||||||
Enabled: true
|
Enabled: true
|
||||||
onHoverEnterSound: Empty
|
onHoverEnterSound: event:/UI/botton_hover
|
||||||
onHoverExitSound: Empty
|
onHoverExitSound: Empty
|
||||||
onClickSound: event:/UI/mouse_down_element
|
onClickSound: event:/UI/button_success
|
||||||
onReleaseSound: Empty
|
onReleaseSound: event:/UI/button_fail
|
||||||
hoverScale: 1.10000002
|
hoverScale: 1.10000002
|
||||||
clickScale: 0.899999976
|
clickScale: 0.899999976
|
||||||
- EID: 3
|
- EID: 3
|
||||||
|
@ -152,7 +153,7 @@
|
||||||
NumberOfChildren: 0
|
NumberOfChildren: 0
|
||||||
Components: ~
|
Components: ~
|
||||||
Scripts:
|
Scripts:
|
||||||
- Type: SHADE_Scripting.UI.TweenManager
|
- Type: TweenManager
|
||||||
Enabled: true
|
Enabled: true
|
||||||
- EID: 450
|
- EID: 450
|
||||||
Name: TransitionCanvas
|
Name: TransitionCanvas
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
idleClip: 227450439
|
idleClip: 227450439
|
||||||
runClip: 229125027
|
runClip: 229125027
|
||||||
pickUpClip: 219605278
|
pickUpClip: 219605278
|
||||||
|
controlAniSys: true
|
||||||
- EID: 1
|
- EID: 1
|
||||||
Name: Default
|
Name: Default
|
||||||
IsActive: true
|
IsActive: true
|
||||||
|
@ -79,4 +80,5 @@
|
||||||
fullClip: 231416496
|
fullClip: 231416496
|
||||||
idleClip: 0
|
idleClip: 0
|
||||||
runClip: 0
|
runClip: 0
|
||||||
pickUpClip: 0
|
pickUpClip: 0
|
||||||
|
controlAniSys: false
|
|
@ -13,6 +13,8 @@ namespace SHADE.Test
|
||||||
private AnimationClipAsset runClip;
|
private AnimationClipAsset runClip;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private AnimationClipAsset pickUpClip;
|
private AnimationClipAsset pickUpClip;
|
||||||
|
[SerializeField]
|
||||||
|
private bool controlAniSys = false;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Components
|
#region Components
|
||||||
|
@ -23,6 +25,10 @@ namespace SHADE.Test
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
Animator = GetComponent<Animator>();
|
Animator = GetComponent<Animator>();
|
||||||
|
|
||||||
|
Animator.OnClipStartedPlaying.RegisterAction((_) => Debug.Log("Start Playing"));
|
||||||
|
Animator.OnClipPaused.RegisterAction((_) => Debug.Log("Pause"));
|
||||||
|
Animator.OnClipFinished.RegisterAction((_) => Debug.Log("Finished"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
@ -34,19 +40,39 @@ namespace SHADE.Test
|
||||||
// Play animations
|
// Play animations
|
||||||
if (Input.GetKeyUp(Input.KeyCode.Equals))
|
if (Input.GetKeyUp(Input.KeyCode.Equals))
|
||||||
{
|
{
|
||||||
playFunc(fullClip);
|
if (fullClip)
|
||||||
|
playFunc(fullClip);
|
||||||
}
|
}
|
||||||
else if (Input.GetKeyUp(Input.KeyCode.Alpha1))
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha1))
|
||||||
{
|
{
|
||||||
playFunc(idleClip);
|
if (idleClip)
|
||||||
|
playFunc(idleClip);
|
||||||
}
|
}
|
||||||
else if (Input.GetKeyUp(Input.KeyCode.Alpha2))
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha2))
|
||||||
{
|
{
|
||||||
playFunc(runClip);
|
if (runClip)
|
||||||
|
playFunc(runClip);
|
||||||
}
|
}
|
||||||
else if (Input.GetKeyUp(Input.KeyCode.Alpha3))
|
else if (Input.GetKeyUp(Input.KeyCode.Alpha3))
|
||||||
{
|
{
|
||||||
playFunc(pickUpClip);
|
if (pickUpClip)
|
||||||
|
playFunc(pickUpClip);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Play and pause
|
||||||
|
if (controlAniSys && Input.GetKeyUp(Input.KeyCode.Space))
|
||||||
|
{
|
||||||
|
AnimationSystem.TimeScale = AnimationSystem.TimeScale > 0.0f ? 0.0f
|
||||||
|
: AnimationSystem.DefaultTimeScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyUp(Input.KeyCode.P))
|
||||||
|
{
|
||||||
|
if (Animator.IsPlaying)
|
||||||
|
Animator.Pause();
|
||||||
|
else
|
||||||
|
Animator.Play();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -110,8 +110,8 @@ public partial class Homeowner1 : BehaviourTree
|
||||||
|
|
||||||
//These should be somewhere else
|
//These should be somewhere else
|
||||||
//Debug.Log("TESTING");
|
//Debug.Log("TESTING");
|
||||||
AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
|
//AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
|
||||||
AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
|
//AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
|
||||||
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
|
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
|
||||||
|
|
||||||
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
|
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
|
||||||
|
@ -121,7 +121,7 @@ public partial class Homeowner1 : BehaviourTree
|
||||||
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
|
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
|
||||||
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
|
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
|
||||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXHumming"], GameObject.EntityId);
|
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXHumming"], GameObject.EntityId);
|
||||||
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
|
//AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
|
||||||
AudioHandler.audioClipHandlers["SFXHumming"].Play();
|
AudioHandler.audioClipHandlers["SFXHumming"].Play();
|
||||||
|
|
||||||
if (aiInstance != null && aiInstance != this)
|
if (aiInstance != null && aiInstance != this)
|
||||||
|
|
|
@ -156,7 +156,7 @@ public partial class LeafSearch : BehaviourTreeNode
|
||||||
|
|
||||||
//Draw a ray, succeed if ray is unobstructed
|
//Draw a ray, succeed if ray is unobstructed
|
||||||
Vector3 eyePosition = transform.GlobalPosition + eyeOffset;
|
Vector3 eyePosition = transform.GlobalPosition + eyeOffset;
|
||||||
BoxCollider playerCollider = player.GetValueOrDefault().GetComponent<Collider>().GetCollisionShape<BoxCollider>(0);
|
Collider playerCollider = player.GetValueOrDefault().GetComponent<Collider>();
|
||||||
if (playerCollider == null)
|
if (playerCollider == null)
|
||||||
{
|
{
|
||||||
//Debug.Log("Failure: Player has no collider");
|
//Debug.Log("Failure: Player has no collider");
|
||||||
|
@ -167,7 +167,7 @@ public partial class LeafSearch : BehaviourTreeNode
|
||||||
}
|
}
|
||||||
//Ray destination to target the centre of the player's collider instead of transform position
|
//Ray destination to target the centre of the player's collider instead of transform position
|
||||||
//Since transform position is often the raccoon's base and the ray needs to hit somewhere higher to be more reliable
|
//Since transform position is often the raccoon's base and the ray needs to hit somewhere higher to be more reliable
|
||||||
Vector3 rayDestination = plrT.GlobalPosition + plrT.GlobalScale * playerCollider.PositionOffset;
|
Vector3 rayDestination = plrT.GlobalPosition + plrT.GlobalScale * playerCollider.GetCollisionShape(0).PositionOffset;
|
||||||
Ray sightRay = new Ray(eyePosition, rayDestination - eyePosition);
|
Ray sightRay = new Ray(eyePosition, rayDestination - eyePosition);
|
||||||
RaycastHit sightRayHit = Physics.Raycast(sightRay, false, (ushort)65535)[0];
|
RaycastHit sightRayHit = Physics.Raycast(sightRay, false, (ushort)65535)[0];
|
||||||
//As of November 2022, RaycastHit contains only the FIRST object hit by
|
//As of November 2022, RaycastHit contains only the FIRST object hit by
|
||||||
|
|
|
@ -86,12 +86,17 @@ public class Item : Script
|
||||||
|
|
||||||
if (returnBack && !dontReturn)
|
if (returnBack && !dontReturn)
|
||||||
{
|
{
|
||||||
|
if (rb)
|
||||||
|
{
|
||||||
|
rb.LinearVelocity = Vector3.Zero;
|
||||||
|
rb.AngularVelocity = Vector3.Zero;
|
||||||
|
rb.ClearForces();
|
||||||
|
rb.ClearTorque();
|
||||||
|
}
|
||||||
|
|
||||||
if(transform)
|
if(transform)
|
||||||
transform.LocalPosition = firstPostion;
|
transform.LocalPosition = firstPostion;
|
||||||
|
|
||||||
if (rb)
|
|
||||||
rb.LinearVelocity = Vector3.Zero;
|
|
||||||
|
|
||||||
returnBack = false;
|
returnBack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,38 @@ using System;
|
||||||
|
|
||||||
public class PlayerIdleState : BaseState
|
public class PlayerIdleState : BaseState
|
||||||
{
|
{
|
||||||
public PlayerIdleState(StateMachine stateMachine) : base(stateMachine)
|
private bool holdItem;
|
||||||
|
public PlayerIdleState(StateMachine stateMachine, bool hi) : base(stateMachine)
|
||||||
{
|
{
|
||||||
stateName = "Idle State";
|
stateName = "Idle State";
|
||||||
|
holdItem = hi;
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
|
if (PlayerAnimations.Instance)
|
||||||
|
{
|
||||||
|
if (!holdItem)
|
||||||
|
{
|
||||||
|
if (PlayerAnimations.Instance.playerIdleClip)
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
|
||||||
|
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
|
||||||
|
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (PlayerAnimations.Instance.playerCarryIdleClip)
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
|
||||||
|
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
|
||||||
|
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class PlayerJumpState : BaseState
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("jump");
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class PlayerRunState : BaseState
|
public class PlayerRunState : BaseState
|
||||||
|
@ -13,6 +14,13 @@ public class PlayerRunState : BaseState
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
|
if (PlayerAnimations.Instance && PlayerAnimations.Instance.playerRunClip)
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
||||||
|
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
||||||
|
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
@ -21,7 +29,7 @@ public class PlayerRunState : BaseState
|
||||||
|
|
||||||
if (timer > delay)
|
if (timer > delay)
|
||||||
{
|
{
|
||||||
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||||
timer = 0;
|
timer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,44 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class PlayerWalkState : BaseState
|
public class PlayerWalkState : BaseState
|
||||||
{
|
{
|
||||||
private float timer;
|
private float timer;
|
||||||
private float delay = 0.5f;
|
private float delay = 0.5f;
|
||||||
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine)
|
private bool holdItem;
|
||||||
|
public PlayerWalkState(StateMachine stateMachine, bool hi) : base(stateMachine)
|
||||||
{
|
{
|
||||||
stateName = "Walk State";
|
stateName = "Walk State";
|
||||||
|
holdItem = hi;
|
||||||
}
|
}
|
||||||
public override void OnEnter()
|
public override void OnEnter()
|
||||||
{
|
{
|
||||||
//Debug.Log("WALK ENTER");
|
//Debug.Log("WALK ENTER");
|
||||||
timer = delay;
|
timer = delay;
|
||||||
|
if (PlayerAnimations.Instance)
|
||||||
|
{
|
||||||
|
if (!holdItem)
|
||||||
|
{
|
||||||
|
if (PlayerAnimations.Instance.playerWalkClip)
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
|
||||||
|
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
|
||||||
|
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (PlayerAnimations.Instance.playerCarryWalkClip)
|
||||||
|
{
|
||||||
|
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
|
||||||
|
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
|
||||||
|
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
|
||||||
|
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void update()
|
public override void update()
|
||||||
{
|
{
|
||||||
|
@ -20,8 +46,8 @@ public class PlayerWalkState : BaseState
|
||||||
timer += Time.DeltaTimeF;
|
timer += Time.DeltaTimeF;
|
||||||
|
|
||||||
if (timer > delay)
|
if (timer > delay)
|
||||||
{
|
{
|
||||||
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||||
timer = 0;
|
timer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,6 @@ public class PickAndThrow : Script
|
||||||
[Tooltip("Height of ray")]
|
[Tooltip("Height of ray")]
|
||||||
public float rayHeight = 0.1f;
|
public float rayHeight = 0.1f;
|
||||||
|
|
||||||
[Tooltip("FOV when you aim")]
|
|
||||||
public float aimingFOV = 50;
|
|
||||||
[Tooltip("Default FOV")]
|
|
||||||
public float defaultFOV = 45;
|
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
pc = GetScript<PlayerController>();
|
pc = GetScript<PlayerController>();
|
||||||
|
@ -85,7 +80,7 @@ public class PickAndThrow : Script
|
||||||
pc.camArm.ArmLength = aimingLength;
|
pc.camArm.ArmLength = aimingLength;
|
||||||
prevTargetOffSet = pc.camArm.TargetOffset;
|
prevTargetOffSet = pc.camArm.TargetOffset;
|
||||||
pc.camArm.TargetOffset = cameraArmOffSet;
|
pc.camArm.TargetOffset = cameraArmOffSet;
|
||||||
pc.cam.FOV = aimingFOV;
|
pc.cam.FOV = Settings.cameraFOV + 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
||||||
|
@ -95,7 +90,7 @@ public class PickAndThrow : Script
|
||||||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||||
pc.isAiming = false;
|
pc.isAiming = false;
|
||||||
pc.camArm.TargetOffset = prevTargetOffSet;
|
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||||
pc.cam.FOV = defaultFOV;
|
pc.cam.FOV = Settings.cameraFOV;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
pc.holdItem = false;
|
pc.holdItem = false;
|
||||||
|
@ -116,7 +111,7 @@ public class PickAndThrow : Script
|
||||||
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming)
|
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming)
|
||||||
{
|
{
|
||||||
pc.isAiming = false;
|
pc.isAiming = false;
|
||||||
pc.cam.FOV = defaultFOV;
|
pc.cam.FOV = Settings.cameraFOV;
|
||||||
pc.camArm.TargetOffset = prevTargetOffSet;
|
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||||
if (tpc)
|
if (tpc)
|
||||||
pc.camArm.ArmLength = tpc.armLength;
|
pc.camArm.ArmLength = tpc.armLength;
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
using SHADE;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
|
public class PlayerAnimations : Script
|
||||||
|
{
|
||||||
|
#region Raccoon
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerIdleClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerWalkClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerRunClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerPickUpClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerCarryIdleClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerCarryWalkClip; // done
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerThrowClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerJumpStartClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerJumpLoopClip;
|
||||||
|
[SerializeField]
|
||||||
|
public AnimationClipAsset playerJumpEndClip;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Animator
|
||||||
|
public Animator playerAnimator { get; private set; }
|
||||||
|
public Animator BagAnimator { get; private set; }
|
||||||
|
public Animator silhoPlayerAnimator { get; private set; }
|
||||||
|
public Animator silhoBagAnimator { get; private set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region silhouette
|
||||||
|
public GameObject silhouettePlayer;
|
||||||
|
public GameObject silhouetteBag;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public static PlayerAnimations Instance { get; private set; }
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
RemoveScript<PlayerAnimations>();
|
||||||
|
else
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
|
playerAnimator = GetComponent<Animator>();
|
||||||
|
if (!playerAnimator)
|
||||||
|
Debug.LogError("Player Animator is MISSING!");
|
||||||
|
|
||||||
|
BagAnimator = GetComponentInChildren<Animator>();
|
||||||
|
if (!BagAnimator)
|
||||||
|
Debug.LogError("Bag Animator is MISSING!");
|
||||||
|
|
||||||
|
if(silhouettePlayer)
|
||||||
|
silhoPlayerAnimator = silhouettePlayer.GetComponent<Animator>();
|
||||||
|
else
|
||||||
|
Debug.LogError("Silho Player is MISSING!");
|
||||||
|
|
||||||
|
if (!silhoPlayerAnimator)
|
||||||
|
Debug.LogError("Silho Player Animator is MISSING!");
|
||||||
|
|
||||||
|
if(silhouetteBag)
|
||||||
|
silhoBagAnimator = silhouetteBag.GetComponent<Animator>();
|
||||||
|
else
|
||||||
|
Debug.LogError("Silho bag is MISSING!");
|
||||||
|
|
||||||
|
if (!silhoBagAnimator)
|
||||||
|
Debug.LogError("Silho Player Animator is MISSING!");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void onDestroy()
|
||||||
|
{
|
||||||
|
if (Instance == this)
|
||||||
|
Instance = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_PlayerAnimations
|
||||||
|
ID: 159045981
|
||||||
|
Type: 9
|
|
@ -1,6 +1,7 @@
|
||||||
using SHADE;
|
using SHADE;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
using static Item;
|
using static Item;
|
||||||
|
|
||||||
public class PlayerController : Script
|
public class PlayerController : Script
|
||||||
|
@ -32,7 +33,7 @@ public class PlayerController : Script
|
||||||
private float delayTimer = 0.0f;
|
private float delayTimer = 0.0f;
|
||||||
|
|
||||||
[Tooltip("The current state fo the raccoon")]
|
[Tooltip("The current state fo the raccoon")]
|
||||||
public RaccoonStates currentState = RaccoonStates.IDLE;
|
public RaccoonStates currentState;
|
||||||
|
|
||||||
//Movement variables============================================================
|
//Movement variables============================================================
|
||||||
[Tooltip("Max vel for walking")]
|
[Tooltip("Max vel for walking")]
|
||||||
|
@ -98,17 +99,17 @@ public class PlayerController : Script
|
||||||
//rigidbody check
|
//rigidbody check
|
||||||
rb = GetComponent<RigidBody>();
|
rb = GetComponent<RigidBody>();
|
||||||
if (!rb)
|
if (!rb)
|
||||||
Debug.LogError("RigidBody is NULL!");
|
Debug.LogError("RigidBody is MISSING!");
|
||||||
|
|
||||||
//Transform check
|
//Transform check
|
||||||
tranform = GetComponent<Transform>();
|
tranform = GetComponent<Transform>();
|
||||||
if(!tranform)
|
if(!tranform)
|
||||||
Debug.LogError("tranform is NULL!");
|
Debug.LogError("tranform is MISSING!");
|
||||||
|
|
||||||
stateMachine = AddScript<StateMachine>();
|
stateMachine = AddScript<StateMachine>();
|
||||||
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
||||||
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
|
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine, holdItem));
|
||||||
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine));
|
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine, holdItem));
|
||||||
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
|
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
|
||||||
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
|
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
|
||||||
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
|
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
|
||||||
|
@ -131,6 +132,14 @@ public class PlayerController : Script
|
||||||
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
|
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
|
||||||
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
|
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["footsteps"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_footsteps");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
currentState = RaccoonStates.IDLE;
|
||||||
|
stateMachine.SetState(typeof(PlayerIdleState));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void lateUpdate()
|
protected override void lateUpdate()
|
||||||
|
@ -167,8 +176,8 @@ public class PlayerController : Script
|
||||||
if (!cam)
|
if (!cam)
|
||||||
{
|
{
|
||||||
cam = GetComponentInChildren<Camera>();
|
cam = GetComponentInChildren<Camera>();
|
||||||
if(pat)
|
if (pat)
|
||||||
cam.FOV = pat.defaultFOV;
|
cam.FOV = Settings.cameraFOV;
|
||||||
}
|
}
|
||||||
if(!camArm)
|
if(!camArm)
|
||||||
camArm = GetComponentInChildren<CameraArm>();
|
camArm = GetComponentInChildren<CameraArm>();
|
||||||
|
@ -315,6 +324,8 @@ public class PlayerController : Script
|
||||||
if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad ) && isGrounded && rb != null)
|
if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad ) && isGrounded && rb != null)
|
||||||
{
|
{
|
||||||
currentState = RaccoonStates.JUMP;
|
currentState = RaccoonStates.JUMP;
|
||||||
|
if (stateMachine && !stateMachine.IsState(typeof(PlayerJumpState)))
|
||||||
|
stateMachine.SetState(typeof(PlayerJumpState));
|
||||||
Vector3 v = rb.LinearVelocity;
|
Vector3 v = rb.LinearVelocity;
|
||||||
v.y = initialJumpVel * 0.5f;
|
v.y = initialJumpVel * 0.5f;
|
||||||
if (holdItem && pat != null && pat.item.GetScript<Item>() != null)
|
if (holdItem && pat != null && pat.item.GetScript<Item>() != null)
|
||||||
|
@ -337,8 +348,12 @@ public class PlayerController : Script
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space)))
|
if (!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space)))
|
||||||
|
{
|
||||||
currentState = RaccoonStates.FALLING;
|
currentState = RaccoonStates.FALLING;
|
||||||
|
if (stateMachine && !stateMachine.IsState(typeof(PlayerFallState)))
|
||||||
|
stateMachine.SetState(typeof(PlayerFallState));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +384,11 @@ public class PlayerController : Script
|
||||||
{
|
{
|
||||||
isGrounded = true;
|
isGrounded = true;
|
||||||
if (currentState == RaccoonStates.FALLING)
|
if (currentState == RaccoonStates.FALLING)
|
||||||
|
{
|
||||||
currentState = RaccoonStates.LANDED;
|
currentState = RaccoonStates.LANDED;
|
||||||
|
if (stateMachine && !stateMachine.IsState(typeof(PlayerLandState)))
|
||||||
|
stateMachine.SetState(typeof(PlayerLandState));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
isGrounded = false;
|
isGrounded = false;
|
||||||
|
@ -417,7 +436,7 @@ public class PlayerController : Script
|
||||||
if (isAiming)
|
if (isAiming)
|
||||||
{
|
{
|
||||||
isAiming = false;
|
isAiming = false;
|
||||||
cam.FOV = pat.defaultFOV;
|
cam.FOV = Settings.cameraFOV;
|
||||||
camArm.TargetOffset = pat.prevTargetOffSet;
|
camArm.TargetOffset = pat.prevTargetOffSet;
|
||||||
camArm.ArmLength = pat.tpc.armLength;
|
camArm.ArmLength = pat.tpc.armLength;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace SHADE_Scripting
|
||||||
protected override void start()
|
protected override void start()
|
||||||
{
|
{
|
||||||
GetComponent<CameraArm>().ArmLength = armLength;
|
GetComponent<CameraArm>().ArmLength = armLength;
|
||||||
|
GetComponent<Camera>().FOV = Settings.cameraFOV;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
|
|
@ -101,6 +101,8 @@ public class GameManager : Script
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (GamePause || !stealFoodPopUpDone)
|
if (GamePause || !stealFoodPopUpDone)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -195,6 +197,13 @@ public class GameManager : Script
|
||||||
if (SceneFadeInOut.Instance != null)
|
if (SceneFadeInOut.Instance != null)
|
||||||
SceneFadeInOut.Instance.CallFadeIn();
|
SceneFadeInOut.Instance.CallFadeIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyUp(Input.KeyCode.G))
|
||||||
|
{
|
||||||
|
ItemScored();
|
||||||
|
Score += 500;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,6 +228,13 @@ public class GameManager : Script
|
||||||
fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration);
|
fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SingleScaleBounce sb = scoreText.GetScript<SingleScaleBounce>();
|
||||||
|
if(sb)
|
||||||
|
{
|
||||||
|
sb.ScaleBounceOnce();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,64 @@
|
||||||
using SHADE_Scripting.Audio;
|
using SHADE_Scripting.Audio;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
public class JumpPad : Script
|
public class JumpPad : Script
|
||||||
{
|
{
|
||||||
|
private Transform tran;
|
||||||
|
private Vector3 defaultScale;
|
||||||
|
public float scaleYMaxSize = 2.0f;
|
||||||
|
private float scaleXZMaxSize;
|
||||||
|
public float scaleDuration = 0.25f;
|
||||||
|
private bool landed = false;
|
||||||
|
private bool scaleUpDone = false;
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private TweenThread scaleYUp;
|
||||||
|
[NonSerialized]
|
||||||
|
private TweenThread scaleXZUp;
|
||||||
|
[NonSerialized]
|
||||||
|
private TweenThreadVec3 scaleDown;
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
AudioHandler.audioClipHandlers["SFXJumpPad"] = Audio.CreateAudioClip("event:/Props/jumppad_boing");
|
AudioHandler.audioClipHandlers["SFXJumpPad"] = Audio.CreateAudioClip("event:/Props/jumppad_boing");
|
||||||
|
|
||||||
|
tran = GameObject.GetComponent<Transform>();
|
||||||
|
if (!tran)
|
||||||
|
Debug.LogError("NO TRANSFORM");
|
||||||
|
|
||||||
|
defaultScale = tran.LocalScale;
|
||||||
|
scaleXZMaxSize = scaleYMaxSize * 0.3f;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
scaleYUp = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, scaleYMaxSize, EASING_METHOD.EASE_IN_SINE);
|
||||||
|
scaleXZUp = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, scaleXZMaxSize, EASING_METHOD.EASE_IN_SINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
if (landed && tran)
|
||||||
|
{
|
||||||
|
tran.LocalScale = new Vector3(scaleXZUp.GetValue(), scaleYUp.GetValue(), scaleXZUp.GetValue());
|
||||||
|
if (scaleYUp.IsCompleted() && scaleXZUp.IsCompleted())
|
||||||
|
{
|
||||||
|
landed = false;
|
||||||
|
scaleUpDone = true;
|
||||||
|
scaleDown = TweenManager.CreateTweenThreadVec3(scaleDuration, tran.LocalScale, defaultScale, EASING_METHOD.EASE_IN_SINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scaleUpDone && !landed)
|
||||||
|
{
|
||||||
|
tran.LocalScale = scaleDown.GetValue();
|
||||||
|
if (scaleDown.IsCompleted())
|
||||||
|
{
|
||||||
|
scaleUpDone = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void onCollisionEnter(CollisionInfo info)
|
protected override void onCollisionEnter(CollisionInfo info)
|
||||||
|
@ -20,7 +69,11 @@ public class JumpPad : Script
|
||||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
|
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
|
||||||
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
|
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
|
||||||
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
|
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
|
||||||
|
landed = true;
|
||||||
|
scaleYUp.Reset();
|
||||||
|
scaleXZUp.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,11 +40,6 @@ namespace SHADE_Scripting.UI
|
||||||
if (listOfCamera.Count == 0)
|
if (listOfCamera.Count == 0)
|
||||||
Debug.LogError("EMPTY PREVIEW POINTS");
|
Debug.LogError("EMPTY PREVIEW POINTS");
|
||||||
|
|
||||||
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE);
|
|
||||||
moveToEndPoint2 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[1].GetComponent<Transform>().LocalPosition, endPoint2, EASING_METHOD.EASE_IN_SINE);
|
|
||||||
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void start()
|
protected override void start()
|
||||||
|
@ -52,6 +47,11 @@ namespace SHADE_Scripting.UI
|
||||||
if (gameplayCanvas)
|
if (gameplayCanvas)
|
||||||
gameplayCanvas.SetActive(false);
|
gameplayCanvas.SetActive(false);
|
||||||
listOfCamera[0].SetMainCamera();
|
listOfCamera[0].SetMainCamera();
|
||||||
|
|
||||||
|
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE);
|
||||||
|
moveToEndPoint2 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[1].GetComponent<Transform>().LocalPosition, endPoint2, EASING_METHOD.EASE_IN_SINE);
|
||||||
|
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
@ -135,7 +135,7 @@ namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
if (reset3)
|
if (reset3)
|
||||||
{
|
{
|
||||||
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
|
moveToEndPoint3.Reset();
|
||||||
reset3 = false;
|
reset3 = false;
|
||||||
}
|
}
|
||||||
listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue();
|
listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue();
|
||||||
|
|
|
@ -4,18 +4,14 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SHADE_Scripting
|
static public class Settings
|
||||||
{
|
{
|
||||||
static public class Settings
|
static public float cameraSensitivity = 100.0f;
|
||||||
{
|
|
||||||
static public float cameraSensitivity = 100.0f;
|
|
||||||
|
|
||||||
static public float cameraFOV = 90.0f;
|
static public float cameraFOV = 45.0f;
|
||||||
|
|
||||||
static public float masterVolume = 100.0f;
|
static public float masterVolume = 100.0f;
|
||||||
static public float sfxVolume = 100.0f;
|
static public float sfxVolume = 100.0f;
|
||||||
static public float bgmVolume = 100.0f;
|
static public float bgmVolume = 100.0f;
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,6 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SHADE_Scripting.UI
|
|
||||||
{
|
|
||||||
|
|
||||||
public enum EASING_METHOD
|
public enum EASING_METHOD
|
||||||
{
|
{
|
||||||
EASE_IN_SINE,
|
EASE_IN_SINE,
|
||||||
|
@ -16,84 +13,88 @@ namespace SHADE_Scripting.UI
|
||||||
EASE_INOUT_BOUNCE
|
EASE_INOUT_BOUNCE
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EasingHelper
|
public static class EasingHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
public static float EaseHelp(float value, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
switch (method)
|
||||||
{
|
{
|
||||||
|
case EASING_METHOD.EASE_IN_SINE:
|
||||||
public static float EaseHelp(float value, EASING_METHOD method)
|
|
||||||
{
|
{
|
||||||
switch (method)
|
return EaseInSine(value);
|
||||||
{
|
|
||||||
case EASING_METHOD.EASE_IN_SINE:
|
|
||||||
{
|
|
||||||
return EaseInSine(value);
|
|
||||||
}break;
|
|
||||||
case EASING_METHOD.EASE_OUT_SINE:
|
|
||||||
{
|
|
||||||
return EaseOutSine(value);
|
|
||||||
}break;
|
|
||||||
case EASING_METHOD.EASE_OUT_BOUNCE:
|
|
||||||
{
|
|
||||||
return EaseOutBounce(value);
|
|
||||||
}break;
|
|
||||||
case EASING_METHOD.EASE_IN_BOUNCE:
|
|
||||||
{
|
|
||||||
return EaseInBounce(value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EASING_METHOD.EASE_INOUT_BOUNCE:
|
|
||||||
{
|
|
||||||
return EaseInOutBounce(value);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private static float EaseInSine(float value)
|
case EASING_METHOD.EASE_OUT_SINE:
|
||||||
{
|
{
|
||||||
|
return EaseOutSine(value);
|
||||||
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f) ));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private static float EaseOutSine(float value)
|
case EASING_METHOD.EASE_OUT_BOUNCE:
|
||||||
{
|
{
|
||||||
return (float)(Math.Sin(value * Math.PI / 2.0f) );
|
return EaseOutBounce(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case EASING_METHOD.EASE_IN_BOUNCE:
|
||||||
private static float EaseOutBounce(float value)
|
|
||||||
{
|
{
|
||||||
const float n1 = 7.5625f;
|
return EaseInBounce(value);
|
||||||
const float d1 = 2.75f;
|
|
||||||
if (value < 1.0f / d1)
|
|
||||||
{
|
|
||||||
return n1 * value * value;
|
|
||||||
} else if (value < 2.0f / d1)
|
|
||||||
{
|
|
||||||
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
private static float EaseInBounce(float value)
|
case EASING_METHOD.EASE_INOUT_BOUNCE:
|
||||||
{
|
{
|
||||||
return 1 - EaseOutBounce(1 - value);
|
return EaseInOutBounce(value);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float EaseInSine(float value)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float EaseOutSine(float value)
|
||||||
|
{
|
||||||
|
return (float)(Math.Sin(value * Math.PI / 2.0f));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static float EaseInOutBounce(float value)
|
private static float EaseOutBounce(float value)
|
||||||
{
|
{
|
||||||
return (value < 0.5f)
|
const float n1 = 7.5625f;
|
||||||
?(1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
|
const float d1 = 2.75f;
|
||||||
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f;
|
if (value < 1.0f / d1)
|
||||||
}
|
{
|
||||||
|
return n1 * value * value;
|
||||||
|
}
|
||||||
|
else if (value < 2.0f / d1)
|
||||||
|
{
|
||||||
|
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float EaseInBounce(float value)
|
||||||
|
{
|
||||||
|
return 1 - EaseOutBounce(1 - value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static float EaseInOutBounce(float value)
|
||||||
|
{
|
||||||
|
return (value < 0.5f)
|
||||||
|
? (1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
|
||||||
|
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
public class ButtonFX:Script
|
public class ButtonFX:Script
|
||||||
{
|
{
|
||||||
public string onHoverEnterSound = "Empty";
|
public string onHoverEnterSound = "event:/UI/botton_hover";
|
||||||
public string onHoverExitSound = "Empty";
|
public string onHoverExitSound = "Empty";
|
||||||
public string onClickSound = "event:/UI/mouse_down_element";
|
public string onClickSound = "event:/UI/button_success";
|
||||||
public string onReleaseSound = "Empty";
|
public string onReleaseSound = "event:/UI/button_fail";
|
||||||
|
|
||||||
[NonSerialized]
|
[NonSerialized]
|
||||||
private AudioClipHandler onHoverEnterACHandler;
|
private AudioClipHandler onHoverEnterACHandler;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
|
|
||||||
public class CutsceneEnd : Script
|
public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,17 @@ public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
initCutscene4();
|
initCutscene4();
|
||||||
initCutscene5();
|
initCutscene5();
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
|
||||||
|
|
||||||
|
//Cutscene 4 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene4Run"] = Audio.CreateAudioClip("event:/Cinematics/4/1_run");
|
||||||
|
|
||||||
|
|
||||||
|
//Cutscene 5 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene5Yay"] = Audio.CreateAudioClip("event:/Cinematics/5/2_yay");
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
@ -70,6 +81,11 @@ public class CutsceneEnd : Script
|
||||||
skip = true;
|
skip = true;
|
||||||
oldDuration = duration;
|
oldDuration = duration;
|
||||||
duration = skipDuration;
|
duration = skipDuration;
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene4Run"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene5Yay"].Stop(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
|
if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
|
||||||
|
@ -90,6 +106,11 @@ public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
if (canvas4.IsActiveSelf)
|
if (canvas4.IsActiveSelf)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene4Run"].Play();
|
||||||
|
}
|
||||||
if (showPic4a)
|
if (showPic4a)
|
||||||
{
|
{
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
|
@ -116,6 +137,10 @@ public class CutsceneEnd : Script
|
||||||
|
|
||||||
if (showPic4b)
|
if (showPic4b)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
|
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
|
||||||
|
@ -140,6 +165,10 @@ public class CutsceneEnd : Script
|
||||||
|
|
||||||
if (showPic4c)
|
if (showPic4c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
|
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
|
||||||
|
@ -171,6 +200,10 @@ public class CutsceneEnd : Script
|
||||||
{
|
{
|
||||||
if (showPic5a)
|
if (showPic5a)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
|
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
|
||||||
|
@ -195,6 +228,11 @@ public class CutsceneEnd : Script
|
||||||
|
|
||||||
if (showPic5b)
|
if (showPic5b)
|
||||||
{
|
{
|
||||||
|
if (time == 0)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene5Yay"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);
|
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using SHADE;
|
using SHADE;
|
||||||
|
using SHADE_Scripting.Audio;
|
||||||
|
|
||||||
public class CutsceneIntro : Script
|
public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,24 @@ public class CutsceneIntro : Script
|
||||||
initCutscene1();
|
initCutscene1();
|
||||||
initCutscene2();
|
initCutscene2();
|
||||||
initCutscene3();
|
initCutscene3();
|
||||||
|
|
||||||
|
//Cutscene BGM
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
|
||||||
|
|
||||||
|
//Cutscene 2 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Stomach"] = Audio.CreateAudioClip("event:/Cinematics/2/1_stomach");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Alert"] = Audio.CreateAudioClip("event:/Cinematics/2/2_alert");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/2/3_sparkle");
|
||||||
|
|
||||||
|
//Cutscene 3 Audio
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Jump"] = Audio.CreateAudioClip("event:/Cinematics/3/1_jump");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/3/2_sparkle");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Carry"] = Audio.CreateAudioClip("event:/Cinematics/3/3_carry");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Throw"] = Audio.CreateAudioClip("event:/Cinematics/3/4_throw");
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Yay"] = Audio.CreateAudioClip("event:/Cinematics/3/5_yay");
|
||||||
|
|
||||||
|
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
|
@ -98,6 +116,16 @@ public class CutsceneIntro : Script
|
||||||
if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
|
if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
|
||||||
{
|
{
|
||||||
skip = true;
|
skip = true;
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Stomach"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Alert"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Jump"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Carry"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Throw"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Yay"].Stop(true);
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
|
||||||
|
|
||||||
oldDuration = duration;
|
oldDuration = duration;
|
||||||
duration = skipDuration;
|
duration = skipDuration;
|
||||||
}
|
}
|
||||||
|
@ -128,6 +156,10 @@ public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
if (canvas1.IsActiveSelf)
|
if (canvas1.IsActiveSelf)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (showPic1a)
|
if (showPic1a)
|
||||||
{
|
{
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
|
@ -154,6 +186,10 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic1b)
|
if (showPic1b)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
|
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
|
||||||
|
@ -178,6 +214,10 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic1c)
|
if (showPic1c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
|
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
|
||||||
|
@ -209,6 +249,11 @@ public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
if (showPic2a)
|
if (showPic2a)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Stomach"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
|
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
|
||||||
|
@ -233,6 +278,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic2b)
|
if (showPic2b)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Alert"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
|
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
|
||||||
|
@ -257,6 +307,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic2c)
|
if (showPic2c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
|
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
|
||||||
|
@ -288,6 +343,11 @@ public class CutsceneIntro : Script
|
||||||
{
|
{
|
||||||
if (showPic3a)
|
if (showPic3a)
|
||||||
{
|
{
|
||||||
|
if(time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Jump"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
|
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
|
||||||
|
@ -312,6 +372,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3b)
|
if (showPic3b)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
|
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
|
||||||
|
@ -336,6 +401,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3c)
|
if (showPic3c)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Carry"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
|
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
|
||||||
|
@ -360,6 +430,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3d)
|
if (showPic3d)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Throw"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
|
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
|
||||||
|
@ -384,6 +459,11 @@ public class CutsceneIntro : Script
|
||||||
|
|
||||||
if (showPic3e)
|
if (showPic3e)
|
||||||
{
|
{
|
||||||
|
if (time == 0 && !skip)
|
||||||
|
{
|
||||||
|
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||||
|
AudioHandler.audioClipHandlers["cutscene3Yay"].Play();
|
||||||
|
}
|
||||||
if (time < duration)
|
if (time < duration)
|
||||||
{
|
{
|
||||||
pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration);
|
pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration);
|
||||||
|
|
|
@ -10,8 +10,8 @@ public class EndScene : Script
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
//AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
//AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void start()
|
protected override void start()
|
||||||
|
@ -27,28 +27,28 @@ public class EndScene : Script
|
||||||
if (Input.GetKeyDown(Input.KeyCode.R))
|
if (Input.GetKeyDown(Input.KeyCode.R))
|
||||||
{
|
{
|
||||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
//AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||||
}
|
}
|
||||||
if (Input.GetKeyUp(Input.KeyCode.R))
|
if (Input.GetKeyUp(Input.KeyCode.R))
|
||||||
{
|
{
|
||||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||||
//Audio.StopAllSounds();
|
//Audio.StopAllSounds();
|
||||||
AudioHandler.StopAllSounds(false);
|
AudioHandler.StopAllSounds(false);
|
||||||
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
//AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||||
SceneManager.ChangeScene(mainGameScene);
|
SceneManager.ChangeScene(mainGameScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(Input.KeyCode.M))
|
if (Input.GetKeyDown(Input.KeyCode.M))
|
||||||
{
|
{
|
||||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
//AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||||
}
|
}
|
||||||
if (Input.GetKeyUp(Input.KeyCode.M))
|
if (Input.GetKeyUp(Input.KeyCode.M))
|
||||||
{
|
{
|
||||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||||
//Audio.StopAllSounds();
|
//Audio.StopAllSounds();
|
||||||
AudioHandler.StopAllSounds(false);
|
AudioHandler.StopAllSounds(false);
|
||||||
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
//AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||||
SceneManager.ChangeScene(mainMainScene);
|
SceneManager.ChangeScene(mainMainScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ public class MainMenu : Script
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
||||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
//AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
//AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||||
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
||||||
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
||||||
|
|
||||||
|
|
|
@ -7,89 +7,92 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SHADE_Scripting.UI
|
namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
public class Options:Script
|
public class Options : Script
|
||||||
|
{
|
||||||
|
public GameObject masterVolSlider;
|
||||||
|
public GameObject sfxVolSlider;
|
||||||
|
public GameObject bgmVolSlider;
|
||||||
|
public GameObject fovSlider;
|
||||||
|
public GameObject sensitivitySlider;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
{
|
{
|
||||||
public GameObject masterVolSlider;
|
Slider mv = masterVolSlider.GetComponent<Slider>();
|
||||||
public GameObject sfxVolSlider;
|
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
||||||
public GameObject bgmVolSlider;
|
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
||||||
public GameObject fovSlider;
|
Slider fov = fovSlider.GetComponent<Slider>();
|
||||||
public GameObject sensitivitySlider;
|
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (mv != null)
|
||||||
|
{
|
||||||
|
mv.ScaledValue = Settings.masterVolume;
|
||||||
|
}
|
||||||
|
if (sfx != null)
|
||||||
|
{
|
||||||
|
sfx.ScaledValue = Settings.sfxVolume;
|
||||||
|
|
||||||
protected override void awake()
|
}
|
||||||
{
|
if (bgm != null)
|
||||||
Slider mv = masterVolSlider.GetComponent<Slider>();
|
{
|
||||||
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
bgm.ScaledValue = Settings.bgmVolume;
|
||||||
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
|
||||||
Slider fov = fovSlider.GetComponent<Slider>();
|
|
||||||
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (fov != null)
|
||||||
|
{
|
||||||
|
fov.ScaledValue = Settings.cameraFOV;
|
||||||
|
|
||||||
if (mv != null)
|
}
|
||||||
{
|
if (sens != null)
|
||||||
mv.ScaledValue = Settings.masterVolume;
|
{
|
||||||
|
sens.ScaledValue = Settings.cameraSensitivity;
|
||||||
}
|
|
||||||
if (sfx != null)
|
|
||||||
{
|
|
||||||
sfx.ScaledValue = Settings.sfxVolume;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (bgm != null)
|
|
||||||
{
|
|
||||||
bgm.ScaledValue = Settings.bgmVolume;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (fov != null)
|
|
||||||
{
|
|
||||||
fov.ScaledValue = Settings.cameraFOV;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (sens != null)
|
|
||||||
{
|
|
||||||
sens.ScaledValue = Settings.cameraSensitivity;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected override void update()
|
|
||||||
{
|
|
||||||
Slider mv = masterVolSlider.GetComponent<Slider>();
|
|
||||||
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
|
||||||
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
|
||||||
Slider fov = fovSlider.GetComponent<Slider>();
|
|
||||||
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
|
||||||
|
|
||||||
if(mv != null)
|
|
||||||
{
|
|
||||||
Settings.masterVolume = mv.ScaledValue;
|
|
||||||
}
|
|
||||||
if (sfx != null)
|
|
||||||
{
|
|
||||||
Settings.sfxVolume = sfx.ScaledValue;
|
|
||||||
}
|
|
||||||
if (bgm != null)
|
|
||||||
{
|
|
||||||
Settings.bgmVolume = bgm.ScaledValue;
|
|
||||||
}
|
|
||||||
if (fov != null)
|
|
||||||
{
|
|
||||||
Settings.cameraFOV = fov.ScaledValue;
|
|
||||||
}
|
|
||||||
if (sens != null)
|
|
||||||
{
|
|
||||||
Settings.cameraSensitivity = sens.ScaledValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
Slider mv = masterVolSlider.GetComponent<Slider>();
|
||||||
|
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
||||||
|
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
||||||
|
Slider fov = fovSlider.GetComponent<Slider>();
|
||||||
|
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
||||||
|
|
||||||
|
if (mv != null)
|
||||||
|
{
|
||||||
|
Settings.masterVolume = mv.ScaledValue;
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume * 0.01f);
|
||||||
|
}
|
||||||
|
if (sfx != null)
|
||||||
|
{
|
||||||
|
Settings.sfxVolume = sfx.ScaledValue;
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume * 0.01f);
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume * 0.01f);
|
||||||
|
}
|
||||||
|
if (bgm != null)
|
||||||
|
{
|
||||||
|
Settings.bgmVolume = bgm.ScaledValue;
|
||||||
|
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume * 0.01f);
|
||||||
|
}
|
||||||
|
if (fov != null)
|
||||||
|
{
|
||||||
|
Settings.cameraFOV = fov.ScaledValue;
|
||||||
|
}
|
||||||
|
if (sens != null)
|
||||||
|
{
|
||||||
|
Settings.cameraSensitivity = sens.ScaledValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class PauseMenu : Script
|
||||||
if (canvas)
|
if (canvas)
|
||||||
canvas.SetActive(false);
|
canvas.SetActive(false);
|
||||||
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||||
|
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -69,6 +70,8 @@ public class PauseMenu : Script
|
||||||
GameManager.Instance.GamePause = false;
|
GameManager.Instance.GamePause = false;
|
||||||
GameManager.Instance.stealFoodPopUpDone = false;
|
GameManager.Instance.stealFoodPopUpDone = false;
|
||||||
GameManager.Instance.PreviewLevelDone = false;
|
GameManager.Instance.PreviewLevelDone = false;
|
||||||
|
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||||
|
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -82,6 +85,8 @@ public class PauseMenu : Script
|
||||||
quit.OnRelease.RegisterAction(() =>
|
quit.OnRelease.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
Audio.StopAllSounds();
|
Audio.StopAllSounds();
|
||||||
|
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||||
|
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
|
||||||
//go to main menu
|
//go to main menu
|
||||||
SceneManager.ChangeScene(97158628);
|
SceneManager.ChangeScene(97158628);
|
||||||
});
|
});
|
||||||
|
@ -106,6 +111,7 @@ public class PauseMenu : Script
|
||||||
if (canvas)
|
if (canvas)
|
||||||
canvas.SetActive(true);
|
canvas.SetActive(true);
|
||||||
Application.FixDeltaTime = 0;
|
Application.FixDeltaTime = 0;
|
||||||
|
AnimationSystem.TimeScale = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
using SHADE;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SHADE_Scripting.UI
|
||||||
|
{
|
||||||
|
public class ScoreTextDigitPositioning:Script
|
||||||
|
{
|
||||||
|
[NonSerialized]
|
||||||
|
Vector3 defaultPosition;
|
||||||
|
|
||||||
|
public float offsetPerDigit = 0.0f;
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
Transform trans = GetComponent<Transform>();
|
||||||
|
if(trans)
|
||||||
|
{
|
||||||
|
defaultPosition = trans.LocalPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
TextRenderable text = GetComponent<TextRenderable>();
|
||||||
|
Transform trans = GetComponent<Transform>();
|
||||||
|
if (trans && text)
|
||||||
|
{
|
||||||
|
String str = text.Text;
|
||||||
|
|
||||||
|
Vector3 offset = new Vector3((str.Length - 1) * offsetPerDigit, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
trans.LocalPosition = defaultPosition - offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_ScoreTextDigitPositioning
|
||||||
|
ID: 166859312
|
||||||
|
Type: 9
|
|
@ -0,0 +1,73 @@
|
||||||
|
using SHADE;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SHADE_Scripting.UI
|
||||||
|
{
|
||||||
|
public class SingleScaleBounce: Script
|
||||||
|
{
|
||||||
|
[NonSerialized]
|
||||||
|
TweenThread thread;
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
Vector3 defaultScale;
|
||||||
|
|
||||||
|
public float durationUp = 0.15f;
|
||||||
|
public float durationDown = 0.3f;
|
||||||
|
|
||||||
|
public float scaleSize = 1.2f;
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private bool scaleUp = false;
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
Transform trans = GetComponent<Transform>();
|
||||||
|
if(trans != null)
|
||||||
|
{
|
||||||
|
defaultScale = trans.LocalScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void start()
|
||||||
|
{
|
||||||
|
thread = TweenManager.CreateTweenThread(0.0f,1.0f,1.0f,EASING_METHOD.EASE_IN_SINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
if(scaleUp)
|
||||||
|
{
|
||||||
|
if(thread.IsCompleted())
|
||||||
|
{
|
||||||
|
scaleUp = false;
|
||||||
|
thread.duration = durationDown;
|
||||||
|
thread.ResetInvert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Transform trans = GetComponent<Transform>();
|
||||||
|
if(trans != null)
|
||||||
|
{
|
||||||
|
trans.LocalScale = defaultScale * thread.GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ScaleBounceOnce()
|
||||||
|
{
|
||||||
|
scaleUp = true;
|
||||||
|
thread.duration = durationUp;
|
||||||
|
thread.Reset(1.0f, scaleSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Name: SC_SingleScaleBounce
|
||||||
|
ID: 151165363
|
||||||
|
Type: 9
|
|
@ -53,13 +53,16 @@ namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
if (!GameManager.Instance.PreviewLevelDone)
|
if (!GameManager.Instance.PreviewLevelDone)
|
||||||
{
|
{
|
||||||
rot.Reset();
|
if (rot != null && scaleX != null && scaleY != null)
|
||||||
scaleX.Reset();
|
{
|
||||||
scaleY.Reset();
|
rot.Reset();
|
||||||
|
scaleX.Reset();
|
||||||
|
scaleY.Reset();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!popInDone)
|
if (!popInDone && rot != null && scaleX != null && scaleY != null)
|
||||||
{
|
{
|
||||||
tran.LocalEulerAngles = new Vector3(0.0f, 0.0f, SHADE.Math.DegreesToRadians(rot.GetValue()));
|
tran.LocalEulerAngles = new Vector3(0.0f, 0.0f, SHADE.Math.DegreesToRadians(rot.GetValue()));
|
||||||
tran.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1);
|
tran.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1);
|
||||||
|
@ -71,7 +74,7 @@ namespace SHADE_Scripting.UI
|
||||||
stayDone = true;
|
stayDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
|
if (rot != null && scaleX != null && scaleY != null && rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
|
||||||
popInDone = true;
|
popInDone = true;
|
||||||
|
|
||||||
if (stayDone)
|
if (stayDone)
|
||||||
|
@ -82,8 +85,11 @@ namespace SHADE_Scripting.UI
|
||||||
scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE);
|
scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE);
|
||||||
createThreadOnce = false;
|
createThreadOnce = false;
|
||||||
}
|
}
|
||||||
tran.LocalScale = new Vector3(scaleOutX.GetValue(), scaleOutY.GetValue(), 1);
|
|
||||||
if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
|
if(scaleOutX != null && scaleOutY != null)
|
||||||
|
tran.LocalScale = new Vector3(scaleOutX.GetValue(), scaleOutY.GetValue(), 1);
|
||||||
|
|
||||||
|
if (scaleOutX != null && scaleOutY != null && scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
|
||||||
{
|
{
|
||||||
GameObject.SetActive(false);
|
GameObject.SetActive(false);
|
||||||
GameManager.Instance.stealFoodPopUpDone = true;
|
GameManager.Instance.stealFoodPopUpDone = true;
|
||||||
|
|
|
@ -4,190 +4,182 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
public class TweenThread
|
||||||
namespace SHADE_Scripting.UI
|
|
||||||
{
|
{
|
||||||
|
private float timer = 0.0f;
|
||||||
|
public float duration = 1.0f;
|
||||||
|
public EASING_METHOD method;
|
||||||
|
private float value = 0.0f;
|
||||||
|
public float startValue = 0.0f;
|
||||||
|
public float endValue = 1.0f;
|
||||||
|
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
this.duration = duration;
|
||||||
|
this.method = method;
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void Update(float deltaTime)
|
||||||
|
{
|
||||||
|
if (timer >= duration)
|
||||||
|
return;
|
||||||
|
|
||||||
|
timer += deltaTime;
|
||||||
|
if (timer >= duration)
|
||||||
|
timer = duration;
|
||||||
|
|
||||||
|
value = EasingHelper.EaseHelp(timer / duration, method) * (endValue - startValue) + startValue;
|
||||||
|
}
|
||||||
|
public bool IsCompleted()
|
||||||
|
{
|
||||||
|
return timer >= duration;
|
||||||
|
}
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
timer = 0.0f;
|
||||||
|
value = startValue;
|
||||||
|
}
|
||||||
|
public void Reset(float startValue, float endValue)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void ResetInvert()
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
float temp = startValue;
|
||||||
|
startValue = endValue;
|
||||||
|
endValue = temp;
|
||||||
|
}
|
||||||
|
public float GetValue()
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class TweenThreadVec3
|
||||||
|
{
|
||||||
|
private float timer = 0.0f;
|
||||||
|
public float duration = 1.0f;
|
||||||
|
public EASING_METHOD method;
|
||||||
|
private Vector3 value = Vector3.Zero;
|
||||||
|
public Vector3 startValue = Vector3.Zero;
|
||||||
|
public Vector3 endValue = Vector3.Zero;
|
||||||
|
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
this.duration = duration;
|
||||||
|
this.method = method;
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void Update(float deltaTime)
|
||||||
|
{
|
||||||
|
if (timer >= duration)
|
||||||
|
return;
|
||||||
|
|
||||||
|
timer += deltaTime;
|
||||||
|
if (timer >= duration)
|
||||||
|
timer = duration;
|
||||||
|
|
||||||
|
value = (endValue - startValue) * EasingHelper.EaseHelp(timer / duration, method) + startValue;
|
||||||
|
}
|
||||||
|
public bool IsCompleted()
|
||||||
|
{
|
||||||
|
return timer >= duration;
|
||||||
|
}
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
timer = 0.0f;
|
||||||
|
value = startValue;
|
||||||
|
}
|
||||||
|
public void Reset(Vector3 startValue, Vector3 endValue)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
this.startValue = startValue;
|
||||||
|
this.endValue = endValue;
|
||||||
|
}
|
||||||
|
public void ResetInvert()
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
Vector3 temp = startValue;
|
||||||
|
startValue = endValue;
|
||||||
|
endValue = temp;
|
||||||
|
}
|
||||||
|
public Vector3 GetValue()
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class TweenManager : Script
|
||||||
|
{
|
||||||
|
public static TweenManager Instance { get; private set; }
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private List<TweenThread> threadList;
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private List<TweenThreadVec3> threadVec3List;
|
||||||
|
|
||||||
|
protected override void awake()
|
||||||
|
{
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
RemoveScript<TweenManager>();
|
||||||
|
else
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
|
threadList = new List<TweenThread>();
|
||||||
|
threadVec3List = new List<TweenThreadVec3>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void onDestroy()
|
||||||
|
{
|
||||||
|
if (Instance == this)
|
||||||
|
Instance = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void update()
|
||||||
|
{
|
||||||
|
foreach (TweenThread thread in threadList)
|
||||||
|
{
|
||||||
|
thread.Update(Time.DeltaTimeF);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (TweenThreadVec3 thread in threadVec3List)
|
||||||
|
{
|
||||||
|
thread.Update(Time.DeltaTimeF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static TweenThread CreateTweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
|
||||||
|
Instance.threadList.Add(thread);
|
||||||
|
thread.Reset();
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TweenThreadVec3 CreateTweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
||||||
|
{
|
||||||
|
if (Instance == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
TweenThreadVec3 thread = new TweenThreadVec3(duration, startValue, endValue, method);
|
||||||
|
Instance.threadVec3List.Add(thread);
|
||||||
|
thread.Reset();
|
||||||
|
return thread;
|
||||||
|
}
|
||||||
|
|
||||||
public class TweenThread
|
|
||||||
{
|
|
||||||
private float timer = 0.0f;
|
|
||||||
public float duration = 1.0f;
|
|
||||||
public EASING_METHOD method;
|
|
||||||
private float value = 0.0f;
|
|
||||||
public float startValue = 0.0f;
|
|
||||||
public float endValue = 1.0f;
|
|
||||||
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
this.duration = duration;
|
|
||||||
this.method = method;
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void Update(float deltaTime)
|
|
||||||
{
|
|
||||||
if (timer >= duration)
|
|
||||||
return;
|
|
||||||
|
|
||||||
timer += deltaTime;
|
|
||||||
if (timer >= duration)
|
|
||||||
timer = duration;
|
|
||||||
|
|
||||||
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
|
|
||||||
}
|
|
||||||
public bool IsCompleted()
|
|
||||||
{
|
|
||||||
return timer >= duration;
|
|
||||||
}
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
timer = 0.0f;
|
|
||||||
value = startValue;
|
|
||||||
}
|
|
||||||
public void Reset(float startValue, float endValue)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void ResetInvert()
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
float temp = startValue;
|
|
||||||
startValue = endValue;
|
|
||||||
endValue = temp;
|
|
||||||
}
|
|
||||||
public float GetValue()
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class TweenThreadVec3
|
|
||||||
{
|
|
||||||
private float timer = 0.0f;
|
|
||||||
public float duration = 1.0f;
|
|
||||||
public EASING_METHOD method;
|
|
||||||
private Vector3 value = Vector3.Zero;
|
|
||||||
public Vector3 startValue = Vector3.Zero;
|
|
||||||
public Vector3 endValue = Vector3.Zero;
|
|
||||||
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
this.duration = duration;
|
|
||||||
this.method = method;
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void Update(float deltaTime)
|
|
||||||
{
|
|
||||||
if (timer >= duration)
|
|
||||||
return;
|
|
||||||
|
|
||||||
timer += deltaTime;
|
|
||||||
if (timer >= duration)
|
|
||||||
timer = duration;
|
|
||||||
|
|
||||||
value = (endValue - startValue) * EasingHelper.EaseHelp(timer / duration, method) + startValue;
|
|
||||||
}
|
|
||||||
public bool IsCompleted()
|
|
||||||
{
|
|
||||||
return timer >= duration;
|
|
||||||
}
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
timer = 0.0f;
|
|
||||||
value = startValue;
|
|
||||||
}
|
|
||||||
public void Reset(Vector3 startValue, Vector3 endValue)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
this.startValue = startValue;
|
|
||||||
this.endValue = endValue;
|
|
||||||
}
|
|
||||||
public void ResetInvert()
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
Vector3 temp = startValue;
|
|
||||||
startValue = endValue;
|
|
||||||
endValue = temp;
|
|
||||||
}
|
|
||||||
public Vector3 GetValue()
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class TweenManager : Script
|
|
||||||
{
|
|
||||||
public static TweenManager Instance { get; private set; }
|
|
||||||
|
|
||||||
[NonSerialized]
|
|
||||||
private List<TweenThread> threadList;
|
|
||||||
|
|
||||||
[NonSerialized]
|
|
||||||
private List<TweenThreadVec3> threadVec3List;
|
|
||||||
|
|
||||||
protected override void awake()
|
|
||||||
{
|
|
||||||
if (Instance != null && Instance != this)
|
|
||||||
RemoveScript<TweenManager>();
|
|
||||||
else
|
|
||||||
Instance = this;
|
|
||||||
|
|
||||||
threadList = new List<TweenThread>();
|
|
||||||
threadVec3List = new List<TweenThreadVec3>();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void onDestroy()
|
|
||||||
{
|
|
||||||
if (Instance == this)
|
|
||||||
Instance = null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void update()
|
|
||||||
{
|
|
||||||
foreach (TweenThread thread in threadList)
|
|
||||||
{
|
|
||||||
thread.Update(Time.DeltaTimeF);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (TweenThreadVec3 thread in threadVec3List)
|
|
||||||
{
|
|
||||||
thread.Update(Time.DeltaTimeF);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static TweenThread CreateTweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
if (Instance == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
|
|
||||||
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
|
|
||||||
Instance.threadList.Add(thread);
|
|
||||||
thread.Reset();
|
|
||||||
return thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TweenThreadVec3 CreateTweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
|
||||||
{
|
|
||||||
if (Instance == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
|
|
||||||
TweenThreadVec3 thread = new TweenThreadVec3(duration, startValue, endValue, method);
|
|
||||||
Instance.threadVec3List.Add(thread);
|
|
||||||
thread.Reset();
|
|
||||||
return thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,14 @@ public abstract class BaseState
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnEnter()
|
public virtual void OnEnter()
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void update();
|
public abstract void update();
|
||||||
|
|
||||||
public abstract void fixedUpdate();
|
public abstract void fixedUpdate();
|
||||||
|
|
||||||
public virtual void OnExit()
|
public virtual void OnExit()
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetStateName()
|
public string GetStateName()
|
||||||
{
|
{
|
||||||
|
@ -37,11 +34,6 @@ public abstract class BaseState
|
||||||
return animationName;
|
return animationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual float GetAnimPercent()
|
|
||||||
{
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void onCollisionEnter(CollisionInfo info)
|
public virtual void onCollisionEnter(CollisionInfo info)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#version 450
|
||||||
|
#extension GL_KHR_vulkan_glsl : enable
|
||||||
|
|
||||||
|
//#include "ShaderDescriptorDefinitions.glsl"
|
||||||
|
|
||||||
|
|
||||||
|
layout(location = 0) in vec3 aVertexPos;
|
||||||
|
layout(location = 4) in mat4 worldTransform;
|
||||||
|
layout(location = 9) in uvec4 aBoneIndices;
|
||||||
|
layout(location = 10) in vec4 aBoneWeights;
|
||||||
|
layout(location = 11) in uint firstBoneIndex;
|
||||||
|
|
||||||
|
layout(set = 1, binding = 0) uniform CameraData
|
||||||
|
{
|
||||||
|
vec4 position;
|
||||||
|
mat4 vpMat;
|
||||||
|
mat4 viewMat;
|
||||||
|
mat4 projMat;
|
||||||
|
} cameraData;
|
||||||
|
|
||||||
|
layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices
|
||||||
|
{
|
||||||
|
mat4 data[];
|
||||||
|
} BoneMatrices;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
// // Compute bone matrix
|
||||||
|
mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3];
|
||||||
|
|
||||||
|
// clip space for rendering
|
||||||
|
// gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
||||||
|
gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f);
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: ShadowMapAnim_VS
|
||||||
|
ID: 39393999
|
||||||
|
Type: 2
|
|
@ -7,9 +7,6 @@ layout(location = 2) in vec3 aNormal;
|
||||||
layout(location = 3) in vec3 aTangent;
|
layout(location = 3) in vec3 aTangent;
|
||||||
layout(location = 4) in mat4 worldTransform;
|
layout(location = 4) in mat4 worldTransform;
|
||||||
layout(location = 8) in uvec2 integerData;
|
layout(location = 8) in uvec2 integerData;
|
||||||
layout(location = 9) in uvec4 aBoneIndices;
|
|
||||||
layout(location = 10) in vec4 aBoneWeights;
|
|
||||||
layout(location = 11) in uint firstBoneIndex;
|
|
||||||
|
|
||||||
layout(location = 0) out struct
|
layout(location = 0) out struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,12 @@ layout(set = 1, binding = 0) uniform CameraData
|
||||||
mat4 projMat;
|
mat4 projMat;
|
||||||
} cameraData;
|
} cameraData;
|
||||||
|
|
||||||
|
layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices
|
||||||
|
{
|
||||||
|
mat4 data[];
|
||||||
|
} BoneMatrices;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
Out2.materialIndex = gl_InstanceIndex;
|
Out2.materialIndex = gl_InstanceIndex;
|
||||||
|
@ -63,6 +69,13 @@ void main()
|
||||||
Out.normal.rgb = transposeInv * aNormal.rgb;
|
Out.normal.rgb = transposeInv * aNormal.rgb;
|
||||||
Out.normal.rgb = normalize (Out.normal.rgb);
|
Out.normal.rgb = normalize (Out.normal.rgb);
|
||||||
|
|
||||||
|
// Compute bone matrix
|
||||||
|
mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2];
|
||||||
|
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3];
|
||||||
|
|
||||||
// clip space for rendering
|
// clip space for rendering
|
||||||
gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f);
|
||||||
|
// gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Button_Resume_Clicked
|
||||||
|
ID: 66776217
|
||||||
|
Type: 3
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Button_Resume_Default
|
||||||
|
ID: 63738242
|
||||||
|
Type: 3
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Button_Resume_Hovered
|
||||||
|
ID: 58455648
|
||||||
|
Type: 3
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Button_Retry_Clicked
|
||||||
|
ID: 60429179
|
||||||
|
Type: 3
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Button_Retry_Default
|
||||||
|
ID: 64995894
|
||||||
|
Type: 3
|
Binary file not shown.
Binary file not shown.
|
@ -1,3 +0,0 @@
|
||||||
Name: Button_Retry_Hover
|
|
||||||
ID: 58347825
|
|
||||||
Type: 3
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Name: Button_Retry_Hovered
|
||||||
|
ID: 58109178
|
||||||
|
Type: 3
|
|
@ -1,3 +0,0 @@
|
||||||
Name: Button_Retry_Idle
|
|
||||||
ID: 64806384
|
|
||||||
Type: 3
|
|
|
@ -1,3 +0,0 @@
|
||||||
Name: Button_Retry_Pressed
|
|
||||||
ID: 63234380
|
|
||||||
Type: 3
|
|
|
@ -180,8 +180,8 @@ namespace Sandbox
|
||||||
// Link up SHDebugDraw
|
// Link up SHDebugDraw
|
||||||
SHDebugDraw::Init(SHSystemManager::GetSystem<SHDebugDrawSystem>());
|
SHDebugDraw::Init(SHSystemManager::GetSystem<SHDebugDrawSystem>());
|
||||||
|
|
||||||
auto clip = SHResourceManager::LoadOrGet<SHRawAnimation>(77816045);
|
//auto clip = SHResourceManager::LoadOrGet<SHRawAnimation>(77816045);
|
||||||
auto rig = SHResourceManager::LoadOrGet<SHRig>(77816045);
|
//auto rig = SHResourceManager::LoadOrGet<SHRig>(77816045);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SBApplication::Update(void)
|
void SBApplication::Update(void)
|
||||||
|
|
|
@ -24,15 +24,13 @@ project "SHADE_CSharp"
|
||||||
{
|
{
|
||||||
"SHADE_Engine"
|
"SHADE_Engine"
|
||||||
}
|
}
|
||||||
|
|
||||||
warnings 'Extra'
|
|
||||||
|
|
||||||
postbuildcommands
|
postbuildcommands
|
||||||
{
|
{
|
||||||
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.xml\" \"%{outputdir}\"",
|
"xcopy /r /y /q \"%{wks.location}/bin/$(Configuration)\\net5.0\\SHADE_CSharp.pdb\" \"%{wks.location}/bin/$(Configuration)\""
|
||||||
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.pdb\" \"%{outputdir}\""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
warnings 'Extra'
|
||||||
|
|
||||||
filter "configurations:Debug"
|
filter "configurations:Debug"
|
||||||
symbols "On"
|
symbols "On"
|
||||||
defines {"_DEBUG"}
|
defines {"_DEBUG"}
|
||||||
|
|
|
@ -20,19 +20,19 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Constructors */
|
/* Constructors */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
SHAnimationClip::SHAnimationClip(Handle<SHRawAnimation> rawAnimHandle, int firstFrame, int lastFrame)
|
SHAnimationClip::SHAnimationClip(Handle<SHRawAnimation> rawAnimHandle, int firstFrame, int lastFrame, float playbackMultiplier)
|
||||||
: rawAnim { rawAnimHandle }
|
: rawAnim { rawAnimHandle }
|
||||||
, startFrameIndex { firstFrame }
|
, startFrameIndex { firstFrame }
|
||||||
, endFrameIndex { lastFrame }
|
, endFrameIndex { lastFrame }
|
||||||
, duration { 0.0f }
|
, duration { 0.0f }
|
||||||
, startTimeStamp { 0.0f }
|
, startTimeStamp { 0.0f }
|
||||||
|
, playbackSpeedMultiplier { playbackMultiplier }
|
||||||
{
|
{
|
||||||
if (!rawAnim)
|
if (!rawAnim)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const float SECS_PER_TICK = 1.0f / static_cast<float>(rawAnim->GetTicksPerSecond());
|
const float SECS_PER_TICK = 1.0f / static_cast<float>(rawAnim->GetTicksPerSecond());
|
||||||
const int ONE_PAST_LAST_FRAME = lastFrame + 1;
|
duration = static_cast<float>(lastFrame - firstFrame) * SECS_PER_TICK;
|
||||||
duration = static_cast<float>(ONE_PAST_LAST_FRAME - firstFrame) * SECS_PER_TICK;
|
|
||||||
startTimeStamp = static_cast<float>(firstFrame) * SECS_PER_TICK;
|
startTimeStamp = static_cast<float>(firstFrame) * SECS_PER_TICK;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -41,25 +41,39 @@ namespace SHADE
|
||||||
/// <param name="rawAnimHandle">Handle to the raw animation data.</param>
|
/// <param name="rawAnimHandle">Handle to the raw animation data.</param>
|
||||||
/// <param name="firstFrame">First frame to be played.</param>
|
/// <param name="firstFrame">First frame to be played.</param>
|
||||||
/// <param name="lastFrame">Last frame to be played.</param>
|
/// <param name="lastFrame">Last frame to be played.</param>
|
||||||
SHAnimationClip(Handle<SHRawAnimation> rawAnimHandle, int firstFrame, int lastFrame);
|
/// <param name="playbackMultiplier">Multiplier for the playback speed.</param>
|
||||||
|
SHAnimationClip(Handle<SHRawAnimation> rawAnimHandle, int firstFrame, int lastFrame, float playbackMultiplier = 1.0f);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Getter Functions */
|
/* Getter Functions */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
inline Handle<SHRawAnimation> GetRawAnimation() const noexcept { return rawAnim; }
|
inline Handle<SHRawAnimation> GetRawAnimation() const noexcept { return rawAnim; }
|
||||||
inline int GetStartFrameIndex() const noexcept { return startFrameIndex; }
|
inline int GetStartFrameIndex() const noexcept { return startFrameIndex; }
|
||||||
inline int GetEndFrameIndex() const noexcept { return endFrameIndex; }
|
inline int GetEndFrameIndex() const noexcept { return endFrameIndex; }\
|
||||||
inline float GetTotalDuration() const noexcept { return duration; }
|
|
||||||
inline float GetStartTimeStamp() const noexcept { return startTimeStamp; }
|
inline float GetStartTimeStamp() const noexcept { return startTimeStamp; }
|
||||||
|
inline float GetPlaybackSpeedMultiplier() const noexcept { return playbackSpeedMultiplier; }
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the duration of the animation as if the playback speed multiplier is
|
||||||
|
/// in it's default value of 1.0f.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Duration of the animation in seconds.</returns>
|
||||||
|
inline float GetTotalDuration() const noexcept { return duration; }
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the duration of the animation with the playback speed multiplier
|
||||||
|
/// taken into account.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True duration of the animation in seconds.</returns>
|
||||||
|
inline float GetTrueDuration() const noexcept { return duration / playbackSpeedMultiplier; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Data Members */
|
/* Data Members */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
Handle<SHRawAnimation> rawAnim;
|
Handle<SHRawAnimation> rawAnim;
|
||||||
int startFrameIndex; // First Frame
|
int startFrameIndex; // First Frame
|
||||||
int endFrameIndex; // Last Frame (inclusive)
|
int endFrameIndex; // Last Frame (inclusive)
|
||||||
float duration; // Total playback time
|
float duration; // Total playback time
|
||||||
float startTimeStamp; // Starting time stamp of the raw anim
|
float startTimeStamp; // Starting time stamp of the raw anim
|
||||||
|
float playbackSpeedMultiplier; // Multiplier applied to the playback of an animation clip
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -15,6 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "SHAnimationSystem.h"
|
#include "SHAnimationSystem.h"
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
#include "SHAnimationClip.h"
|
#include "SHAnimationClip.h"
|
||||||
|
#include "Events/SHEventManager.hpp"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -55,23 +56,27 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Lifecycle Functions */
|
/* Lifecycle Functions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void SHAnimationController::Update(InstanceData& instData, float dt)
|
void SHAnimationController::Update(EntityID eid, InstanceData& instData, float dt)
|
||||||
{
|
{
|
||||||
// Is there a valid node
|
// Is there a valid node
|
||||||
if (!instData.CurrentNode)
|
if (!instData.CurrentNode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Get the clip
|
||||||
|
Handle<SHAnimationClip> clip = instData.CurrentNode->Clip;
|
||||||
|
|
||||||
// Update the current playback
|
// Update the current playback
|
||||||
instData.ClipPlaybackTime += dt;
|
instData.ClipPlaybackTime += dt * clip->GetPlaybackSpeedMultiplier();
|
||||||
|
|
||||||
// Check if we finished playing
|
// Check if we finished playing
|
||||||
const float CLIP_CURR_PLAYED_TIME = instData.ClipPlaybackTime - instData.CurrentNode->Clip->GetStartTimeStamp();
|
const float CLIP_CURR_PLAYED_TIME = instData.ClipPlaybackTime - clip->GetStartTimeStamp();
|
||||||
if (CLIP_CURR_PLAYED_TIME > instData.CurrentNode->Clip->GetTotalDuration())
|
if (CLIP_CURR_PLAYED_TIME > clip->GetTotalDuration())
|
||||||
{
|
{
|
||||||
// Clamp
|
// Clamp
|
||||||
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp() + instData.CurrentNode->Clip->GetTotalDuration();
|
instData.ClipPlaybackTime = clip->GetStartTimeStamp() + clip->GetTotalDuration();
|
||||||
|
|
||||||
// Go to next state
|
// Go to next state
|
||||||
|
Handle<SHAnimationClip> originalClip = clip;
|
||||||
bool stateChanged = false;
|
bool stateChanged = false;
|
||||||
for (const auto& transition : instData.CurrentNode->Transitions)
|
for (const auto& transition : instData.CurrentNode->Transitions)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +112,29 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle if there is no next state, we repeat
|
// Handle if there is no next state, we repeat
|
||||||
if (!stateChanged)
|
if (stateChanged)
|
||||||
|
{
|
||||||
|
// Raise events
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::FinishedEvent
|
||||||
|
{
|
||||||
|
eid,
|
||||||
|
originalClip
|
||||||
|
},
|
||||||
|
SH_ANIMATION_FINISHED_EVENT
|
||||||
|
);
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::PlayEvent
|
||||||
|
{
|
||||||
|
eid,
|
||||||
|
instData.CurrentNode ? instData.CurrentNode->Clip : Handle<SHAnimationClip>()
|
||||||
|
},
|
||||||
|
SH_ANIMATIONS_PLAY_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp();
|
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
// Project Includes
|
// Project Includes
|
||||||
#include "SH_API.h"
|
#include "SH_API.h"
|
||||||
#include "Resource/SHHandle.h"
|
#include "Resource/SHHandle.h"
|
||||||
|
#include "ECS_Base/SHECSMacros.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -162,7 +163,12 @@ namespace SHADE
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Runs a single update for the animation controller.
|
/// Runs a single update for the animation controller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Update(InstanceData& instData, float dt);
|
/// <param name="eid">
|
||||||
|
/// EntityID of the entity that this animation controller is updating.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="instData">Instance data that stores the current state.</param>
|
||||||
|
/// <param name="dt">Frame time.</param>
|
||||||
|
void Update(EntityID eid, InstanceData& instData, float dt);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Usage Functions */
|
/* Usage Functions */
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace SHADE
|
||||||
void SHAnimationSystem::UpdateRoutine::Execute(double dt) noexcept
|
void SHAnimationSystem::UpdateRoutine::Execute(double dt) noexcept
|
||||||
{
|
{
|
||||||
auto& animators = SHComponentManager::GetDense<SHAnimatorComponent>();
|
auto& animators = SHComponentManager::GetDense<SHAnimatorComponent>();
|
||||||
|
dt *= reinterpret_cast<SHAnimationSystem*>(system)->TimeScale;
|
||||||
for (auto& animator : animators)
|
for (auto& animator : animators)
|
||||||
{
|
{
|
||||||
animator.Update(dt);
|
animator.Update(dt);
|
||||||
|
|
|
@ -19,6 +19,11 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Forward Declaration */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
class SHAnimationClip;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Type Definitions */
|
/* Type Definitions */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -29,7 +34,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Type Definitions */
|
/* Type Definitions - System Routines */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Responsible for updating the playback of all animator components and computing
|
/// Responsible for updating the playback of all animator components and computing
|
||||||
|
@ -42,6 +47,57 @@ namespace SHADE
|
||||||
void Execute(double dt) noexcept override final;
|
void Execute(double dt) noexcept override final;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Type Definitions - Event Data */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Event data for the SH_ANIMATIONS_PLAY_EVENT event which is raised on the frame
|
||||||
|
/// that an animation has started playing.
|
||||||
|
/// </summary>
|
||||||
|
struct PlayEvent
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
Handle<SHAnimationClip> PlayingClip;
|
||||||
|
float CurrentTimeStamp;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Event data for the SH_ANIMATIONS_PAUSED_EVENT event which is raised on the frame
|
||||||
|
/// that an animation is paused.
|
||||||
|
/// </summary>
|
||||||
|
struct PausedEvent
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
Handle<SHAnimationClip> PausedClip;
|
||||||
|
float PauseTimeStamp;
|
||||||
|
};
|
||||||
|
/// <summary>
|
||||||
|
/// Event data for the SH_ANIMATIONS_FINISHED_EVENT event which is raised on the
|
||||||
|
/// frame that an animation has finished playing. This will not be called for any
|
||||||
|
/// animation that loops.
|
||||||
|
/// </summary>
|
||||||
|
struct FinishedEvent
|
||||||
|
{
|
||||||
|
EntityID Entity;
|
||||||
|
Handle<SHAnimationClip> FinishedClip;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Constants */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Default time scale used by the system.
|
||||||
|
/// </summary>
|
||||||
|
static constexpr double DEFAULT_TIME_SCALE = 1.0;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Public Data Members */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/// <summary>
|
||||||
|
/// Used by the system to multiply the given delta time to scale the animation
|
||||||
|
/// speed.
|
||||||
|
/// </summary>
|
||||||
|
double TimeScale = DEFAULT_TIME_SCALE;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* Constructors */
|
/* Constructors */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -25,6 +25,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||||
#include "Tools/SHDebugDraw.h"
|
#include "Tools/SHDebugDraw.h"
|
||||||
|
#include "Events/SHEventManager.hpp"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -35,6 +36,8 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
playOnce = false;
|
playOnce = false;
|
||||||
|
|
||||||
|
raisePlayEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHAnimatorComponent::Play(Handle<SHAnimationClip> clip)
|
void SHAnimatorComponent::Play(Handle<SHAnimationClip> clip)
|
||||||
|
@ -91,11 +94,13 @@ namespace SHADE
|
||||||
|
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
currPlaybackTime = 0.0f;
|
currPlaybackTime = 0.0f;
|
||||||
|
raisePlayEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHAnimatorComponent::Pause()
|
void SHAnimatorComponent::Pause()
|
||||||
{
|
{
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
|
raisePauseEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHAnimatorComponent::Stop()
|
void SHAnimatorComponent::Stop()
|
||||||
|
@ -119,9 +124,13 @@ namespace SHADE
|
||||||
std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity);
|
std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity);
|
||||||
|
|
||||||
// Do not do anything if is not playing or there's nothing to animate
|
// Do not do anything if is not playing or there's nothing to animate
|
||||||
if (!isPlaying || !rig || !rig->GetRootNode())
|
if (!rig || !rig->GetRootNode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// We want to still display a paused pose, so we only prevent progression
|
||||||
|
if (!isPlaying)
|
||||||
|
dt = 0.0f;
|
||||||
|
|
||||||
// Update the animation controller if any, this will set the currClip
|
// Update the animation controller if any, this will set the currClip
|
||||||
if (animController)
|
if (animController)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +219,20 @@ namespace SHADE
|
||||||
|
|
||||||
return animController->SetTrigger(animInstanceData, paramName);
|
return animController->SetTrigger(animInstanceData, paramName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Getter Functions */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
Handle<SHAnimationClip> SHAnimatorComponent::GetCurrentClip() const noexcept
|
||||||
|
{
|
||||||
|
if (animController)
|
||||||
|
{
|
||||||
|
return animInstanceData.CurrentNode ? animInstanceData.CurrentNode->Clip : Handle<SHAnimationClip>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return currClip;
|
||||||
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* Helper Functions - Update */
|
/* Helper Functions - Update */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
@ -221,7 +243,7 @@ namespace SHADE
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Update the animation controller
|
// Update the animation controller
|
||||||
animController->Update(animInstanceData, dt);
|
animController->Update(GetEID(), animInstanceData, dt);
|
||||||
|
|
||||||
// Get current clip
|
// Get current clip
|
||||||
currClip = animInstanceData.CurrentNode->Clip;
|
currClip = animInstanceData.CurrentNode->Clip;
|
||||||
|
@ -232,7 +254,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
void SHAnimatorComponent::updateManualClipState(float dt)
|
void SHAnimatorComponent::updateManualClipState(float dt)
|
||||||
{
|
{
|
||||||
currPlaybackTime += dt;
|
currPlaybackTime += dt * currClip->GetPlaybackSpeedMultiplier();
|
||||||
const float CLIP_CURR_PLAYED_TIME = currPlaybackTime - currClip->GetStartTimeStamp();
|
const float CLIP_CURR_PLAYED_TIME = currPlaybackTime - currClip->GetStartTimeStamp();
|
||||||
if (CLIP_CURR_PLAYED_TIME > currClip->GetTotalDuration())
|
if (CLIP_CURR_PLAYED_TIME > currClip->GetTotalDuration())
|
||||||
{
|
{
|
||||||
|
@ -241,6 +263,7 @@ namespace SHADE
|
||||||
playOnce = false;
|
playOnce = false;
|
||||||
isPlaying = false;
|
isPlaying = false;
|
||||||
currPlaybackTime = currClip->GetStartTimeStamp() + currClip->GetTotalDuration();
|
currPlaybackTime = currClip->GetStartTimeStamp() + currClip->GetTotalDuration();
|
||||||
|
raiseFinishEvent();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -251,7 +274,7 @@ namespace SHADE
|
||||||
void SHAnimatorComponent::updateCurrentAnimatorState(Handle<SHAnimationClip> clip, float playbackTime)
|
void SHAnimatorComponent::updateCurrentAnimatorState(Handle<SHAnimationClip> clip, float playbackTime)
|
||||||
{
|
{
|
||||||
// Nothing to animate
|
// Nothing to animate
|
||||||
if (!clip || !isPlaying || !rig || !rig->GetRootNode())
|
if (!clip || !rig || !rig->GetRootNode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check that we have animation data
|
// Check that we have animation data
|
||||||
|
@ -299,6 +322,50 @@ namespace SHADE
|
||||||
updatePoseWithClip(poseTime, rawAnimData, child, transformMatrix);
|
updatePoseWithClip(poseTime, rawAnimData, child, transformMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
/* Helper Functions - Event */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
void SHAnimatorComponent::raisePlayEvent()
|
||||||
|
{
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::PlayEvent
|
||||||
|
{
|
||||||
|
GetEID(),
|
||||||
|
GetCurrentClip(),
|
||||||
|
GetCurrentClipPlaybackTime()
|
||||||
|
},
|
||||||
|
SH_ANIMATIONS_PLAY_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHAnimatorComponent::raisePauseEvent()
|
||||||
|
{
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::PausedEvent
|
||||||
|
{
|
||||||
|
GetEID(),
|
||||||
|
GetCurrentClip(),
|
||||||
|
GetCurrentClipPlaybackTime()
|
||||||
|
},
|
||||||
|
SH_ANIMATIONS_PAUSED_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHAnimatorComponent::raiseFinishEvent()
|
||||||
|
{
|
||||||
|
SHEventManager::BroadcastEvent
|
||||||
|
(
|
||||||
|
SHAnimationSystem::FinishedEvent
|
||||||
|
{
|
||||||
|
GetEID(),
|
||||||
|
GetCurrentClip()
|
||||||
|
},
|
||||||
|
SH_ANIMATION_FINISHED_EVENT
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -24,6 +24,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Math/SHQuaternion.h"
|
#include "Math/SHQuaternion.h"
|
||||||
#include "SHRawAnimation.h"
|
#include "SHRawAnimation.h"
|
||||||
#include "SHAnimationController.h"
|
#include "SHAnimationController.h"
|
||||||
|
#include "SHAnimationSystem.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -166,6 +167,20 @@ namespace SHADE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returnsHandle to the currently set animtion controller.</returns>
|
/// <returnsHandle to the currently set animtion controller.</returns>
|
||||||
Handle<SHAnimationController> GetAnimationController() const noexcept { return animController; }
|
Handle<SHAnimationController> GetAnimationController() const noexcept { return animController; }
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the currently playing clip. If there is an Animation Controller, it
|
||||||
|
/// will be retrieved from it. Otherwise, the currently assigned Animation Clip is provided.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Handle to the currently playing Animation Clip if any.</returns>
|
||||||
|
Handle<SHAnimationClip> GetCurrentClip() const noexcept;
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the current timestamp of the currently playing clip. This is relative
|
||||||
|
/// to the start frame of the Animation Clip. This function will retrieve the correct
|
||||||
|
/// playback time depending on the current playback mode (Animation Controller or
|
||||||
|
/// Manual).
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Time in seconds of the current timestamp of the current clip.</returns>
|
||||||
|
float GetCurrentClipPlaybackTime() const noexcept { return animController ? animInstanceData.ClipPlaybackTime : currPlaybackTime; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
@ -201,6 +216,10 @@ namespace SHADE
|
||||||
void updatePoseWithClip(float poseTime, Handle<SHRawAnimation> rawAnimData, Handle<SHRigNode> node, const SHMatrix& parentMatrix);
|
void updatePoseWithClip(float poseTime, Handle<SHRawAnimation> rawAnimData, Handle<SHRigNode> node, const SHMatrix& parentMatrix);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T getInterpolatedValue(const std::vector<SHAnimationKeyFrame<T>>& keyframes, float poseTime);
|
T getInterpolatedValue(const std::vector<SHAnimationKeyFrame<T>>& keyframes, float poseTime);
|
||||||
|
// Event Functions
|
||||||
|
void raisePlayEvent();
|
||||||
|
void raisePauseEvent();
|
||||||
|
void raiseFinishEvent();
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
/* RTTR */
|
/* RTTR */
|
||||||
|
|
|
@ -25,12 +25,13 @@ namespace SHADE
|
||||||
std::string name;
|
std::string name;
|
||||||
uint32_t firstIndex;
|
uint32_t firstIndex;
|
||||||
uint32_t lastIndex;
|
uint32_t lastIndex;
|
||||||
|
float playbackMultiplier = 1.0f;
|
||||||
AssetID animRawDataAssetId; // Not serialised, only populated during runtime from parent asset
|
AssetID animRawDataAssetId; // Not serialised, only populated during runtime from parent asset
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SH_API SHAnimClipContainerAsset final : SHAssetData
|
struct SH_API SHAnimClipContainerAsset final : SHAssetData
|
||||||
{
|
{
|
||||||
AssetID animRawDataAssetId;
|
AssetID animRawDataAssetId;
|
||||||
std::vector<SHAnimClipAsset> clips{};
|
std::vector<SHAnimClipAsset*> clips{};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,20 +66,20 @@ namespace SHADE
|
||||||
|
|
||||||
for (auto const& clip : anim.clips)
|
for (auto const& clip : anim.clips)
|
||||||
{
|
{
|
||||||
uint32_t charCount {static_cast<uint32_t>(clip.name.size())};
|
uint32_t charCount {static_cast<uint32_t>(clip->name.size())};
|
||||||
file.write(
|
file.write(
|
||||||
reinterpret_cast<char const*>(&charCount),
|
reinterpret_cast<char const*>(&charCount),
|
||||||
sizeof(uint32_t)
|
sizeof(uint32_t)
|
||||||
);
|
);
|
||||||
|
|
||||||
file.write(
|
file.write(
|
||||||
clip.name.data(),
|
clip->name.data(),
|
||||||
charCount
|
charCount
|
||||||
);
|
);
|
||||||
|
|
||||||
file.write(
|
file.write(
|
||||||
reinterpret_cast<char const*>(&clip.firstIndex),
|
reinterpret_cast<char const*>(&clip->firstIndex),
|
||||||
sizeof(uint32_t) * 2
|
sizeof(uint32_t) * 3
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,28 +99,29 @@ namespace SHADE
|
||||||
reinterpret_cast<char*>(&size),
|
reinterpret_cast<char*>(&size),
|
||||||
sizeof(uint32_t)
|
sizeof(uint32_t)
|
||||||
);
|
);
|
||||||
|
data->clips.resize(size);
|
||||||
|
|
||||||
for (auto i{0}; i < size; ++i)
|
for (auto& clip : data->clips)
|
||||||
{
|
{
|
||||||
auto& clip {data->clips.emplace_back()};
|
clip = new SHAnimClipAsset;
|
||||||
uint32_t charCount;
|
uint32_t charCount;
|
||||||
file.read(
|
file.read(
|
||||||
reinterpret_cast<char*>(&charCount),
|
reinterpret_cast<char*>(&charCount),
|
||||||
sizeof(uint32_t)
|
sizeof(uint32_t)
|
||||||
);
|
);
|
||||||
|
|
||||||
clip.name.resize(charCount);
|
clip->name.resize(charCount);
|
||||||
file.read(
|
file.read(
|
||||||
clip.name.data(),
|
clip->name.data(),
|
||||||
charCount
|
charCount
|
||||||
);
|
);
|
||||||
|
|
||||||
file.read(
|
file.read(
|
||||||
reinterpret_cast<char*>(&clip.firstIndex),
|
reinterpret_cast<char*>(&clip->firstIndex),
|
||||||
sizeof(uint32_t) * 2
|
sizeof(uint32_t) * 3
|
||||||
);
|
);
|
||||||
|
|
||||||
clip.animRawDataAssetId = data->animRawDataAssetId;
|
clip->animRawDataAssetId = data->animRawDataAssetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = data;
|
result = data;
|
||||||
|
|
|
@ -313,11 +313,11 @@ namespace SHADE
|
||||||
.isSubAsset = true,
|
.isSubAsset = true,
|
||||||
.parent = parent
|
.parent = parent
|
||||||
};
|
};
|
||||||
auto& newClip {animContainer->clips.emplace_back()};
|
auto& newClip {animContainer->clips.emplace_back(new SHAnimClipAsset())};
|
||||||
newClip.name = name;
|
newClip->name = name;
|
||||||
assetCollection.emplace(id, asset);
|
assetCollection.emplace(id, asset);
|
||||||
assetCollection[parent].subAssets.push_back(&assetCollection[id]);
|
assetCollection[parent].subAssets.push_back(&assetCollection[id]);
|
||||||
assetData.emplace(id, &newClip);
|
assetData.emplace(id, newClip);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,6 +639,25 @@ namespace SHADE
|
||||||
assetData.emplace(asset.id, data);
|
assetData.emplace(asset.id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (asset.type)
|
||||||
|
{
|
||||||
|
case AssetType::ANIM_CONTAINER:
|
||||||
|
{
|
||||||
|
auto container = reinterpret_cast<SHAnimClipContainerAsset*>(data);
|
||||||
|
for (auto i{0}; i < asset.subAssets.size(); ++i)
|
||||||
|
{
|
||||||
|
assetData.emplace(
|
||||||
|
asset.subAssets[i]->id,
|
||||||
|
container->clips[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,7 +665,6 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
auto const& parent = assetCollection[asset.parent];
|
auto const& parent = assetCollection[asset.parent];
|
||||||
auto parentData = loaders[static_cast<size_t>(parent.type)]->Load(parent.path);
|
auto parentData = loaders[static_cast<size_t>(parent.type)]->Load(parent.path);
|
||||||
|
|
||||||
if (parentData == nullptr)
|
if (parentData == nullptr)
|
||||||
{
|
{
|
||||||
SHLOG_ERROR("[Asset Manager] Unable to load asset into memory: {}\n", parent.path.string());
|
SHLOG_ERROR("[Asset Manager] Unable to load asset into memory: {}\n", parent.path.string());
|
||||||
|
@ -676,7 +694,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
assetData.emplace(
|
assetData.emplace(
|
||||||
parent.subAssets[i]->id,
|
parent.subAssets[i]->id,
|
||||||
&parentContainer->clips[i]
|
parentContainer->clips[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -859,7 +877,7 @@ namespace SHADE
|
||||||
for(auto& clip : data->clips)
|
for(auto& clip : data->clips)
|
||||||
{
|
{
|
||||||
SHAsset subAsset{
|
SHAsset subAsset{
|
||||||
.name = clip.name,
|
.name = clip->name,
|
||||||
.id = GenerateAssetID(AssetType::ANIM_CLIP),
|
.id = GenerateAssetID(AssetType::ANIM_CLIP),
|
||||||
.type = AssetType::ANIM_CLIP,
|
.type = AssetType::ANIM_CLIP,
|
||||||
.isSubAsset = true,
|
.isSubAsset = true,
|
||||||
|
@ -869,7 +887,7 @@ namespace SHADE
|
||||||
assetCollection.emplace(subAsset.id, subAsset);
|
assetCollection.emplace(subAsset.id, subAsset);
|
||||||
assetCollection[newAsset.id].subAssets.push_back(&assetCollection[subAsset.id]);
|
assetCollection[newAsset.id].subAssets.push_back(&assetCollection[subAsset.id]);
|
||||||
|
|
||||||
assetData.emplace(subAsset.id, &clip);
|
assetData.emplace(subAsset.id, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHAssetMetaHandler::WriteMetaData(assetCollection[newAsset.id]);
|
SHAssetMetaHandler::WriteMetaData(assetCollection[newAsset.id]);
|
||||||
|
|
|
@ -115,6 +115,7 @@ namespace SHADE
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data());
|
||||||
|
LoadBank((AUDIO_FOLDER_PATH + "Cinematics.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data());
|
||||||
LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data());
|
LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data());
|
||||||
|
|
||||||
|
@ -133,11 +134,12 @@ namespace SHADE
|
||||||
const ReceiverPtr ON_PAUSE_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_PAUSE_RECEIVER);
|
const ReceiverPtr ON_PAUSE_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_PAUSE_RECEIVER);
|
||||||
SHEventManager::SubscribeTo(SH_EDITOR_ON_PAUSE_EVENT, ON_PAUSE_RECEIVER_PTR);
|
SHEventManager::SubscribeTo(SH_EDITOR_ON_PAUSE_EVENT, ON_PAUSE_RECEIVER_PTR);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
const std::shared_ptr ON_SCENE_EXIT_RECEIVER{ std::make_shared<SHEventReceiverSpec<SHAudioSystem>>(this, &SHAudioSystem::onSceneExit) };
|
const std::shared_ptr ON_SCENE_EXIT_RECEIVER{ std::make_shared<SHEventReceiverSpec<SHAudioSystem>>(this, &SHAudioSystem::onSceneExit) };
|
||||||
const ReceiverPtr ON_SCENE_EXIT_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_SCENE_EXIT_RECEIVER);
|
const ReceiverPtr ON_SCENE_EXIT_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_SCENE_EXIT_RECEIVER);
|
||||||
SHEventManager::SubscribeTo(SH_SCENE_EXIT_POST, ON_SCENE_EXIT_RECEIVER_PTR);
|
SHEventManager::SubscribeTo(SH_SCENE_EXIT_POST, ON_SCENE_EXIT_RECEIVER_PTR);
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHADE::SHAudioSystem::Run(double dt)
|
void SHADE::SHAudioSystem::Run(double dt)
|
||||||
|
@ -820,6 +822,16 @@ namespace SHADE
|
||||||
instance->setVolume(volume);
|
instance->setVolume(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AudioClip::GetDestroyOnSceneExit()
|
||||||
|
{
|
||||||
|
return destroyOnSceneExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioClip::SetDestroyOnSceneExit(bool value)
|
||||||
|
{
|
||||||
|
destroyOnSceneExit = value;
|
||||||
|
}
|
||||||
|
|
||||||
SHEventHandle SHAudioSystem::onStop(SHEventPtr onStopEvent)
|
SHEventHandle SHAudioSystem::onStop(SHEventPtr onStopEvent)
|
||||||
{
|
{
|
||||||
StopAllSounds();
|
StopAllSounds();
|
||||||
|
@ -839,7 +851,11 @@ namespace SHADE
|
||||||
auto [begin, end] = audioClipLibrary.GetDenseAccess();
|
auto [begin, end] = audioClipLibrary.GetDenseAccess();
|
||||||
for (auto& it = begin; it != end; ++it)
|
for (auto& it = begin; it != end; ++it)
|
||||||
{
|
{
|
||||||
it->instance->release();
|
if(it->destroyOnSceneExit)
|
||||||
|
{
|
||||||
|
it->instance->stop(FMOD_STUDIO_STOP_ALLOWFADEOUT);
|
||||||
|
it->instance->release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return onSceneExitEvent->handle;
|
return onSceneExitEvent->handle;
|
||||||
|
|
|
@ -37,10 +37,13 @@ namespace SHADE
|
||||||
float GetParameterValue(const char* paramName);
|
float GetParameterValue(const char* paramName);
|
||||||
float GetVolume();
|
float GetVolume();
|
||||||
void SetVolume(float volume);
|
void SetVolume(float volume);
|
||||||
|
bool GetDestroyOnSceneExit();
|
||||||
|
void SetDestroyOnSceneExit(bool value);
|
||||||
friend class SHAudioSystem;
|
friend class SHAudioSystem;
|
||||||
private:
|
private:
|
||||||
FMOD::Studio::EventInstance* instance = nullptr;
|
FMOD::Studio::EventInstance* instance = nullptr;
|
||||||
EntityID transformRef = MAX_EID;
|
EntityID transformRef = MAX_EID;
|
||||||
|
bool destroyOnSceneExit = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SH_API SHAudioSystem : public SHSystem
|
class SH_API SHAudioSystem : public SHSystem
|
||||||
|
|
|
@ -206,6 +206,16 @@ namespace SHADE
|
||||||
camera->dirtyView = true;
|
camera->dirtyView = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
camera->offset = offset;
|
||||||
|
|
||||||
|
SHVec3 tOffset = pivot.GetTargetOffset();
|
||||||
|
|
||||||
|
|
||||||
|
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(pivot.GetYaw()));
|
||||||
|
|
||||||
|
|
||||||
|
if (pivot.lookAtCameraOrigin)
|
||||||
|
CameraLookAt(*camera, camera->position + tOffset);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,7 +260,7 @@ namespace SHADE
|
||||||
if (camera.isActive == false)
|
if (camera.isActive == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && &camera != &editorCamera)
|
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && SHComponentManager::HasComponent<SHCameraArmComponent>(camera.GetEID()) == false && &camera != &editorCamera)
|
||||||
{
|
{
|
||||||
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID());
|
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID());
|
||||||
SHVec3 rotation = transform->GetWorldRotation();
|
SHVec3 rotation = transform->GetWorldRotation();
|
||||||
|
@ -273,14 +283,14 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
camera.offset = arm->GetOffset();
|
camera.offset = arm->GetOffset();
|
||||||
|
|
||||||
SHVec3 tOffset = arm->GetTargetOffset();
|
/*SHVec3 tOffset = arm->GetTargetOffset();
|
||||||
|
|
||||||
|
|
||||||
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw()));
|
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw()));
|
||||||
|
|
||||||
|
|
||||||
if (arm->lookAtCameraOrigin)
|
if (arm->lookAtCameraOrigin)
|
||||||
CameraLookAt(camera, camera.position + arm->GetTargetOffset());
|
CameraLookAt(camera, camera.position + arm->GetTargetOffset());*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace SHADE
|
||||||
newAssetName.clear();
|
newAssetName.clear();
|
||||||
firstIndex = 0;
|
firstIndex = 0;
|
||||||
lastIndex = rawAnimation->GetTotalFrames();
|
lastIndex = rawAnimation->GetTotalFrames();
|
||||||
|
playbackMultiplier = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assign callback
|
// Assign callback
|
||||||
|
@ -72,6 +73,9 @@ namespace SHADE
|
||||||
SHEditorUI::PushID(1);
|
SHEditorUI::PushID(1);
|
||||||
SHEditorUI::InputUnsignedInt("Last Frame Index", lastIndex);
|
SHEditorUI::InputUnsignedInt("Last Frame Index", lastIndex);
|
||||||
SHEditorUI::PopID();
|
SHEditorUI::PopID();
|
||||||
|
SHEditorUI::PushID(2);
|
||||||
|
SHEditorUI::InputFloat("Playback Multiplier", playbackMultiplier);
|
||||||
|
SHEditorUI::PopID();
|
||||||
|
|
||||||
// Invalid values
|
// Invalid values
|
||||||
const bool INVALID_CONFIG = newAssetName.empty() || firstIndex > lastIndex;
|
const bool INVALID_CONFIG = newAssetName.empty() || firstIndex > lastIndex;
|
||||||
|
@ -88,6 +92,7 @@ namespace SHADE
|
||||||
animClip->firstIndex = firstIndex;
|
animClip->firstIndex = firstIndex;
|
||||||
animClip->lastIndex = lastIndex;
|
animClip->lastIndex = lastIndex;
|
||||||
animClip->animRawDataAssetId = SHResourceManager::GetAssetID<SHRawAnimation>(rawAnimation).value_or(0);
|
animClip->animRawDataAssetId = SHResourceManager::GetAssetID<SHRawAnimation>(rawAnimation).value_or(0);
|
||||||
|
animClip->playbackMultiplier = playbackMultiplier;
|
||||||
SHAssetManager::SaveAsset(containerAsset->id);
|
SHAssetManager::SaveAsset(containerAsset->id);
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
|
@ -158,13 +163,17 @@ namespace SHADE
|
||||||
if (SHEditorUI::CollapsingHeader("Existing Animation Clips"))
|
if (SHEditorUI::CollapsingHeader("Existing Animation Clips"))
|
||||||
{
|
{
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
|
int i = 0;
|
||||||
for (auto animClip : childAnimClips)
|
for (auto animClip : childAnimClips)
|
||||||
{
|
{
|
||||||
|
ImGui::PushID(i++);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
std::optional<std::string> animClipName = SHResourceManager::GetAssetName<SHAnimationClip>(animClip);
|
std::optional<std::string> animClipName = SHResourceManager::GetAssetName<SHAnimationClip>(animClip);
|
||||||
|
|
||||||
int firstIndex = animClip->GetStartFrameIndex();
|
int firstIndex = animClip->GetStartFrameIndex();
|
||||||
int endIndex = animClip->GetEndFrameIndex();
|
int endIndex = animClip->GetEndFrameIndex();
|
||||||
|
float playbackMp = animClip->GetPlaybackSpeedMultiplier();
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text(animClipName.has_value() ? animClipName.value().c_str() : "");
|
ImGui::Text(animClipName.has_value() ? animClipName.value().c_str() : "");
|
||||||
|
@ -180,23 +189,32 @@ namespace SHADE
|
||||||
[&]() { return endIndex; },
|
[&]() { return endIndex; },
|
||||||
[&](int i) { endIndex = i; }
|
[&](int i) { endIndex = i; }
|
||||||
);
|
);
|
||||||
|
changed |= SHEditorWidgets::DragFloat
|
||||||
|
(
|
||||||
|
"Playback Multiplier",
|
||||||
|
[&]() { return playbackMp; },
|
||||||
|
[&](float f) { playbackMp = f; }
|
||||||
|
);
|
||||||
|
|
||||||
// If there's a change we need to commit changes
|
// If there's a change we need to commit changes
|
||||||
if (changed && firstIndex < endIndex)
|
if (changed && firstIndex < endIndex)
|
||||||
{
|
{
|
||||||
// Update runtime asset
|
// Update runtime asset
|
||||||
*animClip = SHAnimationClip(currRawAnim, firstIndex, endIndex);
|
*animClip = SHAnimationClip(currRawAnim, firstIndex, endIndex, playbackMp);
|
||||||
|
|
||||||
// Update serialized asset
|
// Update serialized asset
|
||||||
auto assetId = SHResourceManager::GetAssetID(animClip);
|
auto assetId = SHResourceManager::GetAssetID(animClip);
|
||||||
if (assetId.has_value())
|
if (assetId.has_value())
|
||||||
{
|
{
|
||||||
auto animAsset = SHAssetManager::GetData<SHAnimClipAsset>(assetId.value());
|
auto const animAsset = SHAssetManager::GetData<SHAnimClipAsset>(assetId.value());
|
||||||
animAsset->firstIndex = firstIndex;
|
animAsset->firstIndex = firstIndex;
|
||||||
animAsset->lastIndex = endIndex;
|
animAsset->lastIndex = endIndex;
|
||||||
SHAssetManager::SaveAsset(assetId.value());
|
animAsset->playbackMultiplier = playbackMp;
|
||||||
|
SHAssetManager::SaveAsset(containerAsset->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra separator if there is more than one
|
// Extra separator if there is more than one
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace SHADE
|
||||||
std::string newAssetName;
|
std::string newAssetName;
|
||||||
uint32_t firstIndex = 0;
|
uint32_t firstIndex = 0;
|
||||||
uint32_t lastIndex = 0;
|
uint32_t lastIndex = 0;
|
||||||
|
float playbackMultiplier = 1.0f;
|
||||||
Handle<SHRawAnimation> rawAnimation;
|
Handle<SHRawAnimation> rawAnimation;
|
||||||
SHAsset* containerAsset{nullptr};
|
SHAsset* containerAsset{nullptr};
|
||||||
SHAnimClipContainerAsset* container{nullptr};
|
SHAnimClipContainerAsset* container{nullptr};
|
||||||
|
|
|
@ -113,14 +113,15 @@ namespace SHADE
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHAssetBrowser>();
|
SHEditorWindowManager::CreateEditorWindow<SHAssetBrowser>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHMaterialInspector>();
|
SHEditorWindowManager::CreateEditorWindow<SHMaterialInspector>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHColliderTagPanel>();
|
SHEditorWindowManager::CreateEditorWindow<SHColliderTagPanel>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHInputBindingsPanel>();
|
SHEditorWindowManager::CreateEditorWindow<SHInputBindingsPanel>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
|
||||||
|
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
|
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHAnimationControllerEditor>();
|
SHEditorWindowManager::CreateEditorWindow<SHAnimationControllerEditor>();
|
||||||
SHEditorWindowManager::CreateEditorWindow<SHRawAnimInspector>();
|
SHEditorWindowManager::CreateEditorWindow<SHRawAnimInspector>();
|
||||||
|
|
||||||
|
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
||||||
|
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
|
||||||
|
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
||||||
|
|
||||||
//Add popup windows
|
//Add popup windows
|
||||||
SHEditorWindowManager::CreatePopupWindow<SHSceneSavePrompt>();
|
SHEditorWindowManager::CreatePopupWindow<SHSceneSavePrompt>();
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,6 @@ constexpr SHEventIdentifier SH_BUTTON_HOVER_ENTER_EVENT { 22 };
|
||||||
constexpr SHEventIdentifier SH_BUTTON_HOVER_EXIT_EVENT { 23 };
|
constexpr SHEventIdentifier SH_BUTTON_HOVER_EXIT_EVENT { 23 };
|
||||||
constexpr SHEventIdentifier SH_ASSET_COMPILE_EVENT { 24 };
|
constexpr SHEventIdentifier SH_ASSET_COMPILE_EVENT { 24 };
|
||||||
constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_DELETE_EVENT { 25 };
|
constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_DELETE_EVENT { 25 };
|
||||||
|
constexpr SHEventIdentifier SH_ANIMATIONS_PAUSED_EVENT { 26 };
|
||||||
|
constexpr SHEventIdentifier SH_ANIMATIONS_PLAY_EVENT { 27 };
|
||||||
|
constexpr SHEventIdentifier SH_ANIMATION_FINISHED_EVENT { 28 };
|
||||||
|
|
|
@ -726,16 +726,34 @@ namespace SHADE
|
||||||
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0);
|
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
if (IsAnimated())
|
||||||
if (instanceDataDescSet[frameIndex])
|
|
||||||
{
|
{
|
||||||
cmdBuffer->BindDescriptorSet
|
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM);
|
||||||
(
|
if (instanceDataDescSet[frameIndex])
|
||||||
instanceDataDescSet[frameIndex],
|
{
|
||||||
SH_PIPELINE_TYPE::GRAPHICS,
|
cmdBuffer->BindDescriptorSet
|
||||||
descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_BATCH),
|
(
|
||||||
dynamicOffset
|
instanceDataDescSet[frameIndex],
|
||||||
);
|
SH_PIPELINE_TYPE::GRAPHICS,
|
||||||
|
descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH),
|
||||||
|
dynamicOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
|
||||||
|
if (instanceDataDescSet[frameIndex])
|
||||||
|
{
|
||||||
|
cmdBuffer->BindDescriptorSet
|
||||||
|
(
|
||||||
|
instanceDataDescSet[frameIndex],
|
||||||
|
SH_PIPELINE_TYPE::GRAPHICS,
|
||||||
|
descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_BATCH),
|
||||||
|
dynamicOffset
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
|
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
|
||||||
cmdBuffer->EndLabeledSegment();
|
cmdBuffer->EndLabeledSegment();
|
||||||
|
|
|
@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
||||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||||
|
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
{
|
{
|
||||||
|
@ -108,11 +109,19 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHSuperBatch::Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline /*= true*/) noexcept
|
void SHSuperBatch::Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline /*= true*/, Handle<SHVkPipeline> nonAnimPipeline/* = {}*/, Handle<SHVkPipeline> animPipeline/* = {}*/) noexcept
|
||||||
{
|
{
|
||||||
// Build all batches
|
// Build all batches
|
||||||
for (auto& batch : batches)
|
for (auto& batch : batches)
|
||||||
{
|
{
|
||||||
|
if (!bindBatchPipeline)
|
||||||
|
{
|
||||||
|
if (batch.IsAnimated())
|
||||||
|
cmdBuffer->BindPipeline(animPipeline);
|
||||||
|
else
|
||||||
|
cmdBuffer->BindPipeline(nonAnimPipeline);
|
||||||
|
}
|
||||||
|
|
||||||
batch.Draw(cmdBuffer, frameIndex, bindBatchPipeline);
|
batch.Draw(cmdBuffer, frameIndex, bindBatchPipeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue