Merge branch 'main' into ControllerImplementation
This commit is contained in:
commit
0b967154ba
|
@ -1,4 +1,4 @@
|
|||
Start in Fullscreen: false
|
||||
Starting Scene ID: 91478134
|
||||
Starting Scene ID: 97158628
|
||||
Window Size: {x: 1920, y: 1080}
|
||||
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
|
||||
2 Food 1000000000000000
|
||||
3 Breakable 1100000000000000
|
||||
4 ScoringWallCollider 0110000000000000
|
||||
5 Homeowner 1100000000000000
|
||||
6 Camera 0010000000000000
|
||||
7 8 0000000000000000
|
||||
7 StaticWithCameraCollision 1110000000000000
|
||||
8 9 0000000000000000
|
||||
9 10 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}
|
||||
Layer: 4294967295
|
||||
Strength: 0
|
||||
Casting Shadows: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 1
|
||||
|
@ -73,10 +74,10 @@
|
|||
sceneID: 97158628
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 6
|
||||
|
@ -108,10 +109,10 @@
|
|||
Enabled: true
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 3
|
||||
|
@ -152,7 +153,7 @@
|
|||
NumberOfChildren: 0
|
||||
Components: ~
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.TweenManager
|
||||
- Type: TweenManager
|
||||
Enabled: true
|
||||
- EID: 450
|
||||
Name: TransitionCanvas
|
||||
|
|
|
@ -100,10 +100,10 @@
|
|||
sceneID: 91947920
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 6
|
||||
|
@ -135,10 +135,10 @@
|
|||
Enabled: true
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 7
|
||||
|
@ -168,10 +168,10 @@
|
|||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||
|
@ -204,10 +204,10 @@
|
|||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||
|
@ -240,10 +240,10 @@
|
|||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||
|
@ -276,10 +276,10 @@
|
|||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||
|
@ -338,7 +338,7 @@
|
|||
NumberOfChildren: 0
|
||||
Components: ~
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.TweenManager
|
||||
- Type: TweenManager
|
||||
Enabled: true
|
||||
- EID: 13
|
||||
Name: How To Play Canvas
|
||||
|
@ -429,10 +429,10 @@
|
|||
multiImageList: 15
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 17
|
||||
|
@ -466,10 +466,10 @@
|
|||
multiImageList: 15
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 18
|
||||
|
@ -502,10 +502,10 @@
|
|||
canvasToActivate: 0
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 19
|
||||
|
@ -576,10 +576,10 @@
|
|||
canvasToActivate: 0
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 22
|
||||
|
@ -1263,10 +1263,10 @@
|
|||
canvasToActivate: 0
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 49
|
||||
|
@ -1372,10 +1372,10 @@
|
|||
canvasToActivate: 0
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 53
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||
Layer: 4294967295
|
||||
Strength: 0
|
||||
Casting Shadows: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 1
|
||||
|
@ -73,10 +74,10 @@
|
|||
sceneID: 97158628
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 6
|
||||
|
@ -108,10 +109,10 @@
|
|||
Enabled: true
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: Empty
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
onHoverExitSound: Empty
|
||||
onClickSound: event:/UI/mouse_down_element
|
||||
onReleaseSound: Empty
|
||||
onClickSound: event:/UI/button_success
|
||||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 3
|
||||
|
@ -152,7 +153,7 @@
|
|||
NumberOfChildren: 0
|
||||
Components: ~
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.TweenManager
|
||||
- Type: TweenManager
|
||||
Enabled: true
|
||||
- EID: 450
|
||||
Name: TransitionCanvas
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
idleClip: 227450439
|
||||
runClip: 229125027
|
||||
pickUpClip: 219605278
|
||||
controlAniSys: true
|
||||
- EID: 1
|
||||
Name: Default
|
||||
IsActive: true
|
||||
|
@ -80,3 +81,4 @@
|
|||
idleClip: 0
|
||||
runClip: 0
|
||||
pickUpClip: 0
|
||||
controlAniSys: false
|
|
@ -13,6 +13,8 @@ namespace SHADE.Test
|
|||
private AnimationClipAsset runClip;
|
||||
[SerializeField]
|
||||
private AnimationClipAsset pickUpClip;
|
||||
[SerializeField]
|
||||
private bool controlAniSys = false;
|
||||
#endregion
|
||||
|
||||
#region Components
|
||||
|
@ -23,6 +25,10 @@ namespace SHADE.Test
|
|||
protected override void awake()
|
||||
{
|
||||
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()
|
||||
|
@ -52,6 +58,22 @@ namespace SHADE.Test
|
|||
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
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ public partial class Homeowner1 : BehaviourTree
|
|||
|
||||
//These should be somewhere else
|
||||
//Debug.Log("TESTING");
|
||||
AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
|
||||
AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
|
||||
//AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
|
||||
//AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
|
||||
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
|
||||
|
||||
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["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXHumming"], GameObject.EntityId);
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
|
||||
//AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
|
||||
AudioHandler.audioClipHandlers["SFXHumming"].Play();
|
||||
|
||||
if (aiInstance != null && aiInstance != this)
|
||||
|
|
|
@ -156,7 +156,7 @@ public partial class LeafSearch : BehaviourTreeNode
|
|||
|
||||
//Draw a ray, succeed if ray is unobstructed
|
||||
Vector3 eyePosition = transform.GlobalPosition + eyeOffset;
|
||||
BoxCollider playerCollider = player.GetValueOrDefault().GetComponent<Collider>().GetCollisionShape<BoxCollider>(0);
|
||||
Collider playerCollider = player.GetValueOrDefault().GetComponent<Collider>();
|
||||
if (playerCollider == null)
|
||||
{
|
||||
//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
|
||||
//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);
|
||||
RaycastHit sightRayHit = Physics.Raycast(sightRay, false, (ushort)65535)[0];
|
||||
//As of November 2022, RaycastHit contains only the FIRST object hit by
|
||||
|
|
|
@ -86,12 +86,17 @@ public class Item : Script
|
|||
|
||||
if (returnBack && !dontReturn)
|
||||
{
|
||||
if (rb)
|
||||
{
|
||||
rb.LinearVelocity = Vector3.Zero;
|
||||
rb.AngularVelocity = Vector3.Zero;
|
||||
rb.ClearForces();
|
||||
rb.ClearTorque();
|
||||
}
|
||||
|
||||
if(transform)
|
||||
transform.LocalPosition = firstPostion;
|
||||
|
||||
if (rb)
|
||||
rb.LinearVelocity = Vector3.Zero;
|
||||
|
||||
returnBack = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,38 @@ using System;
|
|||
|
||||
public class PlayerIdleState : BaseState
|
||||
{
|
||||
public PlayerIdleState(StateMachine stateMachine) : base(stateMachine)
|
||||
private bool holdItem;
|
||||
public PlayerIdleState(StateMachine stateMachine, bool hi) : base(stateMachine)
|
||||
{
|
||||
stateName = "Idle State";
|
||||
holdItem = hi;
|
||||
}
|
||||
public override void OnEnter()
|
||||
{
|
||||
//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()
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ public class PlayerJumpState : BaseState
|
|||
}
|
||||
public override void OnEnter()
|
||||
{
|
||||
//Debug.Log("WALK ENTER");
|
||||
//Debug.Log("jump");
|
||||
}
|
||||
public override void update()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
|
||||
public class PlayerRunState : BaseState
|
||||
|
@ -13,6 +14,13 @@ public class PlayerRunState : BaseState
|
|||
public override void OnEnter()
|
||||
{
|
||||
//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()
|
||||
{
|
||||
|
@ -21,7 +29,7 @@ public class PlayerRunState : BaseState
|
|||
|
||||
if (timer > delay)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
||||
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||
timer = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,44 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
|
||||
public class PlayerWalkState : BaseState
|
||||
{
|
||||
private float timer;
|
||||
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";
|
||||
holdItem = hi;
|
||||
}
|
||||
public override void OnEnter()
|
||||
{
|
||||
//Debug.Log("WALK ENTER");
|
||||
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()
|
||||
{
|
||||
|
@ -21,7 +47,7 @@ public class PlayerWalkState : BaseState
|
|||
|
||||
if (timer > delay)
|
||||
{
|
||||
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps");
|
||||
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||
timer = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,11 +34,6 @@ public class PickAndThrow : Script
|
|||
[Tooltip("Height of ray")]
|
||||
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()
|
||||
{
|
||||
pc = GetScript<PlayerController>();
|
||||
|
@ -85,7 +80,7 @@ public class PickAndThrow : Script
|
|||
pc.camArm.ArmLength = aimingLength;
|
||||
prevTargetOffSet = pc.camArm.TargetOffset;
|
||||
pc.camArm.TargetOffset = cameraArmOffSet;
|
||||
pc.cam.FOV = aimingFOV;
|
||||
pc.cam.FOV = Settings.cameraFOV + 5;
|
||||
}
|
||||
|
||||
if ((Input.GetMouseButtonUp(Input.MouseCode.LeftButton) || Input.GetBindingPositiveButtonUp("GrabThrow")) && pc.isAiming)
|
||||
|
@ -95,7 +90,7 @@ public class PickAndThrow : Script
|
|||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||
pc.isAiming = false;
|
||||
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||
pc.cam.FOV = defaultFOV;
|
||||
pc.cam.FOV = Settings.cameraFOV;
|
||||
if (tpc)
|
||||
pc.camArm.ArmLength = tpc.armLength;
|
||||
pc.holdItem = false;
|
||||
|
@ -116,7 +111,7 @@ public class PickAndThrow : Script
|
|||
if ((Input.GetMouseButtonDown(Input.MouseCode.RightButton) || Input.GetBindingPositiveButtonDown("Drop")) && pc.isAiming)
|
||||
{
|
||||
pc.isAiming = false;
|
||||
pc.cam.FOV = defaultFOV;
|
||||
pc.cam.FOV = Settings.cameraFOV;
|
||||
pc.camArm.TargetOffset = prevTargetOffSet;
|
||||
if (tpc)
|
||||
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 System;
|
||||
using System.Collections.Generic;
|
||||
using SHADE_Scripting.Audio;
|
||||
using static Item;
|
||||
|
||||
public class PlayerController : Script
|
||||
|
@ -32,7 +33,7 @@ public class PlayerController : Script
|
|||
private float delayTimer = 0.0f;
|
||||
|
||||
[Tooltip("The current state fo the raccoon")]
|
||||
public RaccoonStates currentState = RaccoonStates.IDLE;
|
||||
public RaccoonStates currentState;
|
||||
|
||||
//Movement variables============================================================
|
||||
[Tooltip("Max vel for walking")]
|
||||
|
@ -98,17 +99,17 @@ public class PlayerController : Script
|
|||
//rigidbody check
|
||||
rb = GetComponent<RigidBody>();
|
||||
if (!rb)
|
||||
Debug.LogError("RigidBody is NULL!");
|
||||
Debug.LogError("RigidBody is MISSING!");
|
||||
|
||||
//Transform check
|
||||
tranform = GetComponent<Transform>();
|
||||
if(!tranform)
|
||||
Debug.LogError("tranform is NULL!");
|
||||
Debug.LogError("tranform is MISSING!");
|
||||
|
||||
stateMachine = AddScript<StateMachine>();
|
||||
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
||||
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
|
||||
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine));
|
||||
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine, holdItem));
|
||||
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine, holdItem));
|
||||
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
|
||||
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
|
||||
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
|
||||
|
@ -131,6 +132,14 @@ public class PlayerController : Script
|
|||
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
|
||||
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()
|
||||
|
@ -167,8 +176,8 @@ public class PlayerController : Script
|
|||
if (!cam)
|
||||
{
|
||||
cam = GetComponentInChildren<Camera>();
|
||||
if(pat)
|
||||
cam.FOV = pat.defaultFOV;
|
||||
if (pat)
|
||||
cam.FOV = Settings.cameraFOV;
|
||||
}
|
||||
if(!camArm)
|
||||
camArm = GetComponentInChildren<CameraArm>();
|
||||
|
@ -327,6 +336,8 @@ public class PlayerController : Script
|
|||
if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad || Input.GetBindingPositiveButtonDown("Jump")) && isGrounded && rb != null)
|
||||
{
|
||||
currentState = RaccoonStates.JUMP;
|
||||
if (stateMachine && !stateMachine.IsState(typeof(PlayerJumpState)))
|
||||
stateMachine.SetState(typeof(PlayerJumpState));
|
||||
Vector3 v = rb.LinearVelocity;
|
||||
v.y = initialJumpVel * 0.5f;
|
||||
if (holdItem && pat != null && pat.item.GetScript<Item>() != null)
|
||||
|
@ -351,6 +362,9 @@ public class PlayerController : Script
|
|||
|
||||
if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space) || Input.GetBindingPositiveButtonUp("Jump")))
|
||||
currentState = RaccoonStates.FALLING;
|
||||
if (stateMachine && !stateMachine.IsState(typeof(PlayerFallState)))
|
||||
stateMachine.SetState(typeof(PlayerFallState));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -381,7 +395,11 @@ public class PlayerController : Script
|
|||
{
|
||||
isGrounded = true;
|
||||
if (currentState == RaccoonStates.FALLING)
|
||||
{
|
||||
currentState = RaccoonStates.LANDED;
|
||||
if (stateMachine && !stateMachine.IsState(typeof(PlayerLandState)))
|
||||
stateMachine.SetState(typeof(PlayerLandState));
|
||||
}
|
||||
}
|
||||
else
|
||||
isGrounded = false;
|
||||
|
@ -429,7 +447,7 @@ public class PlayerController : Script
|
|||
if (isAiming)
|
||||
{
|
||||
isAiming = false;
|
||||
cam.FOV = pat.defaultFOV;
|
||||
cam.FOV = Settings.cameraFOV;
|
||||
camArm.TargetOffset = pat.prevTargetOffSet;
|
||||
camArm.ArmLength = pat.tpc.armLength;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace SHADE_Scripting
|
|||
protected override void start()
|
||||
{
|
||||
GetComponent<CameraArm>().ArmLength = armLength;
|
||||
GetComponent<Camera>().FOV = Settings.cameraFOV;
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
|
|
|
@ -101,6 +101,8 @@ public class GameManager : Script
|
|||
|
||||
protected override void update()
|
||||
{
|
||||
|
||||
|
||||
if (GamePause || !stealFoodPopUpDone)
|
||||
{
|
||||
return;
|
||||
|
@ -195,6 +197,13 @@ public class GameManager : Script
|
|||
if (SceneFadeInOut.Instance != null)
|
||||
SceneFadeInOut.Instance.CallFadeIn();
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(Input.KeyCode.G))
|
||||
{
|
||||
ItemScored();
|
||||
Score += 500;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -219,6 +228,13 @@ public class GameManager : Script
|
|||
fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration);
|
||||
}
|
||||
|
||||
SingleScaleBounce sb = scoreText.GetScript<SingleScaleBounce>();
|
||||
if(sb)
|
||||
{
|
||||
sb.ScaleBounceOnce();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,15 +2,64 @@
|
|||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
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()
|
||||
{
|
||||
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)
|
||||
|
@ -20,7 +69,11 @@ public class JumpPad : Script
|
|||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
|
||||
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
|
||||
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
|
||||
landed = true;
|
||||
scaleYUp.Reset();
|
||||
scaleXZUp.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,6 @@ namespace SHADE_Scripting.UI
|
|||
if (listOfCamera.Count == 0)
|
||||
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()
|
||||
|
@ -52,6 +47,11 @@ namespace SHADE_Scripting.UI
|
|||
if (gameplayCanvas)
|
||||
gameplayCanvas.SetActive(false);
|
||||
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()
|
||||
|
@ -135,7 +135,7 @@ namespace SHADE_Scripting.UI
|
|||
{
|
||||
if (reset3)
|
||||
{
|
||||
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
|
||||
moveToEndPoint3.Reset();
|
||||
reset3 = false;
|
||||
}
|
||||
listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue();
|
||||
|
|
|
@ -4,18 +4,14 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting
|
||||
static public class Settings
|
||||
{
|
||||
static public class Settings
|
||||
{
|
||||
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 sfxVolume = 100.0f;
|
||||
static public float bgmVolume = 100.0f;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,6 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting.UI
|
||||
{
|
||||
|
||||
public enum EASING_METHOD
|
||||
{
|
||||
EASE_IN_SINE,
|
||||
|
@ -16,8 +13,8 @@ namespace SHADE_Scripting.UI
|
|||
EASE_INOUT_BOUNCE
|
||||
}
|
||||
|
||||
public static class EasingHelper
|
||||
{
|
||||
public static class EasingHelper
|
||||
{
|
||||
|
||||
public static float EaseHelp(float value, EASING_METHOD method)
|
||||
{
|
||||
|
@ -26,15 +23,18 @@ namespace SHADE_Scripting.UI
|
|||
case EASING_METHOD.EASE_IN_SINE:
|
||||
{
|
||||
return EaseInSine(value);
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
case EASING_METHOD.EASE_OUT_SINE:
|
||||
{
|
||||
return EaseOutSine(value);
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
case EASING_METHOD.EASE_OUT_BOUNCE:
|
||||
{
|
||||
return EaseOutBounce(value);
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
case EASING_METHOD.EASE_IN_BOUNCE:
|
||||
{
|
||||
return EaseInBounce(value);
|
||||
|
@ -53,13 +53,13 @@ namespace SHADE_Scripting.UI
|
|||
private static float EaseInSine(float value)
|
||||
{
|
||||
|
||||
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f) ));
|
||||
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) );
|
||||
return (float)(Math.Sin(value * Math.PI / 2.0f));
|
||||
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,8 @@ namespace SHADE_Scripting.UI
|
|||
if (value < 1.0f / d1)
|
||||
{
|
||||
return n1 * value * value;
|
||||
} else if (value < 2.0f / d1)
|
||||
}
|
||||
else if (value < 2.0f / d1)
|
||||
{
|
||||
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
|
||||
}
|
||||
|
@ -91,9 +92,9 @@ namespace SHADE_Scripting.UI
|
|||
private static float EaseInOutBounce(float value)
|
||||
{
|
||||
return (value < 0.5f)
|
||||
?(1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
|
||||
? (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 string onHoverEnterSound = "Empty";
|
||||
public string onHoverEnterSound = "event:/UI/botton_hover";
|
||||
public string onHoverExitSound = "Empty";
|
||||
public string onClickSound = "event:/UI/mouse_down_element";
|
||||
public string onReleaseSound = "Empty";
|
||||
public string onClickSound = "event:/UI/button_success";
|
||||
public string onReleaseSound = "event:/UI/button_fail";
|
||||
|
||||
[NonSerialized]
|
||||
private AudioClipHandler onHoverEnterACHandler;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SHADE;
|
||||
|
||||
using SHADE_Scripting.Audio;
|
||||
|
||||
public class CutsceneEnd : Script
|
||||
{
|
||||
|
@ -58,6 +58,17 @@ public class CutsceneEnd : Script
|
|||
{
|
||||
initCutscene4();
|
||||
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()
|
||||
|
@ -70,6 +81,11 @@ public class CutsceneEnd : Script
|
|||
skip = true;
|
||||
oldDuration = duration;
|
||||
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)
|
||||
|
@ -90,6 +106,11 @@ public class CutsceneEnd : Script
|
|||
{
|
||||
if (canvas4.IsActiveSelf)
|
||||
{
|
||||
if(time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene4Run"].Play();
|
||||
}
|
||||
if (showPic4a)
|
||||
{
|
||||
if (time < duration)
|
||||
|
@ -116,6 +137,10 @@ public class CutsceneEnd : Script
|
|||
|
||||
if (showPic4b)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
|
||||
|
@ -140,6 +165,10 @@ public class CutsceneEnd : Script
|
|||
|
||||
if (showPic4c)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
|
||||
|
@ -171,6 +200,10 @@ public class CutsceneEnd : Script
|
|||
{
|
||||
if (showPic5a)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
|
||||
|
@ -195,6 +228,11 @@ public class CutsceneEnd : Script
|
|||
|
||||
if (showPic5b)
|
||||
{
|
||||
if (time == 0)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene5Yay"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SHADE;
|
||||
|
||||
using SHADE_Scripting.Audio;
|
||||
|
||||
public class CutsceneIntro : Script
|
||||
{
|
||||
|
@ -87,6 +87,24 @@ public class CutsceneIntro : Script
|
|||
initCutscene1();
|
||||
initCutscene2();
|
||||
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()
|
||||
|
@ -98,6 +116,16 @@ public class CutsceneIntro : Script
|
|||
if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
|
||||
{
|
||||
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;
|
||||
duration = skipDuration;
|
||||
}
|
||||
|
@ -128,6 +156,10 @@ public class CutsceneIntro : Script
|
|||
{
|
||||
if (canvas1.IsActiveSelf)
|
||||
{
|
||||
if(time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
}
|
||||
if (showPic1a)
|
||||
{
|
||||
if (time < duration)
|
||||
|
@ -154,6 +186,10 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic1b)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
|
||||
|
@ -178,6 +214,10 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic1c)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
|
||||
|
@ -209,6 +249,11 @@ public class CutsceneIntro : Script
|
|||
{
|
||||
if (showPic2a)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene2Stomach"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
|
||||
|
@ -233,6 +278,11 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic2b)
|
||||
{
|
||||
if(time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene2Alert"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
|
||||
|
@ -257,6 +307,11 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic2c)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
|
||||
|
@ -288,6 +343,11 @@ public class CutsceneIntro : Script
|
|||
{
|
||||
if (showPic3a)
|
||||
{
|
||||
if(time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene3Jump"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
|
||||
|
@ -312,6 +372,11 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic3b)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
|
||||
|
@ -336,6 +401,11 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic3c)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene3Carry"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
|
||||
|
@ -360,6 +430,11 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic3d)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene3Throw"].Play();
|
||||
}
|
||||
if (time < duration)
|
||||
{
|
||||
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
|
||||
|
@ -384,6 +459,11 @@ public class CutsceneIntro : Script
|
|||
|
||||
if (showPic3e)
|
||||
{
|
||||
if (time == 0 && !skip)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
|
||||
AudioHandler.audioClipHandlers["cutscene3Yay"].Play();
|
||||
}
|
||||
if (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()
|
||||
{
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||
//AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||
//AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
|
@ -27,28 +27,28 @@ public class EndScene : Script
|
|||
if (Input.GetKeyDown(Input.KeyCode.R))
|
||||
{
|
||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||
//AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||
}
|
||||
if (Input.GetKeyUp(Input.KeyCode.R))
|
||||
{
|
||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
//Audio.StopAllSounds();
|
||||
AudioHandler.StopAllSounds(false);
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||
//AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||
SceneManager.ChangeScene(mainGameScene);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(Input.KeyCode.M))
|
||||
{
|
||||
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||
//AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
|
||||
}
|
||||
if (Input.GetKeyUp(Input.KeyCode.M))
|
||||
{
|
||||
//Audio.PlaySFXOnce2D("event:/UI/success");
|
||||
//Audio.StopAllSounds();
|
||||
AudioHandler.StopAllSounds(false);
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||
//AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
|
||||
SceneManager.ChangeScene(mainMainScene);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ public class MainMenu : Script
|
|||
Input.LoadBindings();
|
||||
|
||||
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
|
||||
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||
//AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
|
||||
//AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
|
||||
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
|
||||
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace SHADE_Scripting.UI
|
||||
{
|
||||
public class Options:Script
|
||||
public class Options : Script
|
||||
{
|
||||
public GameObject masterVolSlider;
|
||||
public GameObject sfxVolSlider;
|
||||
|
@ -31,7 +31,6 @@ namespace SHADE_Scripting.UI
|
|||
if (mv != null)
|
||||
{
|
||||
mv.ScaledValue = Settings.masterVolume;
|
||||
|
||||
}
|
||||
if (sfx != null)
|
||||
{
|
||||
|
@ -66,17 +65,21 @@ namespace SHADE_Scripting.UI
|
|||
Slider fov = fovSlider.GetComponent<Slider>();
|
||||
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
||||
|
||||
if(mv != null)
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ public class PauseMenu : Script
|
|||
if (canvas)
|
||||
canvas.SetActive(false);
|
||||
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -69,6 +70,8 @@ public class PauseMenu : Script
|
|||
GameManager.Instance.GamePause = false;
|
||||
GameManager.Instance.stealFoodPopUpDone = false;
|
||||
GameManager.Instance.PreviewLevelDone = false;
|
||||
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -82,6 +85,8 @@ public class PauseMenu : Script
|
|||
quit.OnRelease.RegisterAction(() =>
|
||||
{
|
||||
Audio.StopAllSounds();
|
||||
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
|
||||
//go to main menu
|
||||
SceneManager.ChangeScene(97158628);
|
||||
});
|
||||
|
@ -106,6 +111,7 @@ public class PauseMenu : Script
|
|||
if (canvas)
|
||||
canvas.SetActive(true);
|
||||
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
|
|
@ -52,14 +52,17 @@ namespace SHADE_Scripting.UI
|
|||
protected override void update()
|
||||
{
|
||||
if (!GameManager.Instance.PreviewLevelDone)
|
||||
{
|
||||
if (rot != null && scaleX != null && scaleY != null)
|
||||
{
|
||||
rot.Reset();
|
||||
scaleX.Reset();
|
||||
scaleY.Reset();
|
||||
}
|
||||
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.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1);
|
||||
|
@ -71,7 +74,7 @@ namespace SHADE_Scripting.UI
|
|||
stayDone = true;
|
||||
}
|
||||
|
||||
if (rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
|
||||
if (rot != null && scaleX != null && scaleY != null && rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
|
||||
popInDone = true;
|
||||
|
||||
if (stayDone)
|
||||
|
@ -82,8 +85,11 @@ namespace SHADE_Scripting.UI
|
|||
scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE);
|
||||
createThreadOnce = false;
|
||||
}
|
||||
|
||||
if(scaleOutX != null && scaleOutY != null)
|
||||
tran.LocalScale = new Vector3(scaleOutX.GetValue(), scaleOutY.GetValue(), 1);
|
||||
if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
|
||||
|
||||
if (scaleOutX != null && scaleOutY != null && scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
|
||||
{
|
||||
GameObject.SetActive(false);
|
||||
GameManager.Instance.stealFoodPopUpDone = true;
|
||||
|
|
|
@ -4,12 +4,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
namespace SHADE_Scripting.UI
|
||||
public class TweenThread
|
||||
{
|
||||
|
||||
public class TweenThread
|
||||
{
|
||||
private float timer = 0.0f;
|
||||
public float duration = 1.0f;
|
||||
public EASING_METHOD method;
|
||||
|
@ -32,7 +28,7 @@ namespace SHADE_Scripting.UI
|
|||
if (timer >= duration)
|
||||
timer = duration;
|
||||
|
||||
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
|
||||
value = EasingHelper.EaseHelp(timer / duration, method) * (endValue - startValue) + startValue;
|
||||
}
|
||||
public bool IsCompleted()
|
||||
{
|
||||
|
@ -60,11 +56,11 @@ namespace SHADE_Scripting.UI
|
|||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class TweenThreadVec3
|
||||
{
|
||||
public class TweenThreadVec3
|
||||
{
|
||||
private float timer = 0.0f;
|
||||
public float duration = 1.0f;
|
||||
public EASING_METHOD method;
|
||||
|
@ -115,12 +111,12 @@ namespace SHADE_Scripting.UI
|
|||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class TweenManager : Script
|
||||
{
|
||||
public class TweenManager : Script
|
||||
{
|
||||
public static TweenManager Instance { get; private set; }
|
||||
|
||||
[NonSerialized]
|
||||
|
@ -167,7 +163,6 @@ namespace SHADE_Scripting.UI
|
|||
if (Instance == null)
|
||||
return null;
|
||||
|
||||
|
||||
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
|
||||
Instance.threadList.Add(thread);
|
||||
thread.Reset();
|
||||
|
@ -187,7 +182,4 @@ namespace SHADE_Scripting.UI
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,17 +15,14 @@ public abstract class BaseState
|
|||
}
|
||||
|
||||
public virtual void OnEnter()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
public abstract void update();
|
||||
|
||||
public abstract void fixedUpdate();
|
||||
|
||||
public virtual void OnExit()
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
public string GetStateName()
|
||||
{
|
||||
|
@ -37,11 +34,6 @@ public abstract class BaseState
|
|||
return animationName;
|
||||
}
|
||||
|
||||
public virtual float GetAnimPercent()
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
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 = 4) in mat4 worldTransform;
|
||||
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
|
||||
{
|
||||
|
|
|
@ -40,6 +40,12 @@ layout(set = 1, binding = 0) uniform CameraData
|
|||
mat4 projMat;
|
||||
} cameraData;
|
||||
|
||||
layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices
|
||||
{
|
||||
mat4 data[];
|
||||
} BoneMatrices;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
Out2.materialIndex = gl_InstanceIndex;
|
||||
|
@ -63,6 +69,13 @@ void main()
|
|||
Out.normal.rgb = transposeInv * aNormal.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
|
||||
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
|
|
@ -24,15 +24,13 @@ project "SHADE_CSharp"
|
|||
{
|
||||
"SHADE_Engine"
|
||||
}
|
||||
|
||||
warnings 'Extra'
|
||||
|
||||
postbuildcommands
|
||||
{
|
||||
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.xml\" \"%{outputdir}\"",
|
||||
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.pdb\" \"%{outputdir}\""
|
||||
"xcopy /r /y /q \"%{wks.location}/bin/$(Configuration)\\net5.0\\SHADE_CSharp.pdb\" \"%{wks.location}/bin/$(Configuration)\""
|
||||
}
|
||||
|
||||
warnings 'Extra'
|
||||
|
||||
filter "configurations:Debug"
|
||||
symbols "On"
|
||||
defines {"_DEBUG"}
|
||||
|
|
|
@ -31,8 +31,7 @@ namespace SHADE
|
|||
return;
|
||||
|
||||
const float SECS_PER_TICK = 1.0f / static_cast<float>(rawAnim->GetTicksPerSecond());
|
||||
const int ONE_PAST_LAST_FRAME = lastFrame + 1;
|
||||
duration = static_cast<float>(ONE_PAST_LAST_FRAME - firstFrame) * SECS_PER_TICK;
|
||||
duration = static_cast<float>(lastFrame - firstFrame) * SECS_PER_TICK;
|
||||
startTimeStamp = static_cast<float>(firstFrame) * SECS_PER_TICK;
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "SHAnimationSystem.h"
|
||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||
#include "SHAnimationClip.h"
|
||||
#include "Events/SHEventManager.hpp"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -55,7 +56,7 @@ namespace SHADE
|
|||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Lifecycle Functions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void SHAnimationController::Update(InstanceData& instData, float dt)
|
||||
void SHAnimationController::Update(EntityID eid, InstanceData& instData, float dt)
|
||||
{
|
||||
// Is there a valid node
|
||||
if (!instData.CurrentNode)
|
||||
|
@ -72,6 +73,7 @@ namespace SHADE
|
|||
instData.ClipPlaybackTime = instData.CurrentNode->Clip->GetStartTimeStamp() + instData.CurrentNode->Clip->GetTotalDuration();
|
||||
|
||||
// Go to next state
|
||||
Handle<SHAnimationClip> originalClip = instData.CurrentNode->Clip;
|
||||
bool stateChanged = false;
|
||||
for (const auto& transition : instData.CurrentNode->Transitions)
|
||||
{
|
||||
|
@ -107,7 +109,29 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
// Project Includes
|
||||
#include "SH_API.h"
|
||||
#include "Resource/SHHandle.h"
|
||||
#include "ECS_Base/SHECSMacros.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -162,7 +163,12 @@ namespace SHADE
|
|||
/// <summary>
|
||||
/// Runs a single update for the animation controller.
|
||||
/// </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 */
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace SHADE
|
|||
void SHAnimationSystem::UpdateRoutine::Execute(double dt) noexcept
|
||||
{
|
||||
auto& animators = SHComponentManager::GetDense<SHAnimatorComponent>();
|
||||
dt *= reinterpret_cast<SHAnimationSystem*>(system)->TimeScale;
|
||||
for (auto& animator : animators)
|
||||
{
|
||||
animator.Update(dt);
|
||||
|
|
|
@ -19,6 +19,11 @@ of DigiPen Institute of Technology is prohibited.
|
|||
|
||||
namespace SHADE
|
||||
{
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Forward Declaration */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
class SHAnimationClip;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -29,7 +34,7 @@ namespace SHADE
|
|||
{
|
||||
public:
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Type Definitions */
|
||||
/* Type Definitions - System Routines */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/// <summary>
|
||||
/// Responsible for updating the playback of all animator components and computing
|
||||
|
@ -42,6 +47,57 @@ namespace SHADE
|
|||
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 */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -25,6 +25,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||
#include "Tools/SHDebugDraw.h"
|
||||
#include "Events/SHEventManager.hpp"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -35,6 +36,8 @@ namespace SHADE
|
|||
{
|
||||
isPlaying = true;
|
||||
playOnce = false;
|
||||
|
||||
raisePlayEvent();
|
||||
}
|
||||
|
||||
void SHAnimatorComponent::Play(Handle<SHAnimationClip> clip)
|
||||
|
@ -91,11 +94,13 @@ namespace SHADE
|
|||
|
||||
isPlaying = true;
|
||||
currPlaybackTime = 0.0f;
|
||||
raisePlayEvent();
|
||||
}
|
||||
|
||||
void SHAnimatorComponent::Pause()
|
||||
{
|
||||
isPlaying = false;
|
||||
raisePauseEvent();
|
||||
}
|
||||
|
||||
void SHAnimatorComponent::Stop()
|
||||
|
@ -119,9 +124,13 @@ namespace SHADE
|
|||
std::fill(boneMatrices.begin(), boneMatrices.end(), SHMatrix::Identity);
|
||||
|
||||
// Do not do anything if is not playing or there's nothing to animate
|
||||
if (!isPlaying || !rig || !rig->GetRootNode())
|
||||
if (!rig || !rig->GetRootNode())
|
||||
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
|
||||
if (animController)
|
||||
{
|
||||
|
@ -211,6 +220,19 @@ namespace SHADE
|
|||
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 */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
@ -221,7 +243,7 @@ namespace SHADE
|
|||
return;
|
||||
|
||||
// Update the animation controller
|
||||
animController->Update(animInstanceData, dt);
|
||||
animController->Update(GetEID(), animInstanceData, dt);
|
||||
|
||||
// Get current clip
|
||||
currClip = animInstanceData.CurrentNode->Clip;
|
||||
|
@ -241,6 +263,7 @@ namespace SHADE
|
|||
playOnce = false;
|
||||
isPlaying = false;
|
||||
currPlaybackTime = currClip->GetStartTimeStamp() + currClip->GetTotalDuration();
|
||||
raiseFinishEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -251,7 +274,7 @@ namespace SHADE
|
|||
void SHAnimatorComponent::updateCurrentAnimatorState(Handle<SHAnimationClip> clip, float playbackTime)
|
||||
{
|
||||
// Nothing to animate
|
||||
if (!clip || !isPlaying || !rig || !rig->GetRootNode())
|
||||
if (!clip || !rig || !rig->GetRootNode())
|
||||
return;
|
||||
|
||||
// Check that we have animation data
|
||||
|
@ -299,6 +322,50 @@ namespace SHADE
|
|||
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 "SHRawAnimation.h"
|
||||
#include "SHAnimationController.h"
|
||||
#include "SHAnimationSystem.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -166,6 +167,20 @@ namespace SHADE
|
|||
/// </summary>
|
||||
/// <returnsHandle to the currently set animtion controller.</returns>
|
||||
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:
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
|
@ -201,6 +216,10 @@ namespace SHADE
|
|||
void updatePoseWithClip(float poseTime, Handle<SHRawAnimation> rawAnimData, Handle<SHRigNode> node, const SHMatrix& parentMatrix);
|
||||
template<typename T>
|
||||
T getInterpolatedValue(const std::vector<SHAnimationKeyFrame<T>>& keyframes, float poseTime);
|
||||
// Event Functions
|
||||
void raisePlayEvent();
|
||||
void raisePauseEvent();
|
||||
void raiseFinishEvent();
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* RTTR */
|
||||
|
|
|
@ -31,6 +31,6 @@ namespace SHADE
|
|||
struct SH_API SHAnimClipContainerAsset final : SHAssetData
|
||||
{
|
||||
AssetID animRawDataAssetId;
|
||||
std::vector<SHAnimClipAsset> clips{};
|
||||
std::vector<SHAnimClipAsset*> clips{};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -66,19 +66,19 @@ namespace SHADE
|
|||
|
||||
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(
|
||||
reinterpret_cast<char const*>(&charCount),
|
||||
sizeof(uint32_t)
|
||||
);
|
||||
|
||||
file.write(
|
||||
clip.name.data(),
|
||||
clip->name.data(),
|
||||
charCount
|
||||
);
|
||||
|
||||
file.write(
|
||||
reinterpret_cast<char const*>(&clip.firstIndex),
|
||||
reinterpret_cast<char const*>(&clip->firstIndex),
|
||||
sizeof(uint32_t) * 2
|
||||
);
|
||||
}
|
||||
|
@ -99,28 +99,29 @@ namespace SHADE
|
|||
reinterpret_cast<char*>(&size),
|
||||
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;
|
||||
file.read(
|
||||
reinterpret_cast<char*>(&charCount),
|
||||
sizeof(uint32_t)
|
||||
);
|
||||
|
||||
clip.name.resize(charCount);
|
||||
clip->name.resize(charCount);
|
||||
file.read(
|
||||
clip.name.data(),
|
||||
clip->name.data(),
|
||||
charCount
|
||||
);
|
||||
|
||||
file.read(
|
||||
reinterpret_cast<char*>(&clip.firstIndex),
|
||||
reinterpret_cast<char*>(&clip->firstIndex),
|
||||
sizeof(uint32_t) * 2
|
||||
);
|
||||
|
||||
clip.animRawDataAssetId = data->animRawDataAssetId;
|
||||
clip->animRawDataAssetId = data->animRawDataAssetId;
|
||||
}
|
||||
|
||||
result = data;
|
||||
|
|
|
@ -314,10 +314,10 @@ namespace SHADE
|
|||
.parent = parent
|
||||
};
|
||||
auto& newClip {animContainer->clips.emplace_back()};
|
||||
newClip.name = name;
|
||||
newClip->name = name;
|
||||
assetCollection.emplace(id, asset);
|
||||
assetCollection[parent].subAssets.push_back(&assetCollection[id]);
|
||||
assetData.emplace(id, &newClip);
|
||||
assetData.emplace(id, newClip);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -639,6 +639,25 @@ namespace SHADE
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -646,7 +665,6 @@ namespace SHADE
|
|||
{
|
||||
auto const& parent = assetCollection[asset.parent];
|
||||
auto parentData = loaders[static_cast<size_t>(parent.type)]->Load(parent.path);
|
||||
|
||||
if (parentData == nullptr)
|
||||
{
|
||||
SHLOG_ERROR("[Asset Manager] Unable to load asset into memory: {}\n", parent.path.string());
|
||||
|
@ -676,7 +694,7 @@ namespace SHADE
|
|||
{
|
||||
assetData.emplace(
|
||||
parent.subAssets[i]->id,
|
||||
&parentContainer->clips[i]
|
||||
parentContainer->clips[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -859,7 +877,7 @@ namespace SHADE
|
|||
for(auto& clip : data->clips)
|
||||
{
|
||||
SHAsset subAsset{
|
||||
.name = clip.name,
|
||||
.name = clip->name,
|
||||
.id = GenerateAssetID(AssetType::ANIM_CLIP),
|
||||
.type = AssetType::ANIM_CLIP,
|
||||
.isSubAsset = true,
|
||||
|
@ -869,7 +887,7 @@ namespace SHADE
|
|||
assetCollection.emplace(subAsset.id, subAsset);
|
||||
assetCollection[newAsset.id].subAssets.push_back(&assetCollection[subAsset.id]);
|
||||
|
||||
assetData.emplace(subAsset.id, &clip);
|
||||
assetData.emplace(subAsset.id, clip);
|
||||
}
|
||||
|
||||
SHAssetMetaHandler::WriteMetaData(assetCollection[newAsset.id]);
|
||||
|
|
|
@ -115,6 +115,7 @@ namespace SHADE
|
|||
LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data());
|
||||
LoadBank((AUDIO_FOLDER_PATH + "Master.strings.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 + "UI.bank").data());
|
||||
|
||||
|
@ -133,11 +134,12 @@ namespace SHADE
|
|||
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);
|
||||
|
||||
#endif
|
||||
|
||||
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);
|
||||
SHEventManager::SubscribeTo(SH_SCENE_EXIT_POST, ON_SCENE_EXIT_RECEIVER_PTR);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void SHADE::SHAudioSystem::Run(double dt)
|
||||
|
@ -839,6 +841,7 @@ namespace SHADE
|
|||
auto [begin, end] = audioClipLibrary.GetDenseAccess();
|
||||
for (auto& it = begin; it != end; ++it)
|
||||
{
|
||||
it->instance->stop(FMOD_STUDIO_STOP_ALLOWFADEOUT);
|
||||
it->instance->release();
|
||||
}
|
||||
|
||||
|
|
|
@ -206,6 +206,16 @@ namespace SHADE
|
|||
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)
|
||||
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());
|
||||
SHVec3 rotation = transform->GetWorldRotation();
|
||||
|
@ -273,14 +283,14 @@ namespace SHADE
|
|||
{
|
||||
camera.offset = arm->GetOffset();
|
||||
|
||||
SHVec3 tOffset = arm->GetTargetOffset();
|
||||
/*SHVec3 tOffset = arm->GetTargetOffset();
|
||||
|
||||
|
||||
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw()));
|
||||
|
||||
|
||||
if (arm->lookAtCameraOrigin)
|
||||
CameraLookAt(camera, camera.position + arm->GetTargetOffset());
|
||||
CameraLookAt(camera, camera.position + arm->GetTargetOffset());*/
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -158,8 +158,11 @@ namespace SHADE
|
|||
if (SHEditorUI::CollapsingHeader("Existing Animation Clips"))
|
||||
{
|
||||
ImGui::Indent();
|
||||
int i = 0;
|
||||
for (auto animClip : childAnimClips)
|
||||
{
|
||||
ImGui::PushID(i++);
|
||||
|
||||
bool changed = false;
|
||||
std::optional<std::string> animClipName = SHResourceManager::GetAssetName<SHAnimationClip>(animClip);
|
||||
|
||||
|
@ -191,12 +194,14 @@ namespace SHADE
|
|||
auto assetId = SHResourceManager::GetAssetID(animClip);
|
||||
if (assetId.has_value())
|
||||
{
|
||||
auto animAsset = SHAssetManager::GetData<SHAnimClipAsset>(assetId.value());
|
||||
auto const animAsset = SHAssetManager::GetData<SHAnimClipAsset>(assetId.value());
|
||||
animAsset->firstIndex = firstIndex;
|
||||
animAsset->lastIndex = endIndex;
|
||||
SHAssetManager::SaveAsset(assetId.value());
|
||||
SHAssetManager::SaveAsset(containerAsset->id);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
// Extra separator if there is more than one
|
||||
|
|
|
@ -113,14 +113,15 @@ namespace SHADE
|
|||
SHEditorWindowManager::CreateEditorWindow<SHAssetBrowser>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHMaterialInspector>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHColliderTagPanel>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHInputBindingsPanel>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
||||
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHAnimationControllerEditor>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHRawAnimInspector>();
|
||||
|
||||
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
||||
|
||||
//Add popup windows
|
||||
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_ASSET_COMPILE_EVENT { 24 };
|
||||
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,6 +726,22 @@ namespace SHADE
|
|||
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0);
|
||||
}
|
||||
|
||||
if (IsAnimated())
|
||||
{
|
||||
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM);
|
||||
if (instanceDataDescSet[frameIndex])
|
||||
{
|
||||
cmdBuffer->BindDescriptorSet
|
||||
(
|
||||
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])
|
||||
{
|
||||
|
@ -737,6 +753,8 @@ namespace SHADE
|
|||
dynamicOffset
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
|
||||
cmdBuffer->EndLabeledSegment();
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorPool.h"
|
||||
#include "Graphics/Commands/SHVkCommandBuffer.h"
|
||||
|
||||
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
|
||||
for (auto& batch : batches)
|
||||
{
|
||||
if (!bindBatchPipeline)
|
||||
{
|
||||
if (batch.IsAnimated())
|
||||
cmdBuffer->BindPipeline(animPipeline);
|
||||
else
|
||||
cmdBuffer->BindPipeline(nonAnimPipeline);
|
||||
}
|
||||
|
||||
batch.Draw(cmdBuffer, frameIndex, bindBatchPipeline);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace SHADE
|
|||
void Clear() noexcept;
|
||||
void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
|
||||
void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept;
|
||||
void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline = true) noexcept;
|
||||
void Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline = true, Handle<SHVkPipeline> nonAnimPipeline = {}, Handle<SHVkPipeline> animPipeline = {}) noexcept;
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Getter Functions */
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace SHADE
|
|||
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::predefinedLayouts;
|
||||
SHVertexInputState SHGraphicsPredefinedData::defaultVertexInputState;
|
||||
SHVertexInputState SHGraphicsPredefinedData::shadowMapVertexInputState;
|
||||
SHVertexInputState SHGraphicsPredefinedData::shadowMapAnimVertexInputState;
|
||||
|
||||
std::vector<SHGraphicsPredefinedData::PerSystem> SHGraphicsPredefinedData::perSystemData;
|
||||
|
||||
|
@ -36,6 +37,7 @@ namespace SHADE
|
|||
{SHPredefinedDescriptorTypes::STATIC_DATA, 0},
|
||||
{SHPredefinedDescriptorTypes::CAMERA, 1},
|
||||
{SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH, 2},
|
||||
{SHPredefinedDescriptorTypes::RENDER_GRAPH_RESOURCE, 3},
|
||||
});
|
||||
|
||||
perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descMappings.AddMappings
|
||||
|
@ -333,6 +335,17 @@ namespace SHADE
|
|||
|
||||
shadowMapVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D)});
|
||||
shadowMapVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots)
|
||||
|
||||
shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D) });
|
||||
shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots)
|
||||
shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::UINT32_4D) }, 6, 9); // Attribute bone indices at index 5
|
||||
shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_4D) }, 7, 10); // Attribute bone weights at index 6
|
||||
shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::UINT32_1D) }, 8, 11); // Instance bone matrix first index at index 7
|
||||
|
||||
|
||||
//shadowMapAnimVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D) });
|
||||
//shadowMapAnimVertexInputState.AddBinding(true, true, { SHVertexAttribute(SHAttribFormat::MAT_4D) }, 4, 4); // Transform at binding 4 - 7 (4 slots)
|
||||
|
||||
}
|
||||
|
||||
void SHGraphicsPredefinedData::Init(Handle<SHVkLogicalDevice> logicalDevice) noexcept
|
||||
|
@ -368,6 +381,11 @@ namespace SHADE
|
|||
return shadowMapVertexInputState;
|
||||
}
|
||||
|
||||
SHVertexInputState const& SHGraphicsPredefinedData::GetShadowMapAnimViState(void) noexcept
|
||||
{
|
||||
return shadowMapAnimVertexInputState;
|
||||
}
|
||||
|
||||
SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetSystemData(SystemType systemType) noexcept
|
||||
{
|
||||
return perSystemData[static_cast<uint32_t>(systemType)];
|
||||
|
|
|
@ -67,6 +67,9 @@ namespace SHADE
|
|||
//! vertex input state for shadow mapping
|
||||
static SHVertexInputState shadowMapVertexInputState;
|
||||
|
||||
//! vertex input state for shadow mapping
|
||||
static SHVertexInputState shadowMapAnimVertexInputState;
|
||||
|
||||
//! Predefined data for each type of system
|
||||
static std::vector<PerSystem> perSystemData;
|
||||
|
||||
|
@ -101,6 +104,7 @@ namespace SHADE
|
|||
static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes types) noexcept;
|
||||
static SHVertexInputState const& GetDefaultViState (void) noexcept;
|
||||
static SHVertexInputState const& GetShadowMapViState (void) noexcept;
|
||||
static SHVertexInputState const& GetShadowMapAnimViState (void) noexcept;
|
||||
static PerSystem const& GetSystemData (SystemType systemType) noexcept;
|
||||
static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept;
|
||||
//static PerSystem const& GetBatchingSystemData(void) noexcept;
|
||||
|
|
|
@ -128,8 +128,9 @@ namespace SHADE
|
|||
|
||||
SHFreetypeInstance::Init();
|
||||
|
||||
SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_VS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMapAnim_VS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
|
||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
|
||||
|
@ -159,6 +160,7 @@ namespace SHADE
|
|||
static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS);
|
||||
static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_FS);
|
||||
static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS);
|
||||
static constexpr AssetID SHADOW_MAP_ANIM_VS = 39393999; shadowMapAnimVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_ANIM_VS);
|
||||
static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS);
|
||||
static constexpr AssetID TRAJECTORY_VS = 41042628; trajectoryVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_VS);
|
||||
static constexpr AssetID TRAJECTORY_FS = 45635685; trajectoryFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_FS);
|
||||
|
@ -919,10 +921,19 @@ namespace SHADE
|
|||
SHGraphicsPredefinedData::SystemType::BATCHING,
|
||||
SHGraphicsPredefinedData::GetShadowMapViState(), rasterState
|
||||
);
|
||||
|
||||
tempLibrary.CreateGraphicsPipelines
|
||||
(
|
||||
{ shadowMapAnimVS, shadowMapFS }, shadowMapNode->GetRenderpass(), shadowMapDrawSubpass,
|
||||
SHGraphicsPredefinedData::SystemType::BATCHING_ANIM,
|
||||
SHGraphicsPredefinedData::GetShadowMapAnimViState(), rasterState
|
||||
);
|
||||
|
||||
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS, shadowMapDrawSubpass });
|
||||
shadowMapAnimPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapAnimVS, shadowMapFS, shadowMapDrawSubpass });
|
||||
}
|
||||
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteSubpass, shadowMapPipeline); // set companion subpass and pipeline
|
||||
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteVfxSubpass, shadowMapPipeline); // set companion subpass and pipeline
|
||||
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteSubpass, shadowMapPipeline, shadowMapAnimPipeline); // set companion subpass and pipeline
|
||||
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteVfxSubpass, shadowMapPipeline, shadowMapAnimPipeline); // set companion subpass and pipeline
|
||||
|
||||
// add the shadow map and the blurred version to the lighting system
|
||||
uint32_t const NEW_SHADOW_MAP_INDEX = lightingSubSystem->AddShadowMap(renderGraph->GetRenderGraphResource(shadowMapBlurredResourceName), EVENT_DATA->lightEntity);
|
||||
|
|
|
@ -479,6 +479,7 @@ namespace SHADE
|
|||
Handle<SHVkShaderModule> renderToSwapchainVS;
|
||||
Handle<SHVkShaderModule> renderToSwapchainFS;
|
||||
Handle<SHVkShaderModule> shadowMapVS;
|
||||
Handle<SHVkShaderModule> shadowMapAnimVS;
|
||||
Handle<SHVkShaderModule> shadowMapFS;
|
||||
Handle<SHVkShaderModule> trajectoryVS;
|
||||
Handle<SHVkShaderModule> trajectoryFS;
|
||||
|
@ -499,6 +500,7 @@ namespace SHADE
|
|||
Handle<SHVkPipeline> debugDrawFilledPipeline;
|
||||
Handle<SHVkPipeline> debugDrawFilledDepthPipeline;
|
||||
Handle<SHVkPipeline> shadowMapPipeline; // initialized only when a shadow map is needed
|
||||
Handle<SHVkPipeline> shadowMapAnimPipeline; // initialized only when a shadow map is needed
|
||||
|
||||
Handle<SHVkDescriptorSetGroup> genericAndTextureDescSet;
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// get target node
|
||||
auto targetNode = nodes.begin() + nodeIndexing.at(nodeToAddAfter);
|
||||
auto targetNode = nodes.begin() + nodeIndexing.at(nodeToAddAfter) + 1;
|
||||
|
||||
auto node = nodes.insert(targetNode, renderGraphStorage->resourceHub->Create<SHRenderGraphNode>(nodeName, renderGraphStorage, std::move(descInitParams), std::vector<Handle<SHRenderGraphNode>>(), true));
|
||||
ReindexNodes ();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue