Merge pull request #399 from SHADE-DP/PlayerController

Updates for presentation build
This commit is contained in:
XiaoQiDigipen 2023-03-05 15:41:21 +08:00 committed by GitHub
commit 6472119648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 4686 additions and 2033 deletions

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 51238312
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: CutScene_04a
ID: 130935405
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 61471971
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: CutScene_04b
ID: 122461516
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 58217538
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: CutScene_04c
ID: 124507864
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 61980534
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: CutScene_05a
ID: 118069989
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 51561286
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: CutScene_05b
ID: 132945336
Type: 7

View File

@ -0,0 +1,334 @@
- EID: 1
Name: Canvas4
IsActive: true
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 10
Name: CutScene4
IsActive: true
NumberOfChildren: 3
Components:
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 2
Name: pic1
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -1275, y: 255, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1313, y: 544, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 130935405
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 65542
Name: pic2
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1600, y: 150, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 640, y: 661, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 122461516
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 5
Name: pic3
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -1000, y: -275, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1848, y: 575, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 124507864
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 11
Name: Background
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.699999988}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 117531460
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 12
Name: Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 250, y: -500, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 50, y: 50, z: 50}
IsActive: true
Text Renderer Component:
Text: Press Space to contiune
Font: 176667660
Color: {x: 0, y: 0, z: 0, w: 1}
Text Size: {x: 1, y: 1, z: 1}
IsActive: true
UI Component:
Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 3
Name: Camera
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0, y: 0, z: 0}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1920
Near: 0.00999999978
Far: 10000
Perspective: true
FOV: 90
IsActive: true
Scripts: ~
- EID: 7
Name: CutsceneManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: CutsceneEnd
Enabled: true
nextScene: 92009475
duration: 1
skipDuration: 0.100000001
cutscene4Points: 4
cutscene4Pics: 10
cutscene5Points: 21
cutscene5Pics: 15
canvas4: 1
canvas5: 14
- EID: 4
Name: CutScene4Points
IsActive: true
NumberOfChildren: 3
Components: ~
Scripts: ~
- EID: 9
Name: Pic1Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -275, y: 255, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 8
Name: Pic2Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 600, y: 150, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 65549
Name: Pic3Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -275, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 14
Name: Canvas5
IsActive: false
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: false
Scripts: ~
- EID: 15
Name: CutScene5
IsActive: true
NumberOfChildren: 2
Components:
UI Component:
Canvas ID: 14
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 16
Name: pic1
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -600, y: 1000, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 634, y: 1027, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 118069989
IsActive: true
UI Component:
Canvas ID: 14
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 17
Name: pic2
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 250, y: -1000, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1337, y: 1028, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 132945336
IsActive: true
UI Component:
Canvas ID: 14
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 19
Name: Background
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.699999988}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 117531460
IsActive: true
UI Component:
Canvas ID: 14
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 20
Name: Text
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 250, y: -500, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 50, y: 50, z: 50}
IsActive: true
Text Renderer Component:
Text: Press Space to contiune
Font: 176667660
Color: {x: 0, y: 0, z: 0, w: 1}
Text Size: {x: 1, y: 1, z: 1}
IsActive: false
UI Component:
Canvas ID: 14
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 21
Name: CutScene5Points
IsActive: true
NumberOfChildren: 2
Components: ~
Scripts: ~
- EID: 22
Name: Pic1Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -600, y: 0, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
- EID: 23
Name: Pic2Point
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 250, y: 0, z: 0.400000006}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~

View File

@ -0,0 +1,3 @@
Name: CutSceneEnd
ID: 84606951
Type: 5

View File

@ -113,6 +113,8 @@
Text Renderer Component: Text Renderer Component:
Text: Press Space to contiune Text: Press Space to contiune
Font: 176667660 Font: 176667660
Color: {x: 0, y: 0, z: 0, w: 1}
Text Size: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 1 Canvas ID: 1
@ -148,9 +150,11 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: ~ Components: ~
Scripts: Scripts:
- Type: Cutscene - Type: CutsceneIntro
Enabled: true Enabled: true
duration: 2 nextScene: 96668835
duration: 1
skipDuration: 0.100000001
cutscene1Points: 4 cutscene1Points: 4
cutscene1Pics: 10 cutscene1Pics: 10
cutscene2Points: 20 cutscene2Points: 20
@ -314,6 +318,8 @@
Text Renderer Component: Text Renderer Component:
Text: Press Space to contiune Text: Press Space to contiune
Font: 176667660 Font: 176667660
Color: {x: 0, y: 0, z: 0, w: 1}
Text Size: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 13 Canvas ID: 13
@ -448,7 +454,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -1425, y: -200, z: 0.5} Translate: {x: -1600, y: -200, z: 0.5}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1299, y: 575, z: 1} Scale: {x: 1299, y: 575, z: 1}
IsActive: true IsActive: true
@ -515,6 +521,8 @@
Text Renderer Component: Text Renderer Component:
Text: Press Space to contiune Text: Press Space to contiune
Font: 176667660 Font: 176667660
Color: {x: 0, y: 0, z: 0, w: 1}
Text Size: {x: 1, y: 1, z: 1}
IsActive: false IsActive: false
UI Component: UI Component:
Canvas ID: 24 Canvas ID: 24

View File

@ -2418,7 +2418,7 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0.5, y: -299.5, z: 0.5} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001} Translate: {x: 0, y: 0, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1} Scale: {x: 1920, y: 1080, z: 1}
IsActive: true IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 75, z: 0} Translate: {x: 0, y: 75, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -200, z: 0} Translate: {x: 0, y: -200, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true

View File

@ -97,7 +97,7 @@
Scripts: Scripts:
- Type: ChangeSceneButton - Type: ChangeSceneButton
Enabled: true Enabled: true
sceneID: 96668835 sceneID: 91947920
- Type: SHADE_Scripting.UI.ButtonFX - Type: SHADE_Scripting.UI.ButtonFX
Enabled: true Enabled: true
onHoverEnterSound: Empty onHoverEnterSound: Empty

View File

@ -29,7 +29,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001} Translate: {x: 0, y: 0, z: 0.300000012}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1} Scale: {x: 1920, y: 1080, z: 1}
IsActive: true IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 75, z: 0} Translate: {x: 0, y: 75, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -200, z: 0} Translate: {x: 0, y: -200, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true

View File

@ -21,12 +21,12 @@ public class PickAndThrow : Script
private Collider itemCollider; private Collider itemCollider;
private Item itemScript; private Item itemScript;
private Transform raccoonHoldLocation; private Transform raccoonHoldLocation;
private ThirdPersonCamera tpc; public ThirdPersonCamera tpc { get; set; }
private float lastXDir; private float lastXDir;
private float lastZDir; private float lastZDir;
private bool inRange = false; private bool inRange = false;
public bool throwItem = false; public bool throwItem = false;
private Vector3 prevTargetOffSet; public Vector3 prevTargetOffSet { get; set; }
[Tooltip("Lenght of ray")] [Tooltip("Lenght of ray")]
public float rayDistance = 1; public float rayDistance = 1;
@ -165,7 +165,7 @@ public class PickAndThrow : Script
} }
} }
private void ResetItemObject() public void ResetItemObject()
{ {
itemRidigBody = null; itemRidigBody = null;
itemTransform = null; itemTransform = null;

View File

@ -22,7 +22,7 @@ public class PlayerController : Script
public Camera cam { get; set; } public Camera cam { get; set; }
public CameraArm camArm { get; set; } public CameraArm camArm { get; set; }
private PickAndThrow pat; private PickAndThrow pat;
public StateMachine stateMachine; public StateMachine stateMachine { get; set; }
public bool holdItem { get; set; } public bool holdItem { get; set; }
public bool isAiming { get; set; } public bool isAiming { get; set; }
@ -78,9 +78,9 @@ public class PlayerController : Script
//silhouette===================================================================== //silhouette=====================================================================
public GameObject silhouettePlayer; public GameObject silhouettePlayer;
public Renderable silhouettePlayerRend; private Renderable silhouettePlayerRend;
public GameObject silhouetteBag; public GameObject silhouetteBag;
public Renderable silhouetteBagRend; private Renderable silhouetteBagRend;
protected override void awake() protected override void awake()
{ {
@ -348,7 +348,7 @@ public class PlayerController : Script
if (isMoveKeyPress && tranform && !isAiming) if (isMoveKeyPress && tranform && !isAiming)
{ {
Quaternion currentRotation = tranform.LocalRotation; Quaternion currentRotation = tranform.LocalRotation;
Quaternion targetRotation = Quaternion.LookRotation(new Vector3(axisMove.x, 0.0f, axisMove.y), Vector3.Up); Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(axisMove.x,axisMove.y), 0.0f);
tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.FixedDeltaTime); tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.FixedDeltaTime);
} }
else if (camArm && tranform && isAiming) else if (camArm && tranform && isAiming)
@ -408,11 +408,20 @@ public class PlayerController : Script
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition; tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
if (pat && pat.item) if (pat && pat.item)
{
if (holdItem)
{ {
holdItem = false; holdItem = false;
isAiming = false;
pat.item.GetScript<Item>().returnBack = true; pat.item.GetScript<Item>().returnBack = true;
} }
if (isAiming)
{
isAiming = false;
cam.FOV = pat.defaultFOV;
camArm.TargetOffset = pat.prevTargetOffSet;
camArm.ArmLength = pat.tpc.armLength;
}
}
} }
} }

View File

@ -27,7 +27,7 @@ namespace SHADE_Scripting
{ {
AddComponent<Camera>(); AddComponent<Camera>();
} }
GetComponent<Camera>().SetMainCamera();
if (!GetComponent<CameraArm>()) if (!GetComponent<CameraArm>())
{ {
AddComponent<CameraArm>(); AddComponent<CameraArm>();

View File

@ -94,6 +94,8 @@ public class GameManager : Script
if (SceneFadeInOut.Instance != null) if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeOut(); SceneFadeInOut.Instance.CallFadeOut();
Application.IsCursorVisible = false; Application.IsCursorVisible = false;
GamePause = false;
} }
protected override void update() protected override void update()

View File

@ -39,8 +39,6 @@ namespace SHADE_Scripting.UI
if (listOfCamera.Count == 0) if (listOfCamera.Count == 0)
Debug.LogError("EMPTY PREVIEW POINTS"); Debug.LogError("EMPTY PREVIEW POINTS");
listOfCamera[0].SetMainCamera();
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE); 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); 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); moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
@ -48,29 +46,35 @@ namespace SHADE_Scripting.UI
} }
protected override void start()
{
listOfCamera[0].SetMainCamera();
}
protected override void update() protected override void update()
{ {
if (!SceneFadeInOut.Instance.FadeOutFinished() && !point1Done) if (SceneFadeInOut.Instance && !SceneFadeInOut.Instance.FadeOutFinished() && !point1Done)
{ {
moveToEndPoint1.Reset(); moveToEndPoint1.Reset();
return; return;
} }
if (Input.GetKeyUp(Input.KeyCode.Space)) if (Input.GetKeyUp(Input.KeyCode.Space) && !point3Done)
{ {
skip = true; skip = true;
point1Done = true; point1Done = true;
point3Done = true;
SceneFadeInOut.Instance.CallFadeIn(); SceneFadeInOut.Instance.CallFadeIn();
SceneFadeInOut.Instance.alphaValue = 0.01f; SceneFadeInOut.Instance.alphaValue = 0.01f;
} }
if (skip && SceneFadeInOut.Instance.FadeInFinished()) if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished())
{ {
playerCamera.GetComponent<Camera>().SetMainCamera(); playerCamera.GetComponent<Camera>().SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut(); SceneFadeInOut.Instance.CallFadeOut();
} }
if (skip && SceneFadeInOut.Instance.FadeOutFinished()) if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished())
{ {
GameManager.Instance.PreviewLevelDone = true; GameManager.Instance.PreviewLevelDone = true;
} }
@ -81,7 +85,7 @@ namespace SHADE_Scripting.UI
if (!point1Done) if (!point1Done)
{ {
listOfCamera[0].GetComponent<Transform>().LocalPosition = moveToEndPoint1.GetValue(); listOfCamera[0].GetComponent<Transform>().LocalPosition = moveToEndPoint1.GetValue();
if (moveToEndPoint1.IsCompleted()) if (SceneFadeInOut.Instance && moveToEndPoint1.IsCompleted())
{ {
point1Done = true; point1Done = true;
SceneFadeInOut.Instance.CallFadeIn(); SceneFadeInOut.Instance.CallFadeIn();
@ -89,13 +93,13 @@ namespace SHADE_Scripting.UI
} }
} }
if (SceneFadeInOut.Instance.FadeInFinished() && point1Done) if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point1Done)
{ {
listOfCamera[1].SetMainCamera(); listOfCamera[1].SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut(); SceneFadeInOut.Instance.CallFadeOut();
} }
if (SceneFadeInOut.Instance.FadeOutFinished() && point1Done) if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point1Done)
{ {
if (!point2Done) if (!point2Done)
{ {
@ -114,13 +118,13 @@ namespace SHADE_Scripting.UI
} }
} }
if (SceneFadeInOut.Instance.FadeInFinished() && point2Done) if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point2Done)
{ {
listOfCamera[2].SetMainCamera(); listOfCamera[2].SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut(); SceneFadeInOut.Instance.CallFadeOut();
} }
if (SceneFadeInOut.Instance.FadeOutFinished() && point2Done) if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point2Done)
{ {
if (!point3Done) if (!point3Done)
{ {
@ -139,13 +143,13 @@ namespace SHADE_Scripting.UI
} }
} }
if (SceneFadeInOut.Instance.FadeInFinished() && point3Done) if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point3Done)
{ {
playerCamera.GetComponent<Camera>().SetMainCamera(); playerCamera.GetComponent<Camera>().SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut(); SceneFadeInOut.Instance.CallFadeOut();
} }
if (SceneFadeInOut.Instance.FadeOutFinished() && point3Done) if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point3Done)
{ {
GameManager.Instance.PreviewLevelDone = true; GameManager.Instance.PreviewLevelDone = true;
} }

View File

@ -1,4 +1,4 @@
using SHADE; using SHADE;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@ -0,0 +1,317 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SHADE;
public class CutsceneEnd : Script
{
public uint nextScene;
public float duration = 3.0f;
public float skipDuration = 0.1f;
private float oldDuration = 0.0f;
private Renderable pic4aRenderable;
private Renderable pic4bRenderable;
private Renderable pic4cRenderable;
private Renderable pic5aRenderable;
private Renderable pic5bRenderable;
private Transform pic4aTran;
private Transform pic4bTran;
private Transform pic4cTran;
private Transform pic5aTran;
private Transform pic5bTran;
private float alphaIn = 0.0f;
private float time = 0.0f;
private bool showPic4a = true;
private bool showPic4b = false;
private bool showPic4c = false;
private bool showPic5a = true;
private bool showPic5b = false;
private bool skip = false;
public GameObject cutscene4Points;
private List<Transform> listOfCutscene4Points;
public GameObject cutscene4Pics;
private List<Renderable> listOfCutscene4Pics;
public GameObject cutscene5Points;
private List<Transform> listOfCutscene5Points;
public GameObject cutscene5Pics;
private List<Renderable> listOfCutscene5Pics;
private TextRenderable text4;
private TextRenderable text5;
public GameObject canvas4;
public GameObject canvas5;
private bool cutscene4Done = false;
private bool cutscene5Done = false;
protected override void awake()
{
initCutscene4();
initCutscene5();
}
protected override void update()
{
Canvas4();
Canvas5();
if (Input.GetKeyDown(Input.KeyCode.Space) && !skip && (!cutscene4Done || !cutscene5Done))
{
skip = true;
oldDuration = duration;
duration = skipDuration;
}
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
{
canvas4.SetActive(false);
canvas5.SetActive(true);
duration = oldDuration;
skip = false;
}
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene5Done && canvas5.IsActiveSelf)
{
SceneManager.ChangeScene(nextScene);
}
}
private void Canvas4()
{
if (canvas4.IsActiveSelf)
{
if (showPic4a)
{
if (time < duration)
{
pic4aTran.LocalPosition = Vector3.Lerp(pic4aTran.LocalPosition, listOfCutscene4Points[0].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic4aTran.LocalPosition = listOfCutscene4Points[0].LocalPosition;
alphaIn = 1.0f;
}
pic4aRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic4a = false;
showPic4b = true;
time = 0;
alphaIn = 0;
}
}
if (showPic4b)
{
if (time < duration)
{
pic4bTran.LocalPosition = Vector3.Lerp(pic4bTran.LocalPosition, listOfCutscene4Points[1].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic4bTran.LocalPosition = listOfCutscene4Points[1].LocalPosition;
alphaIn = 1.0f;
}
pic4bRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic4b = false;
showPic4c = true;
time = 0;
alphaIn = 0;
}
}
if (showPic4c)
{
if (time < duration)
{
pic4cTran.LocalPosition = Vector3.Lerp(pic4cTran.LocalPosition, listOfCutscene4Points[2].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic4cTran.LocalPosition = listOfCutscene4Points[2].LocalPosition;
alphaIn = 1.0f;
}
pic4cRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic4c = false;
cutscene4Done = true;
text4.Enabled = true;
time = 0;
alphaIn = 0;
}
}
}
}
private void Canvas5()
{
if (canvas5.IsActiveSelf)
{
if (showPic5a)
{
if (time < duration)
{
pic5aTran.LocalPosition = Vector3.Lerp(pic5aTran.LocalPosition, listOfCutscene5Points[0].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic5aTran.LocalPosition = listOfCutscene5Points[0].LocalPosition;
alphaIn = 1.0f;
}
pic5aRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic5a = false;
showPic5b = true;
time = 0;
alphaIn = 0;
}
}
if (showPic5b)
{
if (time < duration)
{
pic5bTran.LocalPosition = Vector3.Lerp(pic5bTran.LocalPosition, listOfCutscene5Points[1].LocalPosition, time / duration);
alphaIn = SHADE.Math.Lerp(0.0f, 1.0f, time / duration);
time += Time.DeltaTimeF;
}
else
{
pic5bTran.LocalPosition = listOfCutscene5Points[1].LocalPosition;
alphaIn = 1.0f;
}
pic5bRenderable.Material.SetProperty<float>("data.alpha", alphaIn);
if (alphaIn >= 1.0f)
{
showPic5b = false;
text5.Enabled = true;
cutscene5Done = true;
time = 0;
alphaIn = 0;
}
}
}
}
private void initCutscene4()
{
if (cutscene4Points)
listOfCutscene4Points = cutscene4Points.GetComponentsInChildren<Transform>().ToList();
else
Debug.LogError("Cutscene4Points Missing");
if (listOfCutscene4Points.Count == 0)
Debug.LogError("Cutscene4Points Empty");
listOfCutscene4Pics = cutscene4Pics.GetComponentsInChildren<Renderable>().ToList();
if (listOfCutscene4Pics.Count == 0)
Debug.LogError("Cutscene4Pics Empty");
if (listOfCutscene4Pics[0])
{
pic4aRenderable = listOfCutscene4Pics[0].GetComponent<Renderable>();
pic4aTran = listOfCutscene4Pics[0].GetComponent<Transform>();
pic4aRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 4 PIC1 MISSING");
if (listOfCutscene4Pics[1])
{
pic4bRenderable = listOfCutscene4Pics[1].GetComponent<Renderable>();
pic4bTran = listOfCutscene4Pics[1].GetComponent<Transform>();
pic4bRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 4 PIC2 MISSING");
if (listOfCutscene4Pics[2])
{
pic4cRenderable = listOfCutscene4Pics[2].GetComponent<Renderable>();
pic4cTran = listOfCutscene4Pics[2].GetComponent<Transform>();
pic4cRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 1 PIC3 MISSING");
if (canvas4)
{
text4 = canvas4.GetComponentInChildren<TextRenderable>();
text4.Enabled = false;
}
else
Debug.LogError("Canvas 4 missing");
}
private void initCutscene5()
{
if (cutscene5Points)
listOfCutscene5Points = cutscene5Points.GetComponentsInChildren<Transform>().ToList();
else
Debug.LogError("cutscene5Points Missing");
if (listOfCutscene5Points.Count == 0)
Debug.LogError("Cutscene5Points Empty");
listOfCutscene5Pics = cutscene5Pics.GetComponentsInChildren<Renderable>().ToList();
if (listOfCutscene5Pics.Count == 0)
Debug.LogError("Cutscene5Pics Empty");
if (listOfCutscene5Pics[0])
{
pic5aRenderable = listOfCutscene5Pics[0].GetComponent<Renderable>();
pic5aTran = listOfCutscene5Pics[0].GetComponent<Transform>();
pic5aRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 5 PIC1 MISSING");
if (listOfCutscene5Pics[1])
{
pic5bRenderable = listOfCutscene5Pics[1].GetComponent<Renderable>();
pic5bTran = listOfCutscene5Pics[1].GetComponent<Transform>();
pic5bRenderable.Material.SetProperty<float>("data.alpha", 0.0f);
}
else
Debug.LogError("SCENE 5 PIC2 MISSING");
if (canvas5)
{
text5 = canvas5.GetComponentInChildren<TextRenderable>();
text5.Enabled = false;
canvas5.SetActive(false);
}
else
Debug.LogError("Canvas 5 missing");
}
}

View File

@ -0,0 +1,3 @@
Name: SC_CutSceneEnd
ID: 153706859
Type: 9

View File

@ -1,3 +0,0 @@
Name: SC_Cutscene
ID: 157565851
Type: 9

View File

@ -4,10 +4,12 @@ using System.Linq;
using SHADE; using SHADE;
public class Cutscene : Script public class CutsceneIntro : Script
{ {
public uint nextScene;
public float duration = 3.0f; public float duration = 3.0f;
public float skipDuration = 0.1f;
private float oldDuration = 0.0f; private float oldDuration = 0.0f;
private Renderable pic1aRenderable; private Renderable pic1aRenderable;
@ -97,7 +99,7 @@ public class Cutscene : Script
{ {
skip = true; skip = true;
oldDuration = duration; oldDuration = duration;
duration = 0.1f; duration = skipDuration;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene1Done && canvas1.IsActiveSelf) if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene1Done && canvas1.IsActiveSelf)
@ -118,7 +120,7 @@ public class Cutscene : Script
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene3Done && canvas3.IsActiveSelf) if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene3Done && canvas3.IsActiveSelf)
{ {
//change scene SceneManager.ChangeScene(nextScene);
} }
} }

View File

@ -0,0 +1,3 @@
Name: SC_CutsceneIntro
ID: 154967292
Type: 9

View File

@ -49,6 +49,7 @@ public class PauseMenu : Script
gamePauseText.Enabled = false; gamePauseText.Enabled = false;
if (canvas) if (canvas)
canvas.SetActive(false); canvas.SetActive(false);
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
} }
}); });
} }
@ -101,6 +102,7 @@ public class PauseMenu : Script
gamePauseText.Enabled = true; gamePauseText.Enabled = true;
if (canvas) if (canvas)
canvas.SetActive(true); canvas.SetActive(true);
Application.FixDeltaTime = 0;
} }
} }

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_cutscene_04a
ID: 51238312
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_cutscene_04b
ID: 61471971
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_cutscene_04c
ID: 58217538
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_cutscene_05a
ID: 61980534
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_cutscene_05b
ID: 51561286
Type: 3

View File

@ -37,6 +37,8 @@ namespace SHADE
{ {
prevFrameTime = std::chrono::high_resolution_clock::now(); prevFrameTime = std::chrono::high_resolution_clock::now();
} }
} }
//TODO Legacy code. Delete soon //TODO Legacy code. Delete soon

View File

@ -16,6 +16,7 @@
// Project Headers // Project Headers
#include "ECS_Base/Managers/SHSystemManager.h" #include "ECS_Base/Managers/SHSystemManager.h"
#include "Scripting/SHScriptEngine.h" #include "Scripting/SHScriptEngine.h"
#include "Math/SHMath.h"
namespace SHADE namespace SHADE
{ {
@ -42,6 +43,10 @@ namespace SHADE
} }
const double FIXED_DT = physicsSystem->fixedDT; const double FIXED_DT = physicsSystem->fixedDT;
if (SHMath::CompareFloat(FIXED_DT, 0.0))
return;
accumulatedTime += dt; accumulatedTime += dt;
int count = 0; int count = 0;

View File

@ -63,6 +63,11 @@ namespace SHADE
return fixedDT; return fixedDT;
} }
double SHPhysicsSystem::GetDefaultFixedDT() const noexcept
{
return DEFAULT_FIXED_STEP;
}
const std::vector<SHCollisionInfo>& SHPhysicsSystem::GetAllCollisionInfo() const noexcept const std::vector<SHCollisionInfo>& SHPhysicsSystem::GetAllCollisionInfo() const noexcept
{ {
return collisionListener.GetCollisionInfoContainer(); return collisionListener.GetCollisionInfoContainer();
@ -97,7 +102,7 @@ namespace SHADE
void SHPhysicsSystem::SetFixedDT(double fixedDt) noexcept void SHPhysicsSystem::SetFixedDT(double fixedDt) noexcept
{ {
if (fixedDt <= 0.0) if (fixedDt < 0.0)
{ {
SHLOGV_WARNING("Invalid value for setting fixed delta time! Fixed delta time unchanged.") SHLOGV_WARNING("Invalid value for setting fixed delta time! Fixed delta time unchanged.")
return; return;

View File

@ -58,6 +58,7 @@ namespace SHADE
[[nodiscard]] double GetFixedUpdateRate () const noexcept; [[nodiscard]] double GetFixedUpdateRate () const noexcept;
[[nodiscard]] double GetFixedDT () const noexcept; [[nodiscard]] double GetFixedDT () const noexcept;
[[nodiscard]] double GetDefaultFixedDT () const noexcept;
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllTriggerInfo () const noexcept; [[nodiscard]] const std::vector<SHCollisionInfo>& GetAllTriggerInfo () const noexcept;
[[nodiscard]] const std::vector<SHCollisionInfo>& GetAllCollisionInfo () const noexcept; [[nodiscard]] const std::vector<SHCollisionInfo>& GetAllCollisionInfo () const noexcept;

View File

@ -60,6 +60,25 @@ namespace SHADE
return 0.0; return 0.0;
} }
double SHPhysicsSystemInterface::GetDeafultFixedDT() noexcept
{
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
if (physicsSystem)
return physicsSystem->GetDefaultFixedDT();
SHLOGV_WARNING("Failed to get defualt fixed delta time. 0.0 returned instead.");
return 0.0;
}
void SHPhysicsSystemInterface::SetFixedDT(double value) noexcept
{
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();
if (physicsSystem)
physicsSystem->SetFixedDT(value);
SHLOGV_WARNING("Failed to set fixed delta time.");
}
int SHPhysicsSystemInterface::GetFixedUpdateRate() noexcept int SHPhysicsSystemInterface::GetFixedUpdateRate() noexcept
{ {
auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>(); auto* physicsSystem = SHSystemManager::GetSystem<SHPhysicsSystem>();

View File

@ -93,6 +93,8 @@ namespace SHADE
[[nodiscard]] static const std::vector<SHCollisionInfo>& GetCollisionInfo () noexcept; [[nodiscard]] static const std::vector<SHCollisionInfo>& GetCollisionInfo () noexcept;
[[nodiscard]] static const std::vector<SHCollisionInfo>& GetTriggerInfo () noexcept; [[nodiscard]] static const std::vector<SHCollisionInfo>& GetTriggerInfo () noexcept;
[[nodiscard]] static double GetFixedDT () noexcept; [[nodiscard]] static double GetFixedDT () noexcept;
[[nodiscard]] static void SetFixedDT (double value) noexcept;
[[nodiscard]] static double GetDeafultFixedDT () noexcept;
[[nodiscard]] static int GetFixedUpdateRate () noexcept; [[nodiscard]] static int GetFixedUpdateRate () noexcept;
[[nodiscard]] static const std::vector<SHPhysicsRaycastResult>& Raycast (const RaycastInfo& info) noexcept; [[nodiscard]] static const std::vector<SHPhysicsRaycastResult>& Raycast (const RaycastInfo& info) noexcept;

View File

@ -20,6 +20,7 @@ of DigiPen Institute of Technology is prohibited.
#include "ECS_Base/Managers/SHSystemManager.h" #include "ECS_Base/Managers/SHSystemManager.h"
#include "Editor/SHEditor.h" #include "Editor/SHEditor.h"
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystemInterface.h" #include "Graphics/MiddleEnd/Interface/SHGraphicsSystemInterface.h"
#include "Physics/System/SHPhysicsSystemInterface.h"
namespace SHADE namespace SHADE
{ {
@ -79,6 +80,14 @@ namespace SHADE
{ {
//SHWindow::SetMouseVisible(value); //SHWindow::SetMouseVisible(value);
} }
double Application::FixDeltaTime::get()
{
return SHPhysicsSystemInterface::GetFixedDT();
}
void Application::FixDeltaTime::set(double value)
{
SHPhysicsSystemInterface::SetFixedDT(value);
}
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Usage Functions */ /* Usage Functions */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/

View File

@ -79,6 +79,12 @@ namespace SHADE
void set(bool value); void set(bool value);
} }
static property double FixDeltaTime
{
double get();
void set(double value);
}
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/
/* Usage Functions */ /* Usage Functions */
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -39,8 +39,15 @@ namespace SHADE
{ {
return static_cast<float>(SHFrameRateController::GetRawDeltaTime()); return static_cast<float>(SHFrameRateController::GetRawDeltaTime());
} }
double Time::FixedDeltaTime::get() double Time::FixedDeltaTime::get()
{ {
return SHPhysicsSystemInterface::GetFixedDT(); return SHPhysicsSystemInterface::GetFixedDT();
} }
double Time::DefaultFixDeltaTime::get()
{
return SHPhysicsSystemInterface::GetDeafultFixedDT();
}
} }

View File

@ -57,5 +57,11 @@ namespace SHADE
{ {
double get(); double get();
} }
static property double DefaultFixDeltaTime
{
double get();
}
}; };
} }