Added extra field in animation clip container for time multiplier #427

Merged
XiaoQiDigipen merged 3 commits from SP3-22-AnimationController into main 2023-03-14 16:50:24 +08:00
90 changed files with 6986 additions and 1041 deletions
Showing only changes of commit d8fe6a2f11 - Show all commits

View File

@ -1,4 +1,4 @@
Start in Fullscreen: false Start in Fullscreen: false
Starting Scene ID: 91478134 Starting Scene ID: 97158628
Window Size: {x: 1920, y: 1080} Window Size: {x: 1920, y: 1080}
Window Title: SHADE Engine Window Title: SHADE Engine

Binary file not shown.

View File

@ -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.

View File

@ -1,11 +1,11 @@
0 StaticObject 1110000000000000 0 StaticObject 1100000000000000
1 Player 1100000000000000 1 Player 1100000000000000
2 Food 1000000000000000 2 Food 1000000000000000
3 Breakable 1100000000000000 3 Breakable 1100000000000000
4 ScoringWallCollider 0110000000000000 4 ScoringWallCollider 0110000000000000
5 Homeowner 1100000000000000 5 Homeowner 1100000000000000
6 Camera 0010000000000000 6 Camera 0010000000000000
7 8 0000000000000000 7 StaticWithCameraCollision 1110000000000000
8 9 0000000000000000 8 9 0000000000000000
9 10 0000000000000000 9 10 0000000000000000
10 11 0000000000000000 10 11 0000000000000000

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
Color: {x: 1, y: 1, z: 1, w: 1} Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 0 Strength: 0
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 1 - EID: 1
@ -73,10 +74,10 @@
sceneID: 97158628 sceneID: 97158628
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 6 - EID: 6
@ -108,10 +109,10 @@
Enabled: true Enabled: true
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 3 - EID: 3
@ -152,7 +153,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: ~ Components: ~
Scripts: Scripts:
- Type: SHADE_Scripting.UI.TweenManager - Type: TweenManager
Enabled: true Enabled: true
- EID: 450 - EID: 450
Name: TransitionCanvas Name: TransitionCanvas

View File

@ -100,10 +100,10 @@
sceneID: 91947920 sceneID: 91947920
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 6 - EID: 6
@ -135,10 +135,10 @@
Enabled: true Enabled: true
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 7 - EID: 7
@ -168,10 +168,10 @@
Scripts: Scripts:
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- Type: SHADE_Scripting.UI.ChangeCanvasButton - Type: SHADE_Scripting.UI.ChangeCanvasButton
@ -204,10 +204,10 @@
Scripts: Scripts:
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- Type: SHADE_Scripting.UI.ChangeCanvasButton - Type: SHADE_Scripting.UI.ChangeCanvasButton
@ -240,10 +240,10 @@
Scripts: Scripts:
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- Type: SHADE_Scripting.UI.ChangeCanvasButton - Type: SHADE_Scripting.UI.ChangeCanvasButton
@ -276,10 +276,10 @@
Scripts: Scripts:
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- Type: SHADE_Scripting.UI.ChangeCanvasButton - Type: SHADE_Scripting.UI.ChangeCanvasButton
@ -297,6 +297,7 @@
Color: {x: 1, y: 1, z: 1, w: 1} Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 0 Strength: 0
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 3 - EID: 3
@ -337,7 +338,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: ~ Components: ~
Scripts: Scripts:
- Type: SHADE_Scripting.UI.TweenManager - Type: TweenManager
Enabled: true Enabled: true
- EID: 13 - EID: 13
Name: How To Play Canvas Name: How To Play Canvas
@ -428,10 +429,10 @@
multiImageList: 15 multiImageList: 15
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 17 - EID: 17
@ -465,10 +466,10 @@
multiImageList: 15 multiImageList: 15
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 18 - EID: 18
@ -501,10 +502,10 @@
canvasToActivate: 0 canvasToActivate: 0
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 19 - EID: 19
@ -575,10 +576,10 @@
canvasToActivate: 0 canvasToActivate: 0
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 22 - EID: 22
@ -1262,10 +1263,10 @@
canvasToActivate: 0 canvasToActivate: 0
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 49 - EID: 49
@ -1371,10 +1372,10 @@
canvasToActivate: 0 canvasToActivate: 0
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 53 - EID: 53

View File

@ -10,6 +10,7 @@
Color: {x: 1, y: 1, z: 1, w: 1} Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295 Layer: 4294967295
Strength: 0 Strength: 0
Casting Shadows: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 1 - EID: 1
@ -73,10 +74,10 @@
sceneID: 97158628 sceneID: 97158628
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 6 - EID: 6
@ -108,10 +109,10 @@
Enabled: true Enabled: true
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: event:/UI/botton_hover
onHoverExitSound: Empty onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element onClickSound: event:/UI/button_success
onReleaseSound: Empty onReleaseSound: event:/UI/button_fail
hoverScale: 1.10000002 hoverScale: 1.10000002
clickScale: 0.899999976 clickScale: 0.899999976
- EID: 3 - EID: 3
@ -152,7 +153,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: ~ Components: ~
Scripts: Scripts:
- Type: SHADE_Scripting.UI.TweenManager - Type: TweenManager
Enabled: true Enabled: true
- EID: 450 - EID: 450
Name: TransitionCanvas Name: TransitionCanvas

View File

@ -110,8 +110,8 @@ public partial class Homeowner1 : BehaviourTree
//These should be somewhere else //These should be somewhere else
//Debug.Log("TESTING"); //Debug.Log("TESTING");
AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected"); //AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected"); //AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive"); AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps"); AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
@ -121,7 +121,7 @@ public partial class Homeowner1 : BehaviourTree
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected"); AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming"); AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXHumming"], GameObject.EntityId); Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXHumming"], GameObject.EntityId);
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f); //AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
AudioHandler.audioClipHandlers["SFXHumming"].Play(); AudioHandler.audioClipHandlers["SFXHumming"].Play();
if (aiInstance != null && aiInstance != this) if (aiInstance != null && aiInstance != this)

View File

@ -156,7 +156,7 @@ public partial class LeafSearch : BehaviourTreeNode
//Draw a ray, succeed if ray is unobstructed //Draw a ray, succeed if ray is unobstructed
Vector3 eyePosition = transform.GlobalPosition + eyeOffset; Vector3 eyePosition = transform.GlobalPosition + eyeOffset;
BoxCollider playerCollider = player.GetValueOrDefault().GetComponent<Collider>().GetCollisionShape<BoxCollider>(0); Collider playerCollider = player.GetValueOrDefault().GetComponent<Collider>();
if (playerCollider == null) if (playerCollider == null)
{ {
//Debug.Log("Failure: Player has no collider"); //Debug.Log("Failure: Player has no collider");
@ -167,7 +167,7 @@ public partial class LeafSearch : BehaviourTreeNode
} }
//Ray destination to target the centre of the player's collider instead of transform position //Ray destination to target the centre of the player's collider instead of transform position
//Since transform position is often the raccoon's base and the ray needs to hit somewhere higher to be more reliable //Since transform position is often the raccoon's base and the ray needs to hit somewhere higher to be more reliable
Vector3 rayDestination = plrT.GlobalPosition + plrT.GlobalScale * playerCollider.PositionOffset; Vector3 rayDestination = plrT.GlobalPosition + plrT.GlobalScale * playerCollider.GetCollisionShape(0).PositionOffset;
Ray sightRay = new Ray(eyePosition, rayDestination - eyePosition); Ray sightRay = new Ray(eyePosition, rayDestination - eyePosition);
RaycastHit sightRayHit = Physics.Raycast(sightRay, false, (ushort)65535)[0]; RaycastHit sightRayHit = Physics.Raycast(sightRay, false, (ushort)65535)[0];
//As of November 2022, RaycastHit contains only the FIRST object hit by //As of November 2022, RaycastHit contains only the FIRST object hit by

View File

@ -86,12 +86,17 @@ public class Item : Script
if (returnBack && !dontReturn) if (returnBack && !dontReturn)
{ {
if (rb)
{
rb.LinearVelocity = Vector3.Zero;
rb.AngularVelocity = Vector3.Zero;
rb.ClearForces();
rb.ClearTorque();
}
if(transform) if(transform)
transform.LocalPosition = firstPostion; transform.LocalPosition = firstPostion;
if (rb)
rb.LinearVelocity = Vector3.Zero;
returnBack = false; returnBack = false;
} }

View File

@ -3,13 +3,38 @@ using System;
public class PlayerIdleState : BaseState public class PlayerIdleState : BaseState
{ {
public PlayerIdleState(StateMachine stateMachine) : base(stateMachine) private bool holdItem;
public PlayerIdleState(StateMachine stateMachine, bool hi) : base(stateMachine)
{ {
stateName = "Idle State"; stateName = "Idle State";
holdItem = hi;
} }
public override void OnEnter() public override void OnEnter()
{ {
//Debug.Log("WALK ENTER"); //Debug.Log("WALK ENTER");
if (PlayerAnimations.Instance)
{
if (!holdItem)
{
if (PlayerAnimations.Instance.playerIdleClip)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerIdleClip);
}
}
else
{
if (PlayerAnimations.Instance.playerCarryIdleClip)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerCarryIdleClip);
}
}
}
} }
public override void update() public override void update()
{ {

View File

@ -9,7 +9,7 @@ public class PlayerJumpState : BaseState
} }
public override void OnEnter() public override void OnEnter()
{ {
//Debug.Log("WALK ENTER"); //Debug.Log("jump");
} }
public override void update() public override void update()
{ {

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class PlayerRunState : BaseState public class PlayerRunState : BaseState
@ -13,6 +14,13 @@ public class PlayerRunState : BaseState
public override void OnEnter() public override void OnEnter()
{ {
//Debug.Log("WALK ENTER"); //Debug.Log("WALK ENTER");
if (PlayerAnimations.Instance && PlayerAnimations.Instance.playerRunClip)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerRunClip);
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerRunClip);
}
} }
public override void update() public override void update()
{ {
@ -21,7 +29,7 @@ public class PlayerRunState : BaseState
if (timer > delay) if (timer > delay)
{ {
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps"); AudioHandler.audioClipHandlers["footsteps"].Play();
timer = 0; timer = 0;
} }
} }

View File

@ -1,18 +1,44 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class PlayerWalkState : BaseState public class PlayerWalkState : BaseState
{ {
private float timer; private float timer;
private float delay = 0.5f; private float delay = 0.5f;
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine) private bool holdItem;
public PlayerWalkState(StateMachine stateMachine, bool hi) : base(stateMachine)
{ {
stateName = "Walk State"; stateName = "Walk State";
holdItem = hi;
} }
public override void OnEnter() public override void OnEnter()
{ {
//Debug.Log("WALK ENTER"); //Debug.Log("WALK ENTER");
timer = delay; timer = delay;
if (PlayerAnimations.Instance)
{
if (!holdItem)
{
if (PlayerAnimations.Instance.playerWalkClip)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerWalkClip);
}
}
else
{
if (PlayerAnimations.Instance.playerCarryWalkClip)
{
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
PlayerAnimations.Instance.BagAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
PlayerAnimations.Instance.silhoPlayerAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
PlayerAnimations.Instance.silhoBagAnimator.Play(PlayerAnimations.Instance.playerCarryWalkClip);
}
}
}
} }
public override void update() public override void update()
{ {
@ -20,8 +46,8 @@ public class PlayerWalkState : BaseState
timer += Time.DeltaTimeF; timer += Time.DeltaTimeF;
if (timer > delay) if (timer > delay)
{ {
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_footsteps"); AudioHandler.audioClipHandlers["footsteps"].Play();
timer = 0; timer = 0;
} }
} }

View File

@ -34,11 +34,6 @@ public class PickAndThrow : Script
[Tooltip("Height of ray")] [Tooltip("Height of ray")]
public float rayHeight = 0.1f; public float rayHeight = 0.1f;
[Tooltip("FOV when you aim")]
public float aimingFOV = 50;
[Tooltip("Default FOV")]
public float defaultFOV = 45;
protected override void awake() protected override void awake()
{ {
pc = GetScript<PlayerController>(); pc = GetScript<PlayerController>();
@ -85,7 +80,7 @@ public class PickAndThrow : Script
pc.camArm.ArmLength = aimingLength; pc.camArm.ArmLength = aimingLength;
prevTargetOffSet = pc.camArm.TargetOffset; prevTargetOffSet = pc.camArm.TargetOffset;
pc.camArm.TargetOffset = cameraArmOffSet; pc.camArm.TargetOffset = cameraArmOffSet;
pc.cam.FOV = aimingFOV; pc.cam.FOV = Settings.cameraFOV + 5;
} }
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming) if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
@ -95,7 +90,7 @@ public class PickAndThrow : Script
itemCollider.GetCollisionShape(0).IsTrigger = false; itemCollider.GetCollisionShape(0).IsTrigger = false;
pc.isAiming = false; pc.isAiming = false;
pc.camArm.TargetOffset = prevTargetOffSet; pc.camArm.TargetOffset = prevTargetOffSet;
pc.cam.FOV = defaultFOV; pc.cam.FOV = Settings.cameraFOV;
if (tpc) if (tpc)
pc.camArm.ArmLength = tpc.armLength; pc.camArm.ArmLength = tpc.armLength;
pc.holdItem = false; pc.holdItem = false;
@ -116,7 +111,7 @@ public class PickAndThrow : Script
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming) if (Input.GetMouseButtonDown(Input.MouseCode.RightButton) && pc.isAiming)
{ {
pc.isAiming = false; pc.isAiming = false;
pc.cam.FOV = defaultFOV; pc.cam.FOV = Settings.cameraFOV;
pc.camArm.TargetOffset = prevTargetOffSet; pc.camArm.TargetOffset = prevTargetOffSet;
if (tpc) if (tpc)
pc.camArm.ArmLength = tpc.armLength; pc.camArm.ArmLength = tpc.armLength;

View File

@ -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;
}
}

View File

@ -0,0 +1,3 @@
Name: SC_PlayerAnimations
ID: 159045981
Type: 9

View File

@ -1,6 +1,7 @@
using SHADE; using SHADE;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SHADE_Scripting.Audio;
using static Item; using static Item;
public class PlayerController : Script public class PlayerController : Script
@ -32,7 +33,7 @@ public class PlayerController : Script
private float delayTimer = 0.0f; private float delayTimer = 0.0f;
[Tooltip("The current state fo the raccoon")] [Tooltip("The current state fo the raccoon")]
public RaccoonStates currentState = RaccoonStates.IDLE; public RaccoonStates currentState;
//Movement variables============================================================ //Movement variables============================================================
[Tooltip("Max vel for walking")] [Tooltip("Max vel for walking")]
@ -98,17 +99,17 @@ public class PlayerController : Script
//rigidbody check //rigidbody check
rb = GetComponent<RigidBody>(); rb = GetComponent<RigidBody>();
if (!rb) if (!rb)
Debug.LogError("RigidBody is NULL!"); Debug.LogError("RigidBody is MISSING!");
//Transform check //Transform check
tranform = GetComponent<Transform>(); tranform = GetComponent<Transform>();
if(!tranform) if(!tranform)
Debug.LogError("tranform is NULL!"); Debug.LogError("tranform is MISSING!");
stateMachine = AddScript<StateMachine>(); stateMachine = AddScript<StateMachine>();
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>(); Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine)); dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine, holdItem));
dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine)); dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine, holdItem));
dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine)); dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine)); dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine)); dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
@ -131,6 +132,14 @@ public class PlayerController : Script
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>(); silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f); silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
} }
AudioHandler.audioClipHandlers["footsteps"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_footsteps");
}
protected override void start()
{
currentState = RaccoonStates.IDLE;
stateMachine.SetState(typeof(PlayerIdleState));
} }
protected override void lateUpdate() protected override void lateUpdate()
@ -167,8 +176,8 @@ public class PlayerController : Script
if (!cam) if (!cam)
{ {
cam = GetComponentInChildren<Camera>(); cam = GetComponentInChildren<Camera>();
if(pat) if (pat)
cam.FOV = pat.defaultFOV; cam.FOV = Settings.cameraFOV;
} }
if(!camArm) if(!camArm)
camArm = GetComponentInChildren<CameraArm>(); camArm = GetComponentInChildren<CameraArm>();
@ -315,6 +324,8 @@ public class PlayerController : Script
if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad ) && isGrounded && rb != null) if ( (Input.GetKeyDown(Input.KeyCode.Space) || landedOnJumpPad ) && isGrounded && rb != null)
{ {
currentState = RaccoonStates.JUMP; currentState = RaccoonStates.JUMP;
if (stateMachine && !stateMachine.IsState(typeof(PlayerJumpState)))
stateMachine.SetState(typeof(PlayerJumpState));
Vector3 v = rb.LinearVelocity; Vector3 v = rb.LinearVelocity;
v.y = initialJumpVel * 0.5f; v.y = initialJumpVel * 0.5f;
if (holdItem && pat != null && pat.item.GetScript<Item>() != null) if (holdItem && pat != null && pat.item.GetScript<Item>() != null)
@ -337,8 +348,12 @@ public class PlayerController : Script
} }
} }
if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space))) if (!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space)))
{
currentState = RaccoonStates.FALLING; currentState = RaccoonStates.FALLING;
if (stateMachine && !stateMachine.IsState(typeof(PlayerFallState)))
stateMachine.SetState(typeof(PlayerFallState));
}
} }
@ -369,7 +384,11 @@ public class PlayerController : Script
{ {
isGrounded = true; isGrounded = true;
if (currentState == RaccoonStates.FALLING) if (currentState == RaccoonStates.FALLING)
{
currentState = RaccoonStates.LANDED; currentState = RaccoonStates.LANDED;
if (stateMachine && !stateMachine.IsState(typeof(PlayerLandState)))
stateMachine.SetState(typeof(PlayerLandState));
}
} }
else else
isGrounded = false; isGrounded = false;
@ -417,7 +436,7 @@ public class PlayerController : Script
if (isAiming) if (isAiming)
{ {
isAiming = false; isAiming = false;
cam.FOV = pat.defaultFOV; cam.FOV = Settings.cameraFOV;
camArm.TargetOffset = pat.prevTargetOffSet; camArm.TargetOffset = pat.prevTargetOffSet;
camArm.ArmLength = pat.tpc.armLength; camArm.ArmLength = pat.tpc.armLength;
} }

View File

@ -37,6 +37,7 @@ namespace SHADE_Scripting
protected override void start() protected override void start()
{ {
GetComponent<CameraArm>().ArmLength = armLength; GetComponent<CameraArm>().ArmLength = armLength;
GetComponent<Camera>().FOV = Settings.cameraFOV;
} }
protected override void update() protected override void update()

View File

@ -101,6 +101,8 @@ public class GameManager : Script
protected override void update() protected override void update()
{ {
if (GamePause || !stealFoodPopUpDone) if (GamePause || !stealFoodPopUpDone)
{ {
return; return;
@ -195,6 +197,13 @@ public class GameManager : Script
if (SceneFadeInOut.Instance != null) if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn(); SceneFadeInOut.Instance.CallFadeIn();
} }
if (Input.GetKeyUp(Input.KeyCode.G))
{
ItemScored();
Score += 500;
}
} }
@ -219,6 +228,13 @@ public class GameManager : Script
fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration); fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration);
} }
SingleScaleBounce sb = scoreText.GetScript<SingleScaleBounce>();
if(sb)
{
sb.ScaleBounceOnce();
}
} }
} }

View File

@ -2,15 +2,64 @@
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using System; using System;
public class JumpPad : Script public class JumpPad : Script
{ {
private Transform tran;
private Vector3 defaultScale;
public float scaleYMaxSize = 2.0f;
private float scaleXZMaxSize;
public float scaleDuration = 0.25f;
private bool landed = false;
private bool scaleUpDone = false;
[NonSerialized]
private TweenThread scaleYUp;
[NonSerialized]
private TweenThread scaleXZUp;
[NonSerialized]
private TweenThreadVec3 scaleDown;
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["SFXJumpPad"] = Audio.CreateAudioClip("event:/Props/jumppad_boing"); AudioHandler.audioClipHandlers["SFXJumpPad"] = Audio.CreateAudioClip("event:/Props/jumppad_boing");
tran = GameObject.GetComponent<Transform>();
if (!tran)
Debug.LogError("NO TRANSFORM");
defaultScale = tran.LocalScale;
scaleXZMaxSize = scaleYMaxSize * 0.3f;
}
protected override void start()
{
scaleYUp = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, scaleYMaxSize, EASING_METHOD.EASE_IN_SINE);
scaleXZUp = TweenManager.CreateTweenThread(scaleDuration, tran.LocalScale.y, scaleXZMaxSize, EASING_METHOD.EASE_IN_SINE);
} }
protected override void update() protected override void update()
{ {
if (landed && tran)
{
tran.LocalScale = new Vector3(scaleXZUp.GetValue(), scaleYUp.GetValue(), scaleXZUp.GetValue());
if (scaleYUp.IsCompleted() && scaleXZUp.IsCompleted())
{
landed = false;
scaleUpDone = true;
scaleDown = TweenManager.CreateTweenThreadVec3(scaleDuration, tran.LocalScale, defaultScale, EASING_METHOD.EASE_IN_SINE);
}
}
if (scaleUpDone && !landed)
{
tran.LocalScale = scaleDown.GetValue();
if (scaleDown.IsCompleted())
{
scaleUpDone = false;
}
}
} }
protected override void onCollisionEnter(CollisionInfo info) protected override void onCollisionEnter(CollisionInfo info)
@ -20,7 +69,11 @@ public class JumpPad : Script
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId); Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
AudioHandler.audioClipHandlers["SFXJumpPad"].Play(); AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true; info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
landed = true;
scaleYUp.Reset();
scaleXZUp.Reset();
} }
} }
} }

View File

@ -40,11 +40,6 @@ namespace SHADE_Scripting.UI
if (listOfCamera.Count == 0) if (listOfCamera.Count == 0)
Debug.LogError("EMPTY PREVIEW POINTS"); Debug.LogError("EMPTY PREVIEW POINTS");
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint2 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[1].GetComponent<Transform>().LocalPosition, endPoint2, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
} }
protected override void start() protected override void start()
@ -52,6 +47,11 @@ namespace SHADE_Scripting.UI
if (gameplayCanvas) if (gameplayCanvas)
gameplayCanvas.SetActive(false); gameplayCanvas.SetActive(false);
listOfCamera[0].SetMainCamera(); listOfCamera[0].SetMainCamera();
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint2 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[1].GetComponent<Transform>().LocalPosition, endPoint2, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
} }
protected override void update() protected override void update()
@ -135,7 +135,7 @@ namespace SHADE_Scripting.UI
{ {
if (reset3) if (reset3)
{ {
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE); moveToEndPoint3.Reset();
reset3 = false; reset3 = false;
} }
listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue(); listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue();

View File

@ -4,18 +4,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SHADE_Scripting static public class Settings
{ {
static public class Settings static public float cameraSensitivity = 100.0f;
{
static public float cameraSensitivity = 100.0f;
static public float cameraFOV = 90.0f; static public float cameraFOV = 45.0f;
static public float masterVolume = 100.0f; static public float masterVolume = 100.0f;
static public float sfxVolume = 100.0f; static public float sfxVolume = 100.0f;
static public float bgmVolume = 100.0f; static public float bgmVolume = 100.0f;
}
} }

View File

@ -4,9 +4,6 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public enum EASING_METHOD public enum EASING_METHOD
{ {
EASE_IN_SINE, EASE_IN_SINE,
@ -16,84 +13,88 @@ namespace SHADE_Scripting.UI
EASE_INOUT_BOUNCE EASE_INOUT_BOUNCE
} }
public static class EasingHelper public static class EasingHelper
{
public static float EaseHelp(float value, EASING_METHOD method)
{
switch (method)
{ {
case EASING_METHOD.EASE_IN_SINE:
public static float EaseHelp(float value, EASING_METHOD method)
{ {
switch (method) return EaseInSine(value);
{
case EASING_METHOD.EASE_IN_SINE:
{
return EaseInSine(value);
}break;
case EASING_METHOD.EASE_OUT_SINE:
{
return EaseOutSine(value);
}break;
case EASING_METHOD.EASE_OUT_BOUNCE:
{
return EaseOutBounce(value);
}break;
case EASING_METHOD.EASE_IN_BOUNCE:
{
return EaseInBounce(value);
}
break;
case EASING_METHOD.EASE_INOUT_BOUNCE:
{
return EaseInOutBounce(value);
}
break;
default:
return 0.0f;
}
} }
break;
private static float EaseInSine(float value) case EASING_METHOD.EASE_OUT_SINE:
{ {
return EaseOutSine(value);
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f) ));
} }
break;
private static float EaseOutSine(float value) case EASING_METHOD.EASE_OUT_BOUNCE:
{ {
return (float)(Math.Sin(value * Math.PI / 2.0f) ); return EaseOutBounce(value);
} }
break;
case EASING_METHOD.EASE_IN_BOUNCE:
private static float EaseOutBounce(float value)
{ {
const float n1 = 7.5625f; return EaseInBounce(value);
const float d1 = 2.75f;
if (value < 1.0f / d1)
{
return n1 * value * value;
} else if (value < 2.0f / d1)
{
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
}
else
{
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
}
} }
break;
private static float EaseInBounce(float value) case EASING_METHOD.EASE_INOUT_BOUNCE:
{ {
return 1 - EaseOutBounce(1 - value); return EaseInOutBounce(value);
} }
break;
default:
return 0.0f;
}
}
private static float EaseInSine(float value)
{
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f)));
}
private static float EaseOutSine(float value)
{
return (float)(Math.Sin(value * Math.PI / 2.0f));
}
private static float EaseInOutBounce(float value) private static float EaseOutBounce(float value)
{ {
return (value < 0.5f) const float n1 = 7.5625f;
?(1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f const float d1 = 2.75f;
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f; if (value < 1.0f / d1)
} {
return n1 * value * value;
}
else if (value < 2.0f / d1)
{
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
}
else
{
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
} }
}
private static float EaseInBounce(float value)
{
return 1 - EaseOutBounce(1 - value);
}
private static float EaseInOutBounce(float value)
{
return (value < 0.5f)
? (1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f;
}
} }

View File

@ -9,10 +9,10 @@ namespace SHADE_Scripting.UI
{ {
public class ButtonFX:Script public class ButtonFX:Script
{ {
public string onHoverEnterSound = "Empty"; public string onHoverEnterSound = "event:/UI/botton_hover";
public string onHoverExitSound = "Empty"; public string onHoverExitSound = "Empty";
public string onClickSound = "event:/UI/mouse_down_element"; public string onClickSound = "event:/UI/button_success";
public string onReleaseSound = "Empty"; public string onReleaseSound = "event:/UI/button_fail";
[NonSerialized] [NonSerialized]
private AudioClipHandler onHoverEnterACHandler; private AudioClipHandler onHoverEnterACHandler;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
public class CutsceneEnd : Script public class CutsceneEnd : Script
{ {
@ -58,6 +58,17 @@ public class CutsceneEnd : Script
{ {
initCutscene4(); initCutscene4();
initCutscene5(); initCutscene5();
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
//Cutscene 4 Audio
AudioHandler.audioClipHandlers["cutscene4Run"] = Audio.CreateAudioClip("event:/Cinematics/4/1_run");
//Cutscene 5 Audio
AudioHandler.audioClipHandlers["cutscene5Yay"] = Audio.CreateAudioClip("event:/Cinematics/5/2_yay");
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
} }
protected override void update() protected override void update()
@ -70,6 +81,11 @@ public class CutsceneEnd : Script
skip = true; skip = true;
oldDuration = duration; oldDuration = duration;
duration = skipDuration; duration = skipDuration;
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
AudioHandler.audioClipHandlers["cutscene4Run"].Stop(true);
AudioHandler.audioClipHandlers["cutscene5Yay"].Stop(true);
} }
if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
@ -90,6 +106,11 @@ public class CutsceneEnd : Script
{ {
if (canvas4.IsActiveSelf) if (canvas4.IsActiveSelf)
{ {
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene4Run"].Play();
}
if (showPic4a) if (showPic4a)
{ {
if (time < duration) if (time < duration)
@ -116,6 +137,10 @@ public class CutsceneEnd : Script
if (showPic4b) if (showPic4b)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration) if (time < duration)
{ {
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration); pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
@ -140,6 +165,10 @@ public class CutsceneEnd : Script
if (showPic4c) if (showPic4c)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration) if (time < duration)
{ {
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration); pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
@ -171,6 +200,10 @@ public class CutsceneEnd : Script
{ {
if (showPic5a) if (showPic5a)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration) if (time < duration)
{ {
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration); pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
@ -195,6 +228,11 @@ public class CutsceneEnd : Script
if (showPic5b) if (showPic5b)
{ {
if (time == 0)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene5Yay"].Play();
}
if (time < duration) if (time < duration)
{ {
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration); pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);

View File

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
public class CutsceneIntro : Script public class CutsceneIntro : Script
{ {
@ -87,6 +87,24 @@ public class CutsceneIntro : Script
initCutscene1(); initCutscene1();
initCutscene2(); initCutscene2();
initCutscene3(); initCutscene3();
//Cutscene BGM
AudioHandler.audioClipHandlers["cutsceneBGM"] = Audio.CreateAudioClip("event:/Cinematics/BGM");
AudioHandler.audioClipHandlers["cutscenePanelSlide"] = Audio.CreateAudioClip("event:/Cinematics/panel_slide");
//Cutscene 2 Audio
AudioHandler.audioClipHandlers["cutscene2Stomach"] = Audio.CreateAudioClip("event:/Cinematics/2/1_stomach");
AudioHandler.audioClipHandlers["cutscene2Alert"] = Audio.CreateAudioClip("event:/Cinematics/2/2_alert");
AudioHandler.audioClipHandlers["cutscene2Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/2/3_sparkle");
//Cutscene 3 Audio
AudioHandler.audioClipHandlers["cutscene3Jump"] = Audio.CreateAudioClip("event:/Cinematics/3/1_jump");
AudioHandler.audioClipHandlers["cutscene3Sparkle"] = Audio.CreateAudioClip("event:/Cinematics/3/2_sparkle");
AudioHandler.audioClipHandlers["cutscene3Carry"] = Audio.CreateAudioClip("event:/Cinematics/3/3_carry");
AudioHandler.audioClipHandlers["cutscene3Throw"] = Audio.CreateAudioClip("event:/Cinematics/3/4_throw");
AudioHandler.audioClipHandlers["cutscene3Yay"] = Audio.CreateAudioClip("event:/Cinematics/3/5_yay");
AudioHandler.audioClipHandlers["cutsceneBGM"].Play();
} }
protected override void update() protected override void update()
@ -98,6 +116,16 @@ public class CutsceneIntro : Script
if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done)) if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
{ {
skip = true; skip = true;
AudioHandler.audioClipHandlers["cutscene2Stomach"].Stop(true);
AudioHandler.audioClipHandlers["cutscene2Alert"].Stop(true);
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Jump"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Carry"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Throw"].Stop(true);
AudioHandler.audioClipHandlers["cutscene3Yay"].Stop(true);
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Stop(true);
oldDuration = duration; oldDuration = duration;
duration = skipDuration; duration = skipDuration;
} }
@ -128,6 +156,10 @@ public class CutsceneIntro : Script
{ {
if (canvas1.IsActiveSelf) if (canvas1.IsActiveSelf)
{ {
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (showPic1a) if (showPic1a)
{ {
if (time < duration) if (time < duration)
@ -154,6 +186,10 @@ public class CutsceneIntro : Script
if (showPic1b) if (showPic1b)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration) if (time < duration)
{ {
pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration); pic1bTran.LocalPosition = Vector3.Lerp(pic1bTran.LocalPosition, listOfCutscene1Points[1].LocalPosition, time / duration);
@ -178,6 +214,10 @@ public class CutsceneIntro : Script
if (showPic1c) if (showPic1c)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
}
if (time < duration) if (time < duration)
{ {
pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration); pic1cTran.LocalPosition = Vector3.Lerp(pic1cTran.LocalPosition, listOfCutscene1Points[2].LocalPosition, time / duration);
@ -209,6 +249,11 @@ public class CutsceneIntro : Script
{ {
if (showPic2a) if (showPic2a)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene2Stomach"].Play();
}
if (time < duration) if (time < duration)
{ {
pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration); pic2aTran.LocalPosition = Vector3.Lerp(pic2aTran.LocalPosition, listOfCutscene2Points[0].LocalPosition, time / duration);
@ -233,6 +278,11 @@ public class CutsceneIntro : Script
if (showPic2b) if (showPic2b)
{ {
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene2Alert"].Play();
}
if (time < duration) if (time < duration)
{ {
pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration); pic2bTran.LocalPosition = Vector3.Lerp(pic2bTran.LocalPosition, listOfCutscene2Points[1].LocalPosition, time / duration);
@ -257,6 +307,11 @@ public class CutsceneIntro : Script
if (showPic2c) if (showPic2c)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene2Sparkle"].Play();
}
if (time < duration) if (time < duration)
{ {
pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration); pic2cTran.LocalPosition = Vector3.Lerp(pic2cTran.LocalPosition, listOfCutscene2Points[2].LocalPosition, time / duration);
@ -288,6 +343,11 @@ public class CutsceneIntro : Script
{ {
if (showPic3a) if (showPic3a)
{ {
if(time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Jump"].Play();
}
if (time < duration) if (time < duration)
{ {
pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration); pic3aTran.LocalPosition = Vector3.Lerp(pic3aTran.LocalPosition, listOfCutscene3Points[0].LocalPosition, time / duration);
@ -312,6 +372,11 @@ public class CutsceneIntro : Script
if (showPic3b) if (showPic3b)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Sparkle"].Play();
}
if (time < duration) if (time < duration)
{ {
pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration); pic3bTran.LocalPosition = Vector3.Lerp(pic3bTran.LocalPosition, listOfCutscene3Points[1].LocalPosition, time / duration);
@ -336,6 +401,11 @@ public class CutsceneIntro : Script
if (showPic3c) if (showPic3c)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Carry"].Play();
}
if (time < duration) if (time < duration)
{ {
pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration); pic3cTran.LocalPosition = Vector3.Lerp(pic3cTran.LocalPosition, listOfCutscene3Points[2].LocalPosition, time / duration);
@ -360,6 +430,11 @@ public class CutsceneIntro : Script
if (showPic3d) if (showPic3d)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Throw"].Play();
}
if (time < duration) if (time < duration)
{ {
pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration); pic3dTran.LocalPosition = Vector3.Lerp(pic3dTran.LocalPosition, listOfCutscene3Points[3].LocalPosition, time / duration);
@ -384,6 +459,11 @@ public class CutsceneIntro : Script
if (showPic3e) if (showPic3e)
{ {
if (time == 0 && !skip)
{
AudioHandler.audioClipHandlers["cutscenePanelSlide"].Play();
AudioHandler.audioClipHandlers["cutscene3Yay"].Play();
}
if (time < duration) if (time < duration)
{ {
pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration); pic3eTran.LocalPosition = Vector3.Lerp(pic3eTran.LocalPosition, listOfCutscene3Points[4].LocalPosition, time / duration);

View File

@ -10,8 +10,8 @@ public class EndScene : Script
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element"); //AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success"); //AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
} }
protected override void start() protected override void start()
@ -27,28 +27,28 @@ public class EndScene : Script
if (Input.GetKeyDown(Input.KeyCode.R)) if (Input.GetKeyDown(Input.KeyCode.R))
{ {
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element"); //Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play(); //AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
} }
if (Input.GetKeyUp(Input.KeyCode.R)) if (Input.GetKeyUp(Input.KeyCode.R))
{ {
//Audio.PlaySFXOnce2D("event:/UI/success"); //Audio.PlaySFXOnce2D("event:/UI/success");
//Audio.StopAllSounds(); //Audio.StopAllSounds();
AudioHandler.StopAllSounds(false); AudioHandler.StopAllSounds(false);
AudioHandler.audioClipHandlers["SFXUISuccess"].Play(); //AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
SceneManager.ChangeScene(mainGameScene); SceneManager.ChangeScene(mainGameScene);
} }
if (Input.GetKeyDown(Input.KeyCode.M)) if (Input.GetKeyDown(Input.KeyCode.M))
{ {
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element"); //Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play(); //AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
} }
if (Input.GetKeyUp(Input.KeyCode.M)) if (Input.GetKeyUp(Input.KeyCode.M))
{ {
//Audio.PlaySFXOnce2D("event:/UI/success"); //Audio.PlaySFXOnce2D("event:/UI/success");
//Audio.StopAllSounds(); //Audio.StopAllSounds();
AudioHandler.StopAllSounds(false); AudioHandler.StopAllSounds(false);
AudioHandler.audioClipHandlers["SFXUISuccess"].Play(); //AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
SceneManager.ChangeScene(mainMainScene); SceneManager.ChangeScene(mainMainScene);
} }

View File

@ -13,8 +13,8 @@ public class MainMenu : Script
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu"); AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element"); //AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success"); //AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
//Audio.PlayBGMOnce2D("event:/Music/main_menu"); //Audio.PlayBGMOnce2D("event:/Music/main_menu");
AudioHandler.audioClipHandlers["BGMMainMenu"].Play(); AudioHandler.audioClipHandlers["BGMMainMenu"].Play();

View File

@ -7,89 +7,92 @@ using System.Threading.Tasks;
namespace SHADE_Scripting.UI namespace SHADE_Scripting.UI
{ {
public class Options:Script public class Options : Script
{
public GameObject masterVolSlider;
public GameObject sfxVolSlider;
public GameObject bgmVolSlider;
public GameObject fovSlider;
public GameObject sensitivitySlider;
protected override void awake()
{ {
public GameObject masterVolSlider; Slider mv = masterVolSlider.GetComponent<Slider>();
public GameObject sfxVolSlider; Slider sfx = sfxVolSlider.GetComponent<Slider>();
public GameObject bgmVolSlider; Slider bgm = bgmVolSlider.GetComponent<Slider>();
public GameObject fovSlider; Slider fov = fovSlider.GetComponent<Slider>();
public GameObject sensitivitySlider; Slider sens = sensitivitySlider.GetComponent<Slider>();
if (mv != null)
{
mv.ScaledValue = Settings.masterVolume;
}
if (sfx != null)
{
sfx.ScaledValue = Settings.sfxVolume;
protected override void awake() }
{ if (bgm != null)
Slider mv = masterVolSlider.GetComponent<Slider>(); {
Slider sfx = sfxVolSlider.GetComponent<Slider>(); bgm.ScaledValue = Settings.bgmVolume;
Slider bgm = bgmVolSlider.GetComponent<Slider>();
Slider fov = fovSlider.GetComponent<Slider>();
Slider sens = sensitivitySlider.GetComponent<Slider>();
}
if (fov != null)
{
fov.ScaledValue = Settings.cameraFOV;
if (mv != null) }
{ if (sens != null)
mv.ScaledValue = Settings.masterVolume; {
sens.ScaledValue = Settings.cameraSensitivity;
}
if (sfx != null)
{
sfx.ScaledValue = Settings.sfxVolume;
}
if (bgm != null)
{
bgm.ScaledValue = Settings.bgmVolume;
}
if (fov != null)
{
fov.ScaledValue = Settings.cameraFOV;
}
if (sens != null)
{
sens.ScaledValue = Settings.cameraSensitivity;
}
}
}
protected override void update()
{
Slider mv = masterVolSlider.GetComponent<Slider>();
Slider sfx = sfxVolSlider.GetComponent<Slider>();
Slider bgm = bgmVolSlider.GetComponent<Slider>();
Slider fov = fovSlider.GetComponent<Slider>();
Slider sens = sensitivitySlider.GetComponent<Slider>();
if(mv != null)
{
Settings.masterVolume = mv.ScaledValue;
}
if (sfx != null)
{
Settings.sfxVolume = sfx.ScaledValue;
}
if (bgm != null)
{
Settings.bgmVolume = bgm.ScaledValue;
}
if (fov != null)
{
Settings.cameraFOV = fov.ScaledValue;
}
if (sens != null)
{
Settings.cameraSensitivity = sens.ScaledValue;
}
}
} }
protected override void update()
{
Slider mv = masterVolSlider.GetComponent<Slider>();
Slider sfx = sfxVolSlider.GetComponent<Slider>();
Slider bgm = bgmVolSlider.GetComponent<Slider>();
Slider fov = fovSlider.GetComponent<Slider>();
Slider sens = sensitivitySlider.GetComponent<Slider>();
if (mv != null)
{
Settings.masterVolume = mv.ScaledValue;
SHADE.Audio.SetVCAVolume("vca:/MASTER", Settings.masterVolume * 0.01f);
}
if (sfx != null)
{
Settings.sfxVolume = sfx.ScaledValue;
SHADE.Audio.SetVCAVolume("vca:/SFX", Settings.sfxVolume * 0.01f);
SHADE.Audio.SetVCAVolume("vca:/UI", Settings.sfxVolume * 0.01f);
}
if (bgm != null)
{
Settings.bgmVolume = bgm.ScaledValue;
SHADE.Audio.SetVCAVolume("vca:/MUSIC", Settings.bgmVolume * 0.01f);
}
if (fov != null)
{
Settings.cameraFOV = fov.ScaledValue;
}
if (sens != null)
{
Settings.cameraSensitivity = sens.ScaledValue;
}
}
}
} }

View File

@ -50,6 +50,7 @@ public class PauseMenu : Script
if (canvas) if (canvas)
canvas.SetActive(false); canvas.SetActive(false);
Application.FixDeltaTime = Time.DefaultFixDeltaTime; Application.FixDeltaTime = Time.DefaultFixDeltaTime;
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
} }
}); });
} }
@ -69,6 +70,8 @@ public class PauseMenu : Script
GameManager.Instance.GamePause = false; GameManager.Instance.GamePause = false;
GameManager.Instance.stealFoodPopUpDone = false; GameManager.Instance.stealFoodPopUpDone = false;
GameManager.Instance.PreviewLevelDone = false; GameManager.Instance.PreviewLevelDone = false;
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
}); });
} }
else else
@ -82,6 +85,8 @@ public class PauseMenu : Script
quit.OnRelease.RegisterAction(() => quit.OnRelease.RegisterAction(() =>
{ {
Audio.StopAllSounds(); Audio.StopAllSounds();
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
AnimationSystem.TimeScale = AnimationSystem.DefaultTimeScale;
//go to main menu //go to main menu
SceneManager.ChangeScene(97158628); SceneManager.ChangeScene(97158628);
}); });
@ -106,6 +111,7 @@ public class PauseMenu : Script
if (canvas) if (canvas)
canvas.SetActive(true); canvas.SetActive(true);
Application.FixDeltaTime = 0; Application.FixDeltaTime = 0;
AnimationSystem.TimeScale = 0;
} }
} }

View File

@ -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;
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_ScoreTextDigitPositioning
ID: 166859312
Type: 9

View File

@ -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);
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_SingleScaleBounce
ID: 151165363
Type: 9

View File

@ -53,13 +53,16 @@ namespace SHADE_Scripting.UI
{ {
if (!GameManager.Instance.PreviewLevelDone) if (!GameManager.Instance.PreviewLevelDone)
{ {
rot.Reset(); if (rot != null && scaleX != null && scaleY != null)
scaleX.Reset(); {
scaleY.Reset(); rot.Reset();
scaleX.Reset();
scaleY.Reset();
}
return; return;
} }
if (!popInDone) if (!popInDone && rot != null && scaleX != null && scaleY != null)
{ {
tran.LocalEulerAngles = new Vector3(0.0f, 0.0f, SHADE.Math.DegreesToRadians(rot.GetValue())); tran.LocalEulerAngles = new Vector3(0.0f, 0.0f, SHADE.Math.DegreesToRadians(rot.GetValue()));
tran.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1); tran.LocalScale = new Vector3(scaleX.GetValue(), scaleY.GetValue(), 1);
@ -71,7 +74,7 @@ namespace SHADE_Scripting.UI
stayDone = true; stayDone = true;
} }
if (rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted()) if (rot != null && scaleX != null && scaleY != null && rot.IsCompleted() && scaleX.IsCompleted() && scaleY.IsCompleted())
popInDone = true; popInDone = true;
if (stayDone) if (stayDone)
@ -82,8 +85,11 @@ namespace SHADE_Scripting.UI
scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE); scaleOutY = TweenManager.CreateTweenThread(popOutDuration, scaleAmtY, 0, EASING_METHOD.EASE_IN_SINE);
createThreadOnce = false; createThreadOnce = false;
} }
tran.LocalScale = new Vector3(scaleOutX.GetValue(), scaleOutY.GetValue(), 1);
if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted()) if(scaleOutX != null && scaleOutY != null)
tran.LocalScale = new Vector3(scaleOutX.GetValue(), scaleOutY.GetValue(), 1);
if (scaleOutX != null && scaleOutY != null && scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
{ {
GameObject.SetActive(false); GameObject.SetActive(false);
GameManager.Instance.stealFoodPopUpDone = true; GameManager.Instance.stealFoodPopUpDone = true;

View File

@ -4,190 +4,182 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
public class TweenThread
namespace SHADE_Scripting.UI
{ {
private float timer = 0.0f;
public float duration = 1.0f;
public EASING_METHOD method;
private float value = 0.0f;
public float startValue = 0.0f;
public float endValue = 1.0f;
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{
this.duration = duration;
this.method = method;
this.startValue = startValue;
this.endValue = endValue;
}
public void Update(float deltaTime)
{
if (timer >= duration)
return;
timer += deltaTime;
if (timer >= duration)
timer = duration;
value = EasingHelper.EaseHelp(timer / duration, method) * (endValue - startValue) + startValue;
}
public bool IsCompleted()
{
return timer >= duration;
}
public void Reset()
{
timer = 0.0f;
value = startValue;
}
public void Reset(float startValue, float endValue)
{
Reset();
this.startValue = startValue;
this.endValue = endValue;
}
public void ResetInvert()
{
Reset();
float temp = startValue;
startValue = endValue;
endValue = temp;
}
public float GetValue()
{
return value;
}
}
public class TweenThreadVec3
{
private float timer = 0.0f;
public float duration = 1.0f;
public EASING_METHOD method;
private Vector3 value = Vector3.Zero;
public Vector3 startValue = Vector3.Zero;
public Vector3 endValue = Vector3.Zero;
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
{
this.duration = duration;
this.method = method;
this.startValue = startValue;
this.endValue = endValue;
}
public void Update(float deltaTime)
{
if (timer >= duration)
return;
timer += deltaTime;
if (timer >= duration)
timer = duration;
value = (endValue - startValue) * EasingHelper.EaseHelp(timer / duration, method) + startValue;
}
public bool IsCompleted()
{
return timer >= duration;
}
public void Reset()
{
timer = 0.0f;
value = startValue;
}
public void Reset(Vector3 startValue, Vector3 endValue)
{
Reset();
this.startValue = startValue;
this.endValue = endValue;
}
public void ResetInvert()
{
Reset();
Vector3 temp = startValue;
startValue = endValue;
endValue = temp;
}
public Vector3 GetValue()
{
return value;
}
}
public class TweenManager : Script
{
public static TweenManager Instance { get; private set; }
[NonSerialized]
private List<TweenThread> threadList;
[NonSerialized]
private List<TweenThreadVec3> threadVec3List;
protected override void awake()
{
if (Instance != null && Instance != this)
RemoveScript<TweenManager>();
else
Instance = this;
threadList = new List<TweenThread>();
threadVec3List = new List<TweenThreadVec3>();
}
protected override void onDestroy()
{
if (Instance == this)
Instance = null;
}
protected override void update()
{
foreach (TweenThread thread in threadList)
{
thread.Update(Time.DeltaTimeF);
}
foreach (TweenThreadVec3 thread in threadVec3List)
{
thread.Update(Time.DeltaTimeF);
}
}
public static TweenThread CreateTweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{
if (Instance == null)
return null;
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
Instance.threadList.Add(thread);
thread.Reset();
return thread;
}
public static TweenThreadVec3 CreateTweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
{
if (Instance == null)
return null;
TweenThreadVec3 thread = new TweenThreadVec3(duration, startValue, endValue, method);
Instance.threadVec3List.Add(thread);
thread.Reset();
return thread;
}
public class TweenThread
{
private float timer = 0.0f;
public float duration = 1.0f;
public EASING_METHOD method;
private float value = 0.0f;
public float startValue = 0.0f;
public float endValue = 1.0f;
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{
this.duration = duration;
this.method = method;
this.startValue = startValue;
this.endValue = endValue;
}
public void Update(float deltaTime)
{
if (timer >= duration)
return;
timer += deltaTime;
if (timer >= duration)
timer = duration;
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
}
public bool IsCompleted()
{
return timer >= duration;
}
public void Reset()
{
timer = 0.0f;
value = startValue;
}
public void Reset(float startValue, float endValue)
{
Reset();
this.startValue = startValue;
this.endValue = endValue;
}
public void ResetInvert()
{
Reset();
float temp = startValue;
startValue = endValue;
endValue = temp;
}
public float GetValue()
{
return value;
}
}
public class TweenThreadVec3
{
private float timer = 0.0f;
public float duration = 1.0f;
public EASING_METHOD method;
private Vector3 value = Vector3.Zero;
public Vector3 startValue = Vector3.Zero;
public Vector3 endValue = Vector3.Zero;
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
{
this.duration = duration;
this.method = method;
this.startValue = startValue;
this.endValue = endValue;
}
public void Update(float deltaTime)
{
if (timer >= duration)
return;
timer += deltaTime;
if (timer >= duration)
timer = duration;
value = (endValue - startValue) * EasingHelper.EaseHelp(timer / duration, method) + startValue;
}
public bool IsCompleted()
{
return timer >= duration;
}
public void Reset()
{
timer = 0.0f;
value = startValue;
}
public void Reset(Vector3 startValue, Vector3 endValue)
{
Reset();
this.startValue = startValue;
this.endValue = endValue;
}
public void ResetInvert()
{
Reset();
Vector3 temp = startValue;
startValue = endValue;
endValue = temp;
}
public Vector3 GetValue()
{
return value;
}
}
public class TweenManager : Script
{
public static TweenManager Instance { get; private set; }
[NonSerialized]
private List<TweenThread> threadList;
[NonSerialized]
private List<TweenThreadVec3> threadVec3List;
protected override void awake()
{
if (Instance != null && Instance != this)
RemoveScript<TweenManager>();
else
Instance = this;
threadList = new List<TweenThread>();
threadVec3List = new List<TweenThreadVec3>();
}
protected override void onDestroy()
{
if (Instance == this)
Instance = null;
}
protected override void update()
{
foreach (TweenThread thread in threadList)
{
thread.Update(Time.DeltaTimeF);
}
foreach (TweenThreadVec3 thread in threadVec3List)
{
thread.Update(Time.DeltaTimeF);
}
}
public static TweenThread CreateTweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{
if (Instance == null)
return null;
TweenThread thread = new TweenThread(duration, startValue, endValue, method);
Instance.threadList.Add(thread);
thread.Reset();
return thread;
}
public static TweenThreadVec3 CreateTweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
{
if (Instance == null)
return null;
TweenThreadVec3 thread = new TweenThreadVec3(duration, startValue, endValue, method);
Instance.threadVec3List.Add(thread);
thread.Reset();
return thread;
}
}
} }

View File

@ -15,17 +15,14 @@ public abstract class BaseState
} }
public virtual void OnEnter() public virtual void OnEnter()
{ {}
}
public abstract void update(); public abstract void update();
public abstract void fixedUpdate(); public abstract void fixedUpdate();
public virtual void OnExit() public virtual void OnExit()
{ {}
}
public string GetStateName() public string GetStateName()
{ {
@ -37,11 +34,6 @@ public abstract class BaseState
return animationName; return animationName;
} }
public virtual float GetAnimPercent()
{
return 1.0f;
}
public virtual void onCollisionEnter(CollisionInfo info) public virtual void onCollisionEnter(CollisionInfo info)
{ {
} }

View File

@ -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.

View File

@ -0,0 +1,3 @@
Name: ShadowMapAnim_VS
ID: 39393999
Type: 2

View File

@ -7,9 +7,6 @@ layout(location = 2) in vec3 aNormal;
layout(location = 3) in vec3 aTangent; layout(location = 3) in vec3 aTangent;
layout(location = 4) in mat4 worldTransform; layout(location = 4) in mat4 worldTransform;
layout(location = 8) in uvec2 integerData; layout(location = 8) in uvec2 integerData;
layout(location = 9) in uvec4 aBoneIndices;
layout(location = 10) in vec4 aBoneWeights;
layout(location = 11) in uint firstBoneIndex;
layout(location = 0) out struct layout(location = 0) out struct
{ {

View File

@ -40,6 +40,12 @@ layout(set = 1, binding = 0) uniform CameraData
mat4 projMat; mat4 projMat;
} cameraData; } cameraData;
layout (std430, set = 2, binding = 1) buffer AnimBoneMatrices
{
mat4 data[];
} BoneMatrices;
void main() void main()
{ {
Out2.materialIndex = gl_InstanceIndex; Out2.materialIndex = gl_InstanceIndex;
@ -63,6 +69,13 @@ void main()
Out.normal.rgb = transposeInv * aNormal.rgb; Out.normal.rgb = transposeInv * aNormal.rgb;
Out.normal.rgb = normalize (Out.normal.rgb); Out.normal.rgb = normalize (Out.normal.rgb);
// Compute bone matrix
mat4 boneMatrix = BoneMatrices.data[firstBoneIndex + aBoneIndices[0]] * aBoneWeights[0];
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[1]] * aBoneWeights[1];
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[2]] * aBoneWeights[2];
boneMatrix += BoneMatrices.data[firstBoneIndex + aBoneIndices[3]] * aBoneWeights[3];
// clip space for rendering // clip space for rendering
gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f); gl_Position = cameraData.vpMat * worldTransform * boneMatrix * vec4 (aVertexPos, 1.0f);
// gl_Position = cameraData.vpMat * worldTransform * vec4 (aVertexPos, 1.0f);
} }

View File

@ -0,0 +1,3 @@
Name: Button_Resume_Clicked
ID: 66776217
Type: 3

View File

@ -0,0 +1,3 @@
Name: Button_Resume_Default
ID: 63738242
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: Button_Resume_Hovered
ID: 58455648
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: Button_Retry_Clicked
ID: 60429179
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: Button_Retry_Default
ID: 64995894
Type: 3

View File

@ -1,3 +0,0 @@
Name: Button_Retry_Hover
ID: 58347825
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: Button_Retry_Hovered
ID: 58109178
Type: 3

View File

@ -1,3 +0,0 @@
Name: Button_Retry_Idle
ID: 64806384
Type: 3

View File

@ -1,3 +0,0 @@
Name: Button_Retry_Pressed
ID: 63234380
Type: 3

View File

@ -24,15 +24,13 @@ project "SHADE_CSharp"
{ {
"SHADE_Engine" "SHADE_Engine"
} }
warnings 'Extra'
postbuildcommands postbuildcommands
{ {
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.xml\" \"%{outputdir}\"", "xcopy /r /y /q \"%{wks.location}/bin/$(Configuration)\\net5.0\\SHADE_CSharp.pdb\" \"%{wks.location}/bin/$(Configuration)\""
"xcopy /r /y /q \"%{outputdir}\\net5.0\\SHADE_CSharp.pdb\" \"%{outputdir}\""
} }
warnings 'Extra'
filter "configurations:Debug" filter "configurations:Debug"
symbols "On" symbols "On"
defines {"_DEBUG"} defines {"_DEBUG"}

View File

@ -115,6 +115,7 @@ namespace SHADE
LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "Master.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "Master.strings.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "Music.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "Cinematics.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "SFX.bank").data());
LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data()); LoadBank((AUDIO_FOLDER_PATH + "UI.bank").data());
@ -133,11 +134,12 @@ namespace SHADE
const ReceiverPtr ON_PAUSE_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_PAUSE_RECEIVER); const ReceiverPtr ON_PAUSE_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_PAUSE_RECEIVER);
SHEventManager::SubscribeTo(SH_EDITOR_ON_PAUSE_EVENT, ON_PAUSE_RECEIVER_PTR); SHEventManager::SubscribeTo(SH_EDITOR_ON_PAUSE_EVENT, ON_PAUSE_RECEIVER_PTR);
#endif
const std::shared_ptr ON_SCENE_EXIT_RECEIVER{ std::make_shared<SHEventReceiverSpec<SHAudioSystem>>(this, &SHAudioSystem::onSceneExit) }; const std::shared_ptr ON_SCENE_EXIT_RECEIVER{ std::make_shared<SHEventReceiverSpec<SHAudioSystem>>(this, &SHAudioSystem::onSceneExit) };
const ReceiverPtr ON_SCENE_EXIT_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_SCENE_EXIT_RECEIVER); const ReceiverPtr ON_SCENE_EXIT_RECEIVER_PTR = std::dynamic_pointer_cast<SHEventReceiver>(ON_SCENE_EXIT_RECEIVER);
SHEventManager::SubscribeTo(SH_SCENE_EXIT_POST, ON_SCENE_EXIT_RECEIVER_PTR); SHEventManager::SubscribeTo(SH_SCENE_EXIT_POST, ON_SCENE_EXIT_RECEIVER_PTR);
#endif
} }
void SHADE::SHAudioSystem::Run(double dt) void SHADE::SHAudioSystem::Run(double dt)
@ -839,6 +841,7 @@ namespace SHADE
auto [begin, end] = audioClipLibrary.GetDenseAccess(); auto [begin, end] = audioClipLibrary.GetDenseAccess();
for (auto& it = begin; it != end; ++it) for (auto& it = begin; it != end; ++it)
{ {
it->instance->stop(FMOD_STUDIO_STOP_ALLOWFADEOUT);
it->instance->release(); it->instance->release();
} }

View File

@ -206,6 +206,16 @@ namespace SHADE
camera->dirtyView = true; camera->dirtyView = true;
} }
camera->offset = offset;
SHVec3 tOffset = pivot.GetTargetOffset();
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(pivot.GetYaw()));
if (pivot.lookAtCameraOrigin)
CameraLookAt(*camera, camera->position + tOffset);
@ -250,7 +260,7 @@ namespace SHADE
if (camera.isActive == false) if (camera.isActive == false)
return; return;
if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && &camera != &editorCamera) if (SHComponentManager::HasComponent<SHTransformComponent>(camera.GetEID()) == true && SHComponentManager::HasComponent<SHCameraArmComponent>(camera.GetEID()) == false && &camera != &editorCamera)
{ {
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID()); auto transform = SHComponentManager::GetComponent<SHTransformComponent>(camera.GetEID());
SHVec3 rotation = transform->GetWorldRotation(); SHVec3 rotation = transform->GetWorldRotation();
@ -273,14 +283,14 @@ namespace SHADE
{ {
camera.offset = arm->GetOffset(); camera.offset = arm->GetOffset();
SHVec3 tOffset = arm->GetTargetOffset(); /*SHVec3 tOffset = arm->GetTargetOffset();
tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw())); tOffset = SHVec3::RotateY(tOffset, SHMath::DegreesToRadians(arm->GetYaw()));
if (arm->lookAtCameraOrigin) if (arm->lookAtCameraOrigin)
CameraLookAt(camera, camera.position + arm->GetTargetOffset()); CameraLookAt(camera, camera.position + arm->GetTargetOffset());*/
} }

View File

@ -113,14 +113,15 @@ namespace SHADE
SHEditorWindowManager::CreateEditorWindow<SHAssetBrowser>(); SHEditorWindowManager::CreateEditorWindow<SHAssetBrowser>();
SHEditorWindowManager::CreateEditorWindow<SHMaterialInspector>(); SHEditorWindowManager::CreateEditorWindow<SHMaterialInspector>();
SHEditorWindowManager::CreateEditorWindow<SHColliderTagPanel>(); SHEditorWindowManager::CreateEditorWindow<SHColliderTagPanel>();
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
SHEditorWindowManager::CreateEditorWindow<SHInputBindingsPanel>(); SHEditorWindowManager::CreateEditorWindow<SHInputBindingsPanel>();
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
SHEditorWindowManager::CreateEditorWindow<SHAnimationControllerEditor>(); SHEditorWindowManager::CreateEditorWindow<SHAnimationControllerEditor>();
SHEditorWindowManager::CreateEditorWindow<SHRawAnimInspector>(); SHEditorWindowManager::CreateEditorWindow<SHRawAnimInspector>();
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
//Add popup windows //Add popup windows
SHEditorWindowManager::CreatePopupWindow<SHSceneSavePrompt>(); SHEditorWindowManager::CreatePopupWindow<SHSceneSavePrompt>();

View File

@ -726,16 +726,34 @@ namespace SHADE
cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0); cmdBuffer->BindVertexBuffer(SHGraphicsConstants::VertexBufferBindings::BONE_MATRIX_FIRST_INDEX, transformDataBuffer[frameIndex], 0);
} }
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING); if (IsAnimated())
if (instanceDataDescSet[frameIndex])
{ {
cmdBuffer->BindDescriptorSet auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM);
( if (instanceDataDescSet[frameIndex])
instanceDataDescSet[frameIndex], {
SH_PIPELINE_TYPE::GRAPHICS, cmdBuffer->BindDescriptorSet
descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_BATCH), (
dynamicOffset instanceDataDescSet[frameIndex],
); SH_PIPELINE_TYPE::GRAPHICS,
descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH),
dynamicOffset
);
}
}
else
{
auto const& descMappings = SHGraphicsPredefinedData::GetMappings(SHGraphicsPredefinedData::SystemType::BATCHING);
if (instanceDataDescSet[frameIndex])
{
cmdBuffer->BindDescriptorSet
(
instanceDataDescSet[frameIndex],
SH_PIPELINE_TYPE::GRAPHICS,
descMappings.at(SHPredefinedDescriptorTypes::PER_INSTANCE_BATCH),
dynamicOffset
);
}
} }
cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size())); cmdBuffer->DrawMultiIndirect(drawDataBuffer[frameIndex], static_cast<uint32_t>(drawData.size()));
cmdBuffer->EndLabeledSegment(); cmdBuffer->EndLabeledSegment();

View File

@ -17,6 +17,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h" #include "Graphics/MiddleEnd/Interface/SHMaterialInstance.h"
#include "Graphics/MiddleEnd/Interface/SHRenderable.h" #include "Graphics/MiddleEnd/Interface/SHRenderable.h"
#include "Graphics/Descriptors/SHVkDescriptorPool.h" #include "Graphics/Descriptors/SHVkDescriptorPool.h"
#include "Graphics/Commands/SHVkCommandBuffer.h"
namespace SHADE namespace SHADE
{ {
@ -108,11 +109,19 @@ namespace SHADE
} }
} }
void SHSuperBatch::Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline /*= true*/) noexcept void SHSuperBatch::Draw(Handle<SHVkCommandBuffer> cmdBuffer, uint32_t frameIndex, bool bindBatchPipeline /*= true*/, Handle<SHVkPipeline> nonAnimPipeline/* = {}*/, Handle<SHVkPipeline> animPipeline/* = {}*/) noexcept
{ {
// Build all batches // Build all batches
for (auto& batch : batches) for (auto& batch : batches)
{ {
if (!bindBatchPipeline)
{
if (batch.IsAnimated())
cmdBuffer->BindPipeline(animPipeline);
else
cmdBuffer->BindPipeline(nonAnimPipeline);
}
batch.Draw(cmdBuffer, frameIndex, bindBatchPipeline); batch.Draw(cmdBuffer, frameIndex, bindBatchPipeline);
} }
} }

View File

@ -57,7 +57,7 @@ namespace SHADE
void Clear() noexcept; void Clear() noexcept;
void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool); void UpdateBuffers(uint32_t frameIndex, Handle<SHVkDescriptorPool> descPool);
void Build(Handle<SHVkLogicalDevice> device, Handle<SHVkDescriptorPool> descPool, uint32_t frameIndex) noexcept; 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 */ /* Getter Functions */

View File

@ -14,6 +14,7 @@ namespace SHADE
std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::predefinedLayouts; std::vector<Handle<SHVkDescriptorSetLayout>> SHGraphicsPredefinedData::predefinedLayouts;
SHVertexInputState SHGraphicsPredefinedData::defaultVertexInputState; SHVertexInputState SHGraphicsPredefinedData::defaultVertexInputState;
SHVertexInputState SHGraphicsPredefinedData::shadowMapVertexInputState; SHVertexInputState SHGraphicsPredefinedData::shadowMapVertexInputState;
SHVertexInputState SHGraphicsPredefinedData::shadowMapAnimVertexInputState;
std::vector<SHGraphicsPredefinedData::PerSystem> SHGraphicsPredefinedData::perSystemData; std::vector<SHGraphicsPredefinedData::PerSystem> SHGraphicsPredefinedData::perSystemData;
@ -36,7 +37,8 @@ namespace SHADE
{SHPredefinedDescriptorTypes::STATIC_DATA, 0}, {SHPredefinedDescriptorTypes::STATIC_DATA, 0},
{SHPredefinedDescriptorTypes::CAMERA, 1}, {SHPredefinedDescriptorTypes::CAMERA, 1},
{SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH, 2}, {SHPredefinedDescriptorTypes::PER_INSTANCE_ANIM_BATCH, 2},
}); {SHPredefinedDescriptorTypes::RENDER_GRAPH_RESOURCE, 3},
});
perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descMappings.AddMappings perSystemData[SHUtilities::ConvertEnum(SystemType::TEXT_RENDERING)].descMappings.AddMappings
({ ({
@ -333,6 +335,17 @@ namespace SHADE
shadowMapVertexInputState.AddBinding(false, false, { SHVertexAttribute(SHAttribFormat::FLOAT_3D)}); 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) 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 void SHGraphicsPredefinedData::Init(Handle<SHVkLogicalDevice> logicalDevice) noexcept
@ -368,6 +381,11 @@ namespace SHADE
return shadowMapVertexInputState; return shadowMapVertexInputState;
} }
SHVertexInputState const& SHGraphicsPredefinedData::GetShadowMapAnimViState(void) noexcept
{
return shadowMapAnimVertexInputState;
}
SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetSystemData(SystemType systemType) noexcept SHGraphicsPredefinedData::PerSystem const& SHGraphicsPredefinedData::GetSystemData(SystemType systemType) noexcept
{ {
return perSystemData[static_cast<uint32_t>(systemType)]; return perSystemData[static_cast<uint32_t>(systemType)];

View File

@ -67,6 +67,9 @@ namespace SHADE
//! vertex input state for shadow mapping //! vertex input state for shadow mapping
static SHVertexInputState shadowMapVertexInputState; static SHVertexInputState shadowMapVertexInputState;
//! vertex input state for shadow mapping
static SHVertexInputState shadowMapAnimVertexInputState;
//! Predefined data for each type of system //! Predefined data for each type of system
static std::vector<PerSystem> perSystemData; static std::vector<PerSystem> perSystemData;
@ -101,6 +104,7 @@ namespace SHADE
static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes types) noexcept; static std::vector<Handle<SHVkDescriptorSetLayout>> GetPredefinedDescSetLayouts (SHGraphicsPredefinedData::PredefinedDescSetLayoutTypes types) noexcept;
static SHVertexInputState const& GetDefaultViState (void) noexcept; static SHVertexInputState const& GetDefaultViState (void) noexcept;
static SHVertexInputState const& GetShadowMapViState (void) noexcept; static SHVertexInputState const& GetShadowMapViState (void) noexcept;
static SHVertexInputState const& GetShadowMapAnimViState (void) noexcept;
static PerSystem const& GetSystemData (SystemType systemType) noexcept; static PerSystem const& GetSystemData (SystemType systemType) noexcept;
static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept; static SHDescriptorMappings::MapType const& GetMappings (SystemType systemType) noexcept;
//static PerSystem const& GetBatchingSystemData(void) noexcept; //static PerSystem const& GetBatchingSystemData(void) noexcept;

View File

@ -128,8 +128,9 @@ namespace SHADE
SHFreetypeInstance::Init(); SHFreetypeInstance::Init();
SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.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/ShadowMap_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false);
@ -145,24 +146,25 @@ namespace SHADE
//SHAssetManager::CompileAsset("../../Assets/Shaders/Anim_VS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/Anim_VS.glsl", false);
// Load Built In Shaders // Load Built In Shaders
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT); static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
static constexpr AssetID VS_ANIM = 47911992; animtVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_ANIM); static constexpr AssetID VS_ANIM = 47911992; animtVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_ANIM);
static constexpr AssetID FS_DEFAULT = 46377769; defaultFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEFAULT); static constexpr AssetID FS_DEFAULT = 46377769; defaultFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEFAULT);
static constexpr AssetID VS_DEBUG = 48002439; debugVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEBUG); static constexpr AssetID VS_DEBUG = 48002439; debugVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEBUG);
static constexpr AssetID FS_DEBUG = 36671027; debugFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEBUG); static constexpr AssetID FS_DEBUG = 36671027; debugFragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(FS_DEBUG);
static constexpr AssetID VS_DEBUG_MESH = 42127043; debugMeshVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEBUG_MESH); static constexpr AssetID VS_DEBUG_MESH = 42127043; debugMeshVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEBUG_MESH);
static constexpr AssetID CS_COMPOSITE = 45072428; deferredCompositeShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(CS_COMPOSITE); static constexpr AssetID CS_COMPOSITE = 45072428; deferredCompositeShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(CS_COMPOSITE);
static constexpr AssetID SSAO = 38430899; ssaoShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO); static constexpr AssetID SSAO = 38430899; ssaoShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO);
static constexpr AssetID SSAO_BLUR = 39760835; ssaoBlurShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO_BLUR); static constexpr AssetID SSAO_BLUR = 39760835; ssaoBlurShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(SSAO_BLUR);
static constexpr AssetID TEXT_VS = 39816727; textVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_VS); static constexpr AssetID TEXT_VS = 39816727; textVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_VS);
static constexpr AssetID TEXT_FS = 38024754; textFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_FS); static constexpr AssetID TEXT_FS = 38024754; textFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TEXT_FS);
static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(RENDER_SC_VS); 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 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_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_VS);
static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS); static constexpr AssetID SHADOW_MAP_ANIM_VS = 39393999; shadowMapAnimVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_ANIM_VS);
static constexpr AssetID TRAJECTORY_VS = 41042628; trajectoryVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_VS); static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_MAP_FS);
static constexpr AssetID TRAJECTORY_FS = 45635685; trajectoryFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_FS); static constexpr AssetID TRAJECTORY_VS = 41042628; trajectoryVS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_VS);
static constexpr AssetID SHADOW_BLUR_CS = 38004013; shadowMapBlurCS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_BLUR_CS); static constexpr AssetID TRAJECTORY_FS = 45635685; trajectoryFS = SHResourceManager::LoadOrGet<SHVkShaderModule>(TRAJECTORY_FS);
static constexpr AssetID SHADOW_BLUR_CS = 38004013; shadowMapBlurCS = SHResourceManager::LoadOrGet<SHVkShaderModule>(SHADOW_BLUR_CS);
} }
@ -919,10 +921,19 @@ namespace SHADE
SHGraphicsPredefinedData::SystemType::BATCHING, SHGraphicsPredefinedData::SystemType::BATCHING,
SHGraphicsPredefinedData::GetShadowMapViState(), rasterState SHGraphicsPredefinedData::GetShadowMapViState(), rasterState
); );
tempLibrary.CreateGraphicsPipelines
(
{ shadowMapAnimVS, shadowMapFS }, shadowMapNode->GetRenderpass(), shadowMapDrawSubpass,
SHGraphicsPredefinedData::SystemType::BATCHING_ANIM,
SHGraphicsPredefinedData::GetShadowMapAnimViState(), rasterState
);
shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS, shadowMapDrawSubpass }); shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS, shadowMapDrawSubpass });
shadowMapAnimPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapAnimVS, shadowMapFS, shadowMapDrawSubpass });
} }
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteSubpass, shadowMapPipeline); // set companion subpass and pipeline shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteSubpass, shadowMapPipeline, shadowMapAnimPipeline); // set companion subpass and pipeline
shadowMapDrawSubpass->AddCompanionSubpass(gBufferWriteVfxSubpass, shadowMapPipeline); // 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 // 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); uint32_t const NEW_SHADOW_MAP_INDEX = lightingSubSystem->AddShadowMap(renderGraph->GetRenderGraphResource(shadowMapBlurredResourceName), EVENT_DATA->lightEntity);

View File

@ -479,6 +479,7 @@ namespace SHADE
Handle<SHVkShaderModule> renderToSwapchainVS; Handle<SHVkShaderModule> renderToSwapchainVS;
Handle<SHVkShaderModule> renderToSwapchainFS; Handle<SHVkShaderModule> renderToSwapchainFS;
Handle<SHVkShaderModule> shadowMapVS; Handle<SHVkShaderModule> shadowMapVS;
Handle<SHVkShaderModule> shadowMapAnimVS;
Handle<SHVkShaderModule> shadowMapFS; Handle<SHVkShaderModule> shadowMapFS;
Handle<SHVkShaderModule> trajectoryVS; Handle<SHVkShaderModule> trajectoryVS;
Handle<SHVkShaderModule> trajectoryFS; Handle<SHVkShaderModule> trajectoryFS;
@ -499,6 +500,7 @@ namespace SHADE
Handle<SHVkPipeline> debugDrawFilledPipeline; Handle<SHVkPipeline> debugDrawFilledPipeline;
Handle<SHVkPipeline> debugDrawFilledDepthPipeline; Handle<SHVkPipeline> debugDrawFilledDepthPipeline;
Handle<SHVkPipeline> shadowMapPipeline; // initialized only when a shadow map is needed 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; Handle<SHVkDescriptorSetGroup> genericAndTextureDescSet;

View File

@ -497,7 +497,7 @@ namespace SHADE
} }
// get target node // 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)); auto node = nodes.insert(targetNode, renderGraphStorage->resourceHub->Create<SHRenderGraphNode>(nodeName, renderGraphStorage, std::move(descInitParams), std::vector<Handle<SHRenderGraphNode>>(), true));
ReindexNodes (); ReindexNodes ();

View File

@ -280,8 +280,8 @@ namespace SHADE
for (auto& companion : companionSubpasses) for (auto& companion : companionSubpasses)
{ {
// if not bind pipeline for companion and and execute draw command // if not bind pipeline for companion and and execute draw command
commandBuffer->BindPipeline(companion.pipeline); //commandBuffer->BindPipeline(companion.nonAnimPipeline);
companion.subpass->superBatch->Draw(commandBuffer, frameIndex, false); companion.subpass->superBatch->Draw(commandBuffer, frameIndex, false, companion.nonAnimPipeline, companion.animPipeline);
} }
} }
} }
@ -496,7 +496,7 @@ namespace SHADE
{ {
if (!dummyPipelineLayout) if (!dummyPipelineLayout)
{ {
auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING); auto const& batchingSystemData = SHGraphicsPredefinedData::GetSystemData(SHGraphicsPredefinedData::SystemType::BATCHING_ANIM);
std::vector newLayouts = batchingSystemData.descSetLayouts; std::vector newLayouts = batchingSystemData.descSetLayouts;
if (inputDescriptorLayout) if (inputDescriptorLayout)
{ {
@ -528,9 +528,9 @@ namespace SHADE
subpassIndex = index; subpassIndex = index;
} }
void SHSubpass::AddCompanionSubpass(Handle<SHSubpass> companion, Handle<SHVkPipeline> pipeline) noexcept void SHSubpass::AddCompanionSubpass(Handle<SHSubpass> companion, Handle<SHVkPipeline> nonAnimPipeline, Handle<SHVkPipeline> animPipeline) noexcept
{ {
companionSubpasses.push_back(CompanionSubpass{companion, pipeline}); companionSubpasses.push_back(CompanionSubpass{companion, nonAnimPipeline, animPipeline});
//companionSubpass.companion = companion; //companionSubpass.companion = companion;
//companionSubpass.pipeline = pipeline; //companionSubpass.pipeline = pipeline;
} }

View File

@ -35,8 +35,11 @@ namespace SHADE
// subpass whose data will be borrowed to draw // subpass whose data will be borrowed to draw
Handle<SHSubpass> subpass; Handle<SHSubpass> subpass;
// Pipeline that will be used for all the draw calls from all batches of the companion subpass // Pipeline that will be used for all the draw calls from all batches (that render without animation data) of the companion subpass
Handle<SHVkPipeline> pipeline; Handle<SHVkPipeline> nonAnimPipeline;
// Pipeline that will be used for all the draw calls from all batches (that render with animation data) of the companion subpass
Handle<SHVkPipeline> animPipeline;
}; };
private: private:
@ -167,7 +170,7 @@ namespace SHADE
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
/* PUBLIC SETTERS AND GETTERS */ /* PUBLIC SETTERS AND GETTERS */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
void AddCompanionSubpass (Handle<SHSubpass> companion, Handle<SHVkPipeline> pipeline) noexcept; void AddCompanionSubpass (Handle<SHSubpass> companion, Handle<SHVkPipeline> nonAnimPipeline, Handle<SHVkPipeline> animPipeline) noexcept;
Handle<SHRenderGraphNode> GetParentNode(void) const noexcept; Handle<SHRenderGraphNode> GetParentNode(void) const noexcept;
SHSubPassIndex GetIndex() const noexcept; SHSubPassIndex GetIndex() const noexcept;

View File

@ -798,17 +798,45 @@ namespace SHADE
//Get cursor position, even when it is outside window //Get cursor position, even when it is outside window
POINT p; POINT p;
GetCursorPos(&p); GetCursorPos(&p); //This point is WRT the screen, not the window
//ScreenToClient(GetActiveWindow(), &p);
mouseScreenX = p.x; mouseScreenX = p.x;
mouseScreenY = p.y; mouseScreenY = p.y;
//SHLOGV_INFO("MouseScreenY = {}", mouseScreenY);
//Velocity if (!mouseCentering)
mouseVelocityX = static_cast<double>(mouseScreenX - mouseScreenXLast) / dt; {
mouseVelocityY = static_cast<double>(mouseScreenY - mouseScreenYLast) / dt; //Velocity
mouseVelocityX = static_cast<double>(mouseScreenX - mouseScreenXLast) / dt;
mouseVelocityY = static_cast<double>(mouseScreenY - mouseScreenYLast) / dt;
}
else
{
//Mouse centering
//uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
//uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
int mouseCenterX = 0;
int mouseCenterY = 0;
RECT wndRect = { NULL }; //4th quadrant
if (GetWindowRect(GetActiveWindow(), &wndRect))
{
mouseCenterX = wndRect.left + (wndRect.right - wndRect.left) / 2;
mouseCenterY = wndRect.top + (wndRect.bottom - wndRect.top) / 2;
//SHLOGV_INFO("W: {0}, H: {1}", (wndRect.right - wndRect.left), (wndRect.bottom - wndRect.top));
}
//Velocity
mouseVelocityX = static_cast<double>(mouseScreenX - mouseCenterX) / dt;
mouseVelocityY = static_cast<double>(mouseScreenY - mouseCenterY) / dt;
//SHLOGV_INFO("mouseScreenY = {0:0}, mouseCenterY = {1:0}", mouseScreenY, mouseCenterY);
//SHLOGV_INFO("{0.0}", mouseVelocityY);
SetMouseScreenPosition(mouseCenterX, mouseCenterY);
}
//Mouse Centering //Mouse Centering
if (mouseCentering) /*if (mouseCentering)
{ {
uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth(); uint32_t width = SHADE::SHGraphicsSystemInterface::GetWindowWidth();
uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight(); uint32_t height = SHADE::SHGraphicsSystemInterface::GetWindowHeight();
@ -819,7 +847,7 @@ namespace SHADE
GetCursorPos(&p); GetCursorPos(&p);
mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt; mouseVelocityX -= static_cast<double>(p.x - mouseScreenX) / dt;
mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt; mouseVelocityY -= static_cast<double>(p.y - mouseScreenY) / dt;
} }*/
if (mouseVelocityX != 0.0 || mouseVelocityY != 0.0) if (mouseVelocityX != 0.0 || mouseVelocityY != 0.0)
controllerInUse = false; controllerInUse = false;

View File

@ -882,6 +882,11 @@ namespace SHADE
System::Collections::Generic::IEnumerable<System::Type^>^ selectorFunc(System::Reflection::Assembly^ assembly) System::Collections::Generic::IEnumerable<System::Type^>^ selectorFunc(System::Reflection::Assembly^ assembly)
{ {
if (assembly == nullptr)
{
Debug::LogError("[ScriptStore] Received null assembly while collecting Script types. This should not happen!");
return nullptr;
}
return assembly->GetExportedTypes(); return assembly->GetExportedTypes();
} }
Pair^ resultSelectorFunc(System::Reflection::Assembly^ assembly, System::Type^ type) Pair^ resultSelectorFunc(System::Reflection::Assembly^ assembly, System::Type^ type)