Merge branch 'main' into SP3-13-Assets-Manager

This commit is contained in:
Xiao Qi 2023-03-07 23:01:21 +08:00
commit ea3b851ed0
376 changed files with 11898 additions and 1918 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

@ -3,6 +3,6 @@
SubPass: UI SubPass: UI
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 62200943 data.textureIndex: 52834559
data.alpha: 1 data.alpha: 1
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

View File

@ -3,6 +3,6 @@
SubPass: UI SubPass: UI
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 53303669 data.textureIndex: 60762613
data.alpha: 1 data.alpha: 1
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

View File

@ -3,6 +3,6 @@
SubPass: UI SubPass: UI
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 61780097 data.textureIndex: 53309226
data.alpha: 1 data.alpha: 1
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

View File

@ -3,6 +3,6 @@
SubPass: UI SubPass: UI
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 59178524 data.textureIndex: 63002526
data.alpha: 1 data.alpha: 1
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

View File

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

View File

@ -0,0 +1,3 @@
Name: UIMat_Black
ID: 120016136
Type: 7

View File

@ -3,6 +3,6 @@
SubPass: UI SubPass: UI
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54429632 data.textureIndex: 58181851
data.alpha: 1 data.alpha: 1
data.beta: {x: 1, y: 1, z: 1} data.beta: {x: 1, y: 1, z: 1}

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: 59379300
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Credits
ID: 120332672
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: 52018575
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Multiplier
ID: 133784677
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: 54238246
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Score
ID: 127527215
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: 60494030
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Timer
ID: 126220632
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: -2000, 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

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

@ -20,6 +20,7 @@
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
Canvas Height: 1080 Canvas Height: 1080
Scale by canvas width: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 2 - EID: 2
@ -28,7 +29,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} 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
@ -38,6 +39,8 @@
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 1 Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 5 - EID: 5
@ -46,51 +49,71 @@
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: 200, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 129340704
IsActive: true IsActive: true
Button Component: Button Component:
Default Texture: 65788519 Default Texture: 58945566
Hovered Texture: 55999018 Hovered Texture: 58758882
Clicked Texture: 66382894 Clicked Texture: 50335070
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 1 Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: Scripts:
- Type: ChangeSceneButton - Type: ChangeSceneButton
Enabled: true Enabled: true
sceneID: 97158628 sceneID: 97158628
- Type: SHADE_Scripting.UI.ButtonFX
Enabled: true
onHoverEnterSound: Empty
onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element
onReleaseSound: Empty
hoverScale: 1.10000002
clickScale: 0.899999976
- EID: 6 - EID: 6
Name: Quit Button Name: Quit Button
IsActive: true IsActive: true
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: 200, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 129340704
IsActive: true IsActive: true
Button Component: Button Component:
Default Texture: 66477839 Default Texture: 61602036
Hovered Texture: 65045286 Hovered Texture: 58910810
Clicked Texture: 58607560 Clicked Texture: 57786063
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 1 Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: Scripts:
- Type: QuitButton - Type: QuitButton
Enabled: true Enabled: true
- Type: SHADE_Scripting.UI.ButtonFX
Enabled: true
onHoverEnterSound: Empty
onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element
onReleaseSound: Empty
hoverScale: 1.10000002
clickScale: 0.899999976
- EID: 3 - EID: 3
Name: Camera Name: Camera
IsActive: true IsActive: true
@ -107,10 +130,10 @@
Yaw: 0 Yaw: 0
Roll: 0 Roll: 0
Width: 1920 Width: 1920
Height: 1080
Near: 0.00999999978 Near: 0.00999999978
Far: 10000 Far: 10000
Perspective: true Perspective: true
FOV: 90
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 4 - EID: 4
@ -123,3 +146,47 @@
Enabled: true Enabled: true
mainGameScene: 86098106 mainGameScene: 86098106
mainMainScene: 97158628 mainMainScene: 97158628
- EID: 7
Name: TweenManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: SHADE_Scripting.UI.TweenManager
Enabled: true
- EID: 450
Name: TransitionCanvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 65982
Name: Transition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 2500, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 120016136
IsActive: true
UI Component:
Canvas ID: 450
Hovered: false
Clicked: false
IsActive: true
Scripts:
- Type: SHADE_Scripting.UI.SceneFadeInOut
Enabled: true
alphaValue: 1
fadeInTime: 0.5
fadeOutTime: 0.5

File diff suppressed because it is too large Load Diff

View File

@ -5,13 +5,14 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 7, z: 0} Translate: {x: 0, y: 7, z: 0}
Rotate: {x: 1.48352981, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 0.999999344, y: 0.999999821, z: 0.999999523} Scale: {x: 0.999999344, y: 0.999999821, z: 0.999999523}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
@ -26,8 +27,9 @@
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 0 Collision Tag: 0
Type: Box Type: Capsule
Half Extents: {x: 1, y: 1, z: 1} Radius: 1
Height: 2
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
@ -75,10 +77,10 @@
Yaw: 0 Yaw: 0
Roll: 0 Roll: 0
Width: 1920 Width: 1920
Height: 1080
Near: 0.00999999978 Near: 0.00999999978
Far: 10000 Far: 10000
Perspective: true Perspective: true
FOV: 90
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 65539 - EID: 65539
@ -187,6 +189,7 @@
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true Sleeping Enabled: true

View File

@ -14,10 +14,10 @@
Yaw: 0 Yaw: 0
Roll: 0 Roll: 0
Width: 1200 Width: 1200
Height: 1080
Near: 0.00999999978 Near: 0.00999999978
Far: 10000 Far: 10000
Perspective: true Perspective: true
FOV: 90
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 1 - EID: 1
@ -26,9 +26,9 @@
NumberOfChildren: 1 NumberOfChildren: 1
Components: Components:
Transform Component: Transform Component:
Translate: {x: -1.86388135, y: 0.0544953719, z: 0} Translate: {x: 0, y: 0.189419448, z: 0}
Rotate: {x: -0, y: 0, z: -0} Rotate: {x: 0.00523597933, y: -2.96353412, z: -6.40293041e-10}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1.00000191, y: 1, z: 1.00000191}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 149697411 Mesh: 149697411
@ -55,10 +55,15 @@
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component:
Translate: {x: 0, y: 1.82978272, z: -3.28967047}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Light Component: Light Component:
Position: {x: 3, y: 4.5, z: 7} Position: {x: 3, y: 4.5, z: 7}
Type: Directional Type: Directional
Direction: {x: -0.298000008, y: 0.522498012, z: 0.798600018} Direction: {x: 0, y: 0, z: 1}
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
@ -85,8 +90,8 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0.0810000002, z: 0} Translate: {x: 0, y: 0.0810000002, z: 0}
Rotate: {x: -1.57079637, y: 0, z: 0} Rotate: {x: -1.57079625, y: 0, z: -0}
Scale: {x: 50, y: 50, z: 50} Scale: {x: 50, y: 49.9999924, z: 49.9999924}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688

View File

@ -20,6 +20,7 @@
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
Canvas Height: 1080 Canvas Height: 1080
Scale by canvas width: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 2 - EID: 2
@ -28,7 +29,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} 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
@ -38,6 +39,8 @@
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 1 Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 5 - EID: 5
@ -46,51 +49,71 @@
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: 200, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 129340704
IsActive: true IsActive: true
Button Component: Button Component:
Default Texture: 65788519 Default Texture: 58945566
Hovered Texture: 55999018 Hovered Texture: 58758882
Clicked Texture: 66382894 Clicked Texture: 50335070
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 1 Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: Scripts:
- Type: ChangeSceneButton - Type: ChangeSceneButton
Enabled: true Enabled: true
sceneID: 97158628 sceneID: 97158628
- Type: SHADE_Scripting.UI.ButtonFX
Enabled: true
onHoverEnterSound: Empty
onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element
onReleaseSound: Empty
hoverScale: 1.10000002
clickScale: 0.899999976
- EID: 6 - EID: 6
Name: Quit Button Name: Quit Button
IsActive: true IsActive: true
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: 200, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 129340704
IsActive: true IsActive: true
Button Component: Button Component:
Default Texture: 66477839 Default Texture: 61602036
Hovered Texture: 65045286 Hovered Texture: 58910810
Clicked Texture: 58607560 Clicked Texture: 57786063
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 1 Canvas ID: 1
Hovered: false
Clicked: false
IsActive: true IsActive: true
Scripts: Scripts:
- Type: QuitButton - Type: QuitButton
Enabled: true Enabled: true
- Type: SHADE_Scripting.UI.ButtonFX
Enabled: true
onHoverEnterSound: Empty
onHoverExitSound: Empty
onClickSound: event:/UI/mouse_down_element
onReleaseSound: Empty
hoverScale: 1.10000002
clickScale: 0.899999976
- EID: 3 - EID: 3
Name: Camera Name: Camera
IsActive: true IsActive: true
@ -107,7 +130,6 @@
Yaw: 0 Yaw: 0
Roll: 0 Roll: 0
Width: 1920 Width: 1920
Height: 1080
Near: 0.00999999978 Near: 0.00999999978
Far: 10000 Far: 10000
Perspective: true Perspective: true
@ -124,3 +146,47 @@
Enabled: true Enabled: true
mainGameScene: 86098106 mainGameScene: 86098106
mainMainScene: 97158628 mainMainScene: 97158628
- EID: 7
Name: TweenManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: SHADE_Scripting.UI.TweenManager
Enabled: true
- EID: 450
Name: TransitionCanvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 65982
Name: Transition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 2500, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 120016136
IsActive: true
UI Component:
Canvas ID: 450
Hovered: false
Clicked: false
IsActive: true
Scripts:
- Type: SHADE_Scripting.UI.SceneFadeInOut
Enabled: true
alphaValue: 1
fadeInTime: 0.5
fadeOutTime: 0.5

View File

@ -12,7 +12,7 @@ namespace SHADE_Scripting.Audio
public static Dictionary<string, AudioClipHandler> audioClipHandlers = new Dictionary<string, AudioClipHandler>(); public static Dictionary<string, AudioClipHandler> audioClipHandlers = new Dictionary<string, AudioClipHandler>();
//Functions here, maybe //Functions here, maybe
public static void stopAllSounds(bool fadeOut) public static void StopAllSounds(bool fadeOut)
{ {
foreach (KeyValuePair<string, AudioClipHandler> h in audioClipHandlers) foreach (KeyValuePair<string, AudioClipHandler> h in audioClipHandlers)
{ {
@ -20,7 +20,7 @@ namespace SHADE_Scripting.Audio
} }
} }
public static void pauseAllSounds(bool pause) public static void PauseAllSounds(bool pause)
{ {
foreach (KeyValuePair<string, AudioClipHandler> h in audioClipHandlers) foreach (KeyValuePair<string, AudioClipHandler> h in audioClipHandlers)
{ {

View File

@ -0,0 +1,32 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.Audio
{
public class SoundLoopEmitter : Script
{
[SerializeField]
private string clipHandlerName;
[SerializeField]
private string clipPath;
public float volume;
protected override void awake()
{
AudioHandler.audioClipHandlers[clipHandlerName] = SHADE.Audio.CreateAudioClip(clipPath);
}
protected override void start()
{
SHADE.Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers[clipHandlerName], GameObject.EntityId);
AudioHandler.audioClipHandlers[clipHandlerName].SetVolume(volume);
AudioHandler.audioClipHandlers[clipHandlerName].Play();
}
}
}

View File

@ -0,0 +1,3 @@
Name: CS_SoundLoopEmitter
ID: 154714630
Type: 9

View File

@ -37,6 +37,9 @@ public partial class Homeowner1 : BehaviourTree
private List<GameObject> waypoints; private List<GameObject> waypoints;
[SerializeField]
private GameObject startWaypoint;
[SerializeField] [SerializeField]
[Tooltip("The AI will patrol at this speed")] [Tooltip("The AI will patrol at this speed")]
private float patrolSpeed; private float patrolSpeed;
@ -112,8 +115,14 @@ public partial class Homeowner1 : BehaviourTree
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");
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXFootstep"], GameObject.EntityId);
AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon"); AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon");
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXDetectAh"], GameObject.EntityId);
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");
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXHumming"], GameObject.EntityId);
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
if (aiInstance != null && aiInstance != this) if (aiInstance != null && aiInstance != this)
RemoveScript<Homeowner1>(); RemoveScript<Homeowner1>();
@ -151,6 +160,8 @@ public partial class Homeowner1 : BehaviourTree
SetData("distanceToCapture", distanceToCapture); SetData("distanceToCapture", distanceToCapture);
if (GetData("baseCaptureTime") == null || (float)GetData("baseCaptureTime") != captureTime) if (GetData("baseCaptureTime") == null || (float)GetData("baseCaptureTime") != captureTime)
SetData("baseCaptureTime", captureTime); SetData("baseCaptureTime", captureTime);
if (GetData("startWaypoint") == null || (GameObject)GetData("startWaypoint") != startWaypoint)
SetData("startWaypoint", startWaypoint);
events.Tick(); events.Tick();

View File

@ -12,6 +12,7 @@
using SHADE; using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree; using SHADE_Scripting.AIBehaviour.BehaviourTree;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -98,6 +99,35 @@ public partial class LeafAttack : BehaviourTreeNode
if (player.GetScript<PlayerController>().stateMachine && !player.GetScript<PlayerController>().stateMachine.IsState(typeof(PlayerCaughtState))) if (player.GetScript<PlayerController>().stateMachine && !player.GetScript<PlayerController>().stateMachine.IsState(typeof(PlayerCaughtState)))
player.GetScript<PlayerController>().stateMachine.SetState(typeof(PlayerCaughtState)); player.GetScript<PlayerController>().stateMachine.SetState(typeof(PlayerCaughtState));
//Teleport AI back to home waypoint
int homeIndex = 0;
GameObject? startWaypoint = null;
List<GameObject>? waypoints = (List<GameObject>)GetNodeData("waypoints");
if (GetNodeData("startWaypoint") != null)
startWaypoint = (GameObject)GetNodeData("startWaypoint");
if (startWaypoint != null)
{
for (int i = 0; i < waypoints.Count; ++i)
{
if (startWaypoint == waypoints[i])
{
homeIndex = i;
}
}
}
SetNodeData("currentWaypointIndex", homeIndex);
SetNodeData("playerLastSightedWaypointIndex", homeIndex);
SetNodeData("isAlert", false);
Audio.SetParameterWithLabel("PlayerDetection", "Undetected");
AudioHandler.audioClipHandlers["SFXHumming"].Play();
Transform? transform = (Transform)GetNodeData("transform");
if (waypoints != null && transform != null)
{
transform.GlobalPosition = waypoints[homeIndex].GetComponent<Transform>().GlobalPosition;
}
ClearNodeData("target");
status = BehaviourTreeNodeStatus.SUCCESS; status = BehaviourTreeNodeStatus.SUCCESS;
onExit(BehaviourTreeNodeStatus.SUCCESS); onExit(BehaviourTreeNodeStatus.SUCCESS);
return status; return status;

View File

@ -60,7 +60,7 @@ public partial class LeafChase : BehaviourTreeNode
} }
} }
//Debug.Log("Player is nearest " + nearestWaypointIndex); //Debug.Log("Player is nearest " + nearestWaypointIndex);
//Debug.Log("I'm at " + (int)GetNodeData("currentWaypointIndex")); //Debug.Log("AI going to " + (int)GetNodeData("currentWaypointIndex"));
SetNodeData("playerLastSightedWaypointIndex", nearestWaypointIndex); SetNodeData("playerLastSightedWaypointIndex", nearestWaypointIndex);
} }
@ -78,6 +78,7 @@ public partial class LeafChase : BehaviourTreeNode
GetNodeData("distanceToCapture") == null || GetNodeData("distanceToCapture") == null ||
GetNodeData("baseCaptureTime") == null) GetNodeData("baseCaptureTime") == null)
{ {
//Debug.Log("Chase Failure: null values");
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
return status; return status;
@ -113,7 +114,8 @@ public partial class LeafChase : BehaviourTreeNode
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{ {
//AudioHandler.audioClipHandlers["BGMAdpative"].SetParameter("Detected", 0.0f); //AudioHandler.audioClipHandlers["BGMAdpative"].SetParameter("Detected", 0.0f);
Audio.SetParameter("Detected", 0.0f); //Audio.SetParameter("Detected", 0.0f);
Audio.SetParameterWithLabel("PlayerDetection", "Undetected");
AudioHandler.audioClipHandlers["SFXHumming"].Play(); AudioHandler.audioClipHandlers["SFXHumming"].Play();
} }
SetNodeData("isAlert", false); SetNodeData("isAlert", false);

View File

@ -29,7 +29,7 @@ public partial class LeafPatrol : BehaviourTreeNode
private float chaseSpeed; private float chaseSpeed;
private float turningSpeed; private float turningSpeed;
private float retreatTimer = 0.0f; private float retreatTimer = 0.0f;
private int currentWaypointIndex = 0; private int currentWaypointIndex = -1;
private bool retreatState = false; private bool retreatState = false;
private bool goingForwards = true; private bool goingForwards = true;
@ -47,7 +47,7 @@ public partial class LeafPatrol : BehaviourTreeNode
//node, and hence we do not need to inherit its constructors //node, and hence we do not need to inherit its constructors
public LeafPatrol(string name) : base(name) public LeafPatrol(string name) : base(name)
{ {
currentWaypointIndex = 0; currentWaypointIndex = -1;
} }
//When it comes to evaluating, //When it comes to evaluating,
@ -57,6 +57,42 @@ public partial class LeafPatrol : BehaviourTreeNode
//Debug.LogWarning("LeafPatrol"); //Debug.LogWarning("LeafPatrol");
onEnter(BehaviourTreeNodeStatus.RUNNING); onEnter(BehaviourTreeNodeStatus.RUNNING);
//Initialise home waypoint
waypoints = (List<GameObject>)GetNodeData("waypoints");
if (currentWaypointIndex == -1)
{
if (waypoints != null)
{
//Debug.Log("Waypoints not null");
if (GetNodeData("startWaypoint") != null)
{
//Debug.Log("Getting start waypoint");
GameObject startWaypoint = (GameObject)(GetNodeData("startWaypoint"));
for (int i = 0; i < waypoints.Count; ++i)
{
if (startWaypoint == waypoints[i])
{
//Debug.Log("Leaf Patrol Constructor: Start Waypoint Index: " + i.ToString());
currentWaypointIndex = i;
SetNodeData("currentWaypointIndex", i);
}
}
}
else
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
}
else
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
}
//Get data //Get data
if (GetNodeData("transform") == null || if (GetNodeData("transform") == null ||
GetNodeData("patrolSpeed") == null || GetNodeData("patrolSpeed") == null ||
@ -104,12 +140,13 @@ public partial class LeafPatrol : BehaviourTreeNode
ClearNodeData("isWaiting"); ClearNodeData("isWaiting");
return; return;
} }
waypoints = (List<GameObject>)GetNodeData("waypoints"); if (GetNodeData("currentWaypointIndex") != null)
if (waypoints == null)
{ {
return; //2023 Mar 4, 0400, this is needed when the AI teleports back to the first spot after catching
currentWaypointIndex = (int)GetNodeData("currentWaypointIndex");
} }
Vector3 targetPosition = waypoints[currentWaypointIndex].GetComponent<Transform>().GlobalPosition; //Modulo operator to prevent out of range exceptions
Vector3 targetPosition = waypoints[(currentWaypointIndex % waypoints.Count)].GetComponent<Transform>().GlobalPosition;
//Reach waypoint by X and Z being near enough //Reach waypoint by X and Z being near enough
//Do not consider Y of waypoints yet //Do not consider Y of waypoints yet
Vector3 remainingDistance = targetPosition - transform.GlobalPosition; Vector3 remainingDistance = targetPosition - transform.GlobalPosition;
@ -195,6 +232,8 @@ public partial class LeafPatrol : BehaviourTreeNode
//Debug.Log("AI is at " + transform.GlobalPosition.x.ToString() + " " + transform.GlobalPosition.y.ToString() + " " + transform.GlobalPosition.z.ToString()); //Debug.Log("AI is at " + transform.GlobalPosition.x.ToString() + " " + transform.GlobalPosition.y.ToString() + " " + transform.GlobalPosition.z.ToString());
Vector3 normalisedDifference = targetPosition - transform.GlobalPosition; Vector3 normalisedDifference = targetPosition - transform.GlobalPosition;
normalisedDifference.y = 0.0f; //Do not move vertically normalisedDifference.y = 0.0f; //Do not move vertically
//Debug.Log("Leaf Patrol Current Waypoint Index: " + currentWaypointIndex.ToString());
//Debug.Log("True Difference x " + normalisedDifference.x.ToString() + " z " + normalisedDifference.z.ToString());
normalisedDifference /= normalisedDifference.GetMagnitude(); normalisedDifference /= normalisedDifference.GetMagnitude();
//Debug.Log("Normalised Difference x " + normalisedDifference.x.ToString() + " z " + normalisedDifference.z.ToString()); //Debug.Log("Normalised Difference x " + normalisedDifference.x.ToString() + " z " + normalisedDifference.z.ToString());
@ -245,7 +284,8 @@ public partial class LeafPatrol : BehaviourTreeNode
AudioHandler.audioClipHandlers["SFXHumming"].Play(); AudioHandler.audioClipHandlers["SFXHumming"].Play();
//AudioHandler.audioClipHandlers["BGMUnalert"].Play(); //AudioHandler.audioClipHandlers["BGMUnalert"].Play();
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f); //AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
Audio.SetParameter("Detected", 0.0f); //Audio.SetParameter("Detected", 0.0f);
Audio.SetParameterWithLabel("PlayerDetection", "Undetected");
} }
SetNodeData("isAlert", false); SetNodeData("isAlert", false);
} }

View File

@ -26,6 +26,7 @@ public partial class LeafSearch : BehaviourTreeNode
private Vector3 eyeOffset; private Vector3 eyeOffset;
private float sightDistance; private float sightDistance;
private GameObject? player; //To be searched for and marked private GameObject? player; //To be searched for and marked
private bool screamOnce;
} }
//FUNCTIONS HERE //FUNCTIONS HERE
@ -67,7 +68,8 @@ public partial class LeafSearch : BehaviourTreeNode
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{ {
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f); //AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
Audio.SetParameter("Detected", 0.0f); //Audio.SetParameter("Detected", 0.0f);
Audio.SetParameterWithLabel("PlayerDetection", "Undetected");
AudioHandler.audioClipHandlers["SFXHumming"].Play(); AudioHandler.audioClipHandlers["SFXHumming"].Play();
reevaluateWaypoint(); reevaluateWaypoint();
} }
@ -97,6 +99,7 @@ public partial class LeafSearch : BehaviourTreeNode
//Search for player //Search for player
player = GameObject.Find("Player"); player = GameObject.Find("Player");
screamOnce = false;
//Automatically fail if no player is found //Automatically fail if no player is found
if (player == null) if (player == null)
@ -104,6 +107,7 @@ public partial class LeafSearch : BehaviourTreeNode
SetNodeData("isAlert", false); SetNodeData("isAlert", false);
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
else else
@ -125,6 +129,7 @@ public partial class LeafSearch : BehaviourTreeNode
//handleChaseStop(); //handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
@ -140,6 +145,7 @@ public partial class LeafSearch : BehaviourTreeNode
//handleChaseStop(); //handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
@ -156,6 +162,7 @@ public partial class LeafSearch : BehaviourTreeNode
//Debug.Log("Failure: Player has no collider"); //Debug.Log("Failure: Player has no collider");
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
//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
@ -173,6 +180,7 @@ public partial class LeafSearch : BehaviourTreeNode
//handleChaseStop(); //handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE; status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE); onExit(BehaviourTreeNodeStatus.FAILURE);
screamOnce = false;
return status; return status;
} }
else if (sightRayHit.Hit && sightRayHit.Other == player) else if (sightRayHit.Hit && sightRayHit.Other == player)
@ -188,31 +196,40 @@ public partial class LeafSearch : BehaviourTreeNode
if (GetNodeData("isAlert") == null) if (GetNodeData("isAlert") == null)
{ {
SetNodeData("isAlert", true); SetNodeData("isAlert", true);
screamOnce = true;
//Audio.StopAllSounds(); //Audio.StopAllSounds();
AudioHandler.audioClipHandlers["SFXDetectAh"].Play(); //AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
AudioHandler.audioClipHandlers["SFXDetectSting"].Play(); AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
//AudioHandler.audioClipHandlers["BGMAlert"].Play(); //AudioHandler.audioClipHandlers["BGMAlert"].Play();
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false); AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true); //AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f); //AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
Audio.SetParameter("Detected", 1.0f); //Audio.SetParameter("Detected", 1.0f);
Audio.SetParameterWithLabel("PlayerDetection", "Detected");
} }
else else
{ {
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false)
{ {
//Audio.StopAllSounds(); //Audio.StopAllSounds();
AudioHandler.audioClipHandlers["SFXDetectAh"].Play(); screamOnce = true;
//AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
AudioHandler.audioClipHandlers["SFXDetectSting"].Play(); AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
//AudioHandler.audioClipHandlers["BGMAlert"].Play(); //AudioHandler.audioClipHandlers["BGMAlert"].Play();
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false); AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true); //AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f); //AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
Audio.SetParameter("Detected", 1.0f); //Audio.SetParameter("Detected", 1.0f);
Audio.SetParameterWithLabel("PlayerDetection", "Detected");
} }
SetNodeData("isAlert", true); SetNodeData("isAlert", true);
} }
if (screamOnce)
{
AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
}
status = BehaviourTreeNodeStatus.SUCCESS; status = BehaviourTreeNodeStatus.SUCCESS;
onExit(BehaviourTreeNodeStatus.SUCCESS); onExit(BehaviourTreeNodeStatus.SUCCESS);
return status; return status;

View File

@ -14,6 +14,12 @@ public class Breakable : Script
public bool isBreak { get; set; } public bool isBreak { get; set; }
private List<GameObject> itemPieces = new List<GameObject>(); private List<GameObject> itemPieces = new List<GameObject>();
[SerializeField]
private string breakClipHandlerName;
[SerializeField]
private string breakClipPath;
protected override void awake() protected override void awake()
{ {
rb = GetComponent<RigidBody>(); rb = GetComponent<RigidBody>();
@ -32,7 +38,7 @@ public class Breakable : Script
isBreak = false; isBreak = false;
AudioHandler.audioClipHandlers["SFXBreak"] = Audio.CreateAudioClip("event:/Props/impact_break"); AudioHandler.audioClipHandlers[breakClipHandlerName] = Audio.CreateAudioClip(breakClipPath);
} }
protected override void update() protected override void update()
@ -76,7 +82,9 @@ public class Breakable : Script
GameManager.Instance.itemShatter = false; GameManager.Instance.itemShatter = false;
isBreak = false; isBreak = false;
AudioHandler.audioClipHandlers["SFXBreak"].Play(); Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers[breakClipHandlerName], GameObject.EntityId);
AudioHandler.audioClipHandlers[breakClipHandlerName].Play();
//Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers[breakClipHandlerName]);
GameObject.SetActive(false); GameObject.SetActive(false);
} }
} }

View File

@ -121,11 +121,15 @@ public class Item : Script
if (playSound) if (playSound)
{ {
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactElastic"], GameObject.EntityId);
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactHard"], GameObject.EntityId);
if (currCategory == ItemCategory.LIGHT) if (currCategory == ItemCategory.LIGHT)
AudioHandler.audioClipHandlers["SFXImpactElastic"].Play(); AudioHandler.audioClipHandlers["SFXImpactElastic"].Play();
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY) else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
AudioHandler.audioClipHandlers["SFXImpactHard"].Play(); AudioHandler.audioClipHandlers["SFXImpactHard"].Play();
playSound = false; playSound = false;
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactElastic"]);
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactHard"]);
} }
if (info.GameObject.GetScript<Homeowner1>() && !returnBack) if (info.GameObject.GetScript<Homeowner1>() && !returnBack)

View File

@ -21,17 +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; }
public GameObject silhouettePlayer;
public Renderable silhouettePlayerRend;
public GameObject silhouetteBag;
public Renderable silhouetteBagRend;
[Tooltip("Lenght of ray")] [Tooltip("Lenght of ray")]
public float rayDistance = 1; public float rayDistance = 1;
@ -58,41 +53,17 @@ public class PickAndThrow : Script
if(!tpc) if(!tpc)
Debug.LogError("TPC EMPTY"); Debug.LogError("TPC EMPTY");
if(!silhouettePlayer)
Debug.LogError("silhouettePlayer EMPTY");
else
silhouettePlayerRend = silhouettePlayer.GetComponent<Renderable>();
if (!silhouetteBag)
Debug.LogError("silhouetteBag EMPTY");
else
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw"); AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw");
timer = delayTimer; timer = delayTimer;
} }
protected override void update() protected override void update()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || !GameManager.Instance.stealFoodPopUpDone)
{ {
return; return;
} }
if (silhouettePlayerRend && silhouetteBagRend)
{
//wait for daniel
//0.00075f;
Vector3 dis = Camera.GetMainCamera().Position - GameObject.GetComponent<Transform>().LocalPosition;
float disSqr = dis.GetSqrMagnitude();
float ratio = System.Math.Clamp(1 - (disSqr / (1 + disSqr)), 0, 1.0f);
float temp = (1 - ratio) * 0.00075f;
if (temp <= 0.0006f)
temp = 0.1f;
silhouettePlayerRend.Material.SetProperty<float>("data.offset", temp);
silhouetteBagRend.Material.SetProperty<float>("data.offset", temp);
}
if (timer <= delayTimer) if (timer <= delayTimer)
timer += Time.DeltaTimeF; timer += Time.DeltaTimeF;
@ -171,7 +142,7 @@ public class PickAndThrow : Script
protected override void fixedUpdate() protected override void fixedUpdate()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || !GameManager.Instance.stealFoodPopUpDone)
{ {
return; return;
} }
@ -194,7 +165,7 @@ public class PickAndThrow : Script
} }
} }
private void ResetItemObject() public void ResetItemObject()
{ {
itemRidigBody = null; itemRidigBody = null;
itemTransform = null; itemTransform = null;

View File

@ -17,21 +17,12 @@ public class PlayerController : Script
TOTAL TOTAL
} }
/* public enum WalkingState
{
CARRY,
AIMING,
THROW,
WALK,
TOTAL
}*/
public RigidBody rb { get; set; } public RigidBody rb { get; set; }
public Transform tranform { get; set; } public Transform tranform { get; set; }
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; }
@ -85,6 +76,12 @@ public class PlayerController : Script
[Tooltip("How heavy item will affect player jump")] [Tooltip("How heavy item will affect player jump")]
public float heavyMultiper = 0.25f; public float heavyMultiper = 0.25f;
//silhouette=====================================================================
public GameObject silhouettePlayer;
private Renderable silhouettePlayerRend;
public GameObject silhouetteBag;
private Renderable silhouetteBagRend;
protected override void awake() protected override void awake()
{ {
//default setup //default setup
@ -119,6 +116,21 @@ public class PlayerController : Script
dictionary.Add(typeof(PlayerCaughtState), new PlayerCaughtState(stateMachine)); dictionary.Add(typeof(PlayerCaughtState), new PlayerCaughtState(stateMachine));
stateMachine.InitStateMachine(dictionary); stateMachine.InitStateMachine(dictionary);
if (!silhouettePlayer)
Debug.LogError("silhouettePlayer EMPTY");
else
{
silhouettePlayerRend = silhouettePlayer.GetComponent<Renderable>();
silhouettePlayerRend.Material.SetProperty<float>("data.offset", 0.1f);
}
if (!silhouetteBag)
Debug.LogError("silhouetteBag EMPTY");
else
{
silhouetteBagRend = silhouetteBag.GetComponent<Renderable>();
silhouetteBagRend.Material.SetProperty<float>("data.offset", 0.1f);
}
} }
protected override void lateUpdate() protected override void lateUpdate()
@ -127,26 +139,23 @@ public class PlayerController : Script
protected override void update() protected override void update()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || !GameManager.Instance.stealFoodPopUpDone)
{ {
return; return;
} }
if (delayTimer <= 1) if (silhouettePlayerRend && silhouetteBagRend)
delayTimer += Time.DeltaTimeF; {
Vector3 dis = Camera.GetMainCamera().Position - GameObject.GetComponent<Transform>().LocalPosition;
float disSqr = dis.GetSqrMagnitude();
float ratio = System.Math.Clamp(1 - (disSqr / (1 + disSqr)), 0, 1.0f);
float temp = (1 - ratio) * 0.00075f;
if (temp <= 0.0006f)
temp = 0.1f;
silhouettePlayerRend.Material.SetProperty<float>("data.offset", temp);
silhouetteBagRend.Material.SetProperty<float>("data.offset", temp);
}
if (delayTimer < 1)
{
if (tranform && respawnPoint && rb)
{
rb.LinearVelocity = Vector3.Zero;
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
}
}
else
{
rb.FreezePositionY = false;
}
//PickAndThrow check //PickAndThrow check
if (!pat) if (!pat)
{ {
@ -156,13 +165,15 @@ public class PlayerController : Script
} }
if (!cam) if (!cam)
{
cam = GetComponentInChildren<Camera>(); cam = GetComponentInChildren<Camera>();
if(pat)
cam.FOV = pat.defaultFOV;
}
if(!camArm) if(!camArm)
camArm = GetComponentInChildren<CameraArm>(); camArm = GetComponentInChildren<CameraArm>();
//tempFix
if (tranform)
tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f);
GotCaught(); GotCaught();
Rotation(); Rotation();
@ -178,7 +189,7 @@ public class PlayerController : Script
protected override void fixedUpdate() protected override void fixedUpdate()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || !GameManager.Instance.stealFoodPopUpDone)
{ {
return; return;
} }
@ -333,10 +344,11 @@ public class PlayerController : Script
private void Rotation() private void Rotation()
{ {
tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f);
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), new Vector3(0.0f, 1.0f, 0.0f)); 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)
@ -345,6 +357,7 @@ public class PlayerController : Script
Quaternion targetRotation = Quaternion.Euler(0.0f, SHADE.Math.DegreesToRadians(camArm.Yaw + 180.0f), 0.0f); Quaternion targetRotation = Quaternion.Euler(0.0f, SHADE.Math.DegreesToRadians(camArm.Yaw + 180.0f), 0.0f);
tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.FixedDeltaTime); tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.FixedDeltaTime);
} }
} }
private void Gravity() private void Gravity()
@ -396,9 +409,18 @@ public class PlayerController : Script
if (pat && pat.item) if (pat && pat.item)
{ {
holdItem = false; if (holdItem)
isAiming = false; {
pat.item.GetScript<Item>().returnBack = true; holdItem = false;
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>();
@ -41,7 +41,7 @@ namespace SHADE_Scripting
protected override void update() protected override void update()
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause || !GameManager.Instance.stealFoodPopUpDone)
{ {
return; return;
} }

View File

@ -1,5 +1,6 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using SHADE_Scripting.UI;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -35,14 +36,19 @@ public class GameManager : Script
public bool itemScored {get;set;} public bool itemScored {get;set;}
public int currMultiplierCombo { get; set;} public int currMultiplierCombo { get; set;}
public float multiplierFont = 60.0f; public float multiplierFont = 60.0f;
private Vector3 fontScalar;
public static GameManager Instance { get; private set; } public static GameManager Instance { get; private set; }
public bool GamePause { get; set; } public bool GamePause { get; set; }
public bool stealFoodPopUpDone { get; set; }
public bool PreviewLevelDone { get; set; }
public bool itemShatter { get; set; } public bool itemShatter { get; set; }
//For scene transitions
private bool goingToWin;
private bool goingToLose;
protected override void awake() protected override void awake()
{ {
if (Instance != null && Instance != this) if (Instance != null && Instance != this)
@ -56,48 +62,62 @@ public class GameManager : Script
itemScored = false; itemScored = false;
currMultiplierCombo = 1; currMultiplierCombo = 1;
currMultiplierDuration = 0; currMultiplierDuration = 0;
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
itemShatter = false; itemShatter = false;
GamePause = false;
stealFoodPopUpDone = false;
PreviewLevelDone = false;
AudioHandler.audioClipHandlers["BGMWin"] = Audio.CreateAudioClip("event:/Music/stingers/game_win"); AudioHandler.audioClipHandlers["BGMWin"] = Audio.CreateAudioClip("event:/Music/stingers/game_win");
AudioHandler.audioClipHandlers["BGMLose"] = Audio.CreateAudioClip("event:/Music/stingers/game_lose"); AudioHandler.audioClipHandlers["BGMLose"] = Audio.CreateAudioClip("event:/Music/stingers/game_lose");
goingToWin = false;
goingToLose = false;
if (scoreText)
scoreText.GetComponent<TextRenderable>().Text = $"{Score}";
if (timeText)
timeText.GetComponent<TextRenderable>().Text = $"{timer.ToString("0")}";
Input.SetMouseCentering(true);
Application.IsCursorVisible = false;
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
} }
protected override void start() protected override void start()
{ {
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive_new");
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
AudioHandler.audioClipHandlers["BGMAdaptive"].Play(); AudioHandler.audioClipHandlers["BGMAdaptive"].Play();
Audio.SetParameter("Detected", 0.0f); Audio.SetParameterWithLabel("PlayerDetection", "Undetected");
AudioHandler.audioClipHandlers["KitchenAmbience"] = Audio.CreateAudioClip("event:/Ambience/roomtone_kitchen"); AudioHandler.audioClipHandlers["KitchenAmbience"] = Audio.CreateAudioClip("event:/Ambience/roomtone_kitchen");
AudioHandler.audioClipHandlers["KitchenAmbience"].Play(); AudioHandler.audioClipHandlers["KitchenAmbience"].Play();
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming"); if (SceneFadeInOut.Instance != null)
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f); SceneFadeInOut.Instance.CallFadeOut();
AudioHandler.audioClipHandlers["SFXHumming"].Play();
GamePause = false;
} }
protected override void update() protected override void update()
{ {
if (GamePause) if (GamePause || !stealFoodPopUpDone)
{ {
return; return;
} }
Cheat();
if (currGameState == GameState.START) if (currGameState == GameState.START)
{ {
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
if(scoreText) if(scoreText)
scoreText.GetComponent<TextRenderable>().Text = $"Score: {Score}"; scoreText.GetComponent<TextRenderable>().Text = $"{Score}";
if(timeText) if(timeText)
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}"; timeText.GetComponent<TextRenderable>().Text = $"{timer.ToString("0.00")}";
if (itemScored) if (itemScored)
{ {
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
//multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
currMultiplierDuration += Time.DeltaTimeF; currMultiplierDuration += Time.DeltaTimeF;
if (currMultiplierDuration >= maxMultiplierDuration) if (currMultiplierDuration >= maxMultiplierDuration)
@ -108,30 +128,76 @@ public class GameManager : Script
} }
} }
else
{
//multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
}
if ((timer > 0 && totalItemCount <= 0 && !itemShatter) || Input.GetKeyDown(Input.KeyCode.F1)) if (!goingToLose && ((timer > 0 && totalItemCount <= 0 && !itemShatter)))
{ {
currGameState = GameState.WIN; currGameState = GameState.WIN;
AudioHandler.stopAllSounds(false); AudioHandler.StopAllSounds(false);
AudioHandler.audioClipHandlers["BGMWin"].Play(); AudioHandler.audioClipHandlers["BGMWin"].Play();
SceneManager.ChangeScene(winScene); goingToWin = true;
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
} }
else if(timer < 0 || Input.GetKeyDown(Input.KeyCode.F2)) else if(!goingToWin && (timer < 0))
{ {
currGameState = GameState.LOSE; currGameState = GameState.LOSE;
AudioHandler.stopAllSounds(false); AudioHandler.StopAllSounds(false);
AudioHandler.audioClipHandlers["BGMLose"].Play(); AudioHandler.audioClipHandlers["BGMLose"].Play();
SceneManager.ChangeScene(loseScene); goingToLose = true;
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
}
}
//Handling transitions
if (SceneFadeInOut.Instance != null)
{
if (SceneFadeInOut.Instance.FadeInFinished())
{
if (goingToWin)
{
SceneManager.ChangeScene(winScene);
}
if (goingToLose)
{
SceneManager.ChangeScene(loseScene);
}
}
}
else
{
if (goingToWin)
{
SceneManager.ChangeScene(winScene);
}
if (goingToLose)
{
SceneManager.ChangeScene(loseScene);
} }
} }
} }
private void Cheat()
{
if (Input.GetKeyUp(Input.KeyCode.F1))
{
currGameState = GameState.WIN;
AudioHandler.StopAllSounds(false);
goingToWin = true;
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
}
else if (Input.GetKeyUp(Input.KeyCode.F2))
{
currGameState = GameState.LOSE;
AudioHandler.StopAllSounds(false);
goingToLose = true;
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
}
}
protected override void onDestroy() protected override void onDestroy()
{ {
if (Instance == this) if (Instance == this)
@ -143,9 +209,16 @@ public class GameManager : Script
totalItemCount -= 1; totalItemCount -= 1;
itemScored = true; itemScored = true;
currMultiplierDuration = 0; currMultiplierDuration = 0;
multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont);
if (currMultiplierCombo < maxMultiplierCombo) if (currMultiplierCombo < maxMultiplierCombo)
currMultiplierCombo += 1; currMultiplierCombo += 1;
MultiplierTextFx fx = multiplierText.GetScript<MultiplierTextFx>();
if (fx)
{
fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration);
}
} }
} }

View File

@ -1,10 +1,12 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class JumpPad : Script public class JumpPad : Script
{ {
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["SFXJumpPad"] = Audio.CreateAudioClip("event:/Props/jumppad_boing");
} }
protected override void update() protected override void update()
@ -15,6 +17,8 @@ public class JumpPad : Script
{ {
if (info.GameObject.GetScript<PlayerController>() && info.GameObject.GetScript<PlayerController>().currentState == PlayerController.RaccoonStates.FALLING) if (info.GameObject.GetScript<PlayerController>() && info.GameObject.GetScript<PlayerController>().currentState == PlayerController.RaccoonStates.FALLING)
{ {
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true; info.GameObject.GetScript<PlayerController>().landedOnJumpPad = true;
} }
} }

View File

@ -0,0 +1,169 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
namespace SHADE_Scripting.UI
{
public class PreviewLevel : Script
{
private List<Camera> listOfCamera;
public Vector3 endPoint1;
public Vector3 endPoint2;
public Vector3 endPoint3;
public GameObject playerCamera;
public GameObject gameplayCanvas;
public float duration = 3.0f;
private bool point1Done = false;
private bool point2Done = false;
private bool point3Done = false;
private bool reset2 = true;
private bool reset3 = true;
private bool skip = false;
[NonSerialized]
private TweenThreadVec3 moveToEndPoint1;
[NonSerialized]
private TweenThreadVec3 moveToEndPoint2;
[NonSerialized]
private TweenThreadVec3 moveToEndPoint3;
protected override void awake()
{
listOfCamera = GameObject.GetComponentsInChildren<Camera>().ToList();
if (listOfCamera.Count == 0)
Debug.LogError("EMPTY PREVIEW POINTS");
moveToEndPoint1 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[0].GetComponent<Transform>().LocalPosition, endPoint1, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint2 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[1].GetComponent<Transform>().LocalPosition, endPoint2, EASING_METHOD.EASE_IN_SINE);
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
}
protected override void start()
{
if (gameplayCanvas)
gameplayCanvas.SetActive(false);
listOfCamera[0].SetMainCamera();
}
protected override void update()
{
if (SceneFadeInOut.Instance && !SceneFadeInOut.Instance.FadeOutFinished() && !point1Done)
{
moveToEndPoint1.Reset();
return;
}
if (Input.GetKeyUp(Input.KeyCode.Space) && !point3Done)
{
skip = true;
point1Done = true;
point3Done = true;
SceneFadeInOut.Instance.CallFadeIn();
SceneFadeInOut.Instance.alphaValue = 0.01f;
}
if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished())
{
playerCamera.GetComponent<Camera>().SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (skip && SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished())
{
GameManager.Instance.PreviewLevelDone = true;
if (gameplayCanvas)
gameplayCanvas.SetActive(true);
}
if (!skip)
{
if (!point1Done)
{
listOfCamera[0].GetComponent<Transform>().LocalPosition = moveToEndPoint1.GetValue();
if (SceneFadeInOut.Instance && moveToEndPoint1.IsCompleted())
{
point1Done = true;
SceneFadeInOut.Instance.CallFadeIn();
SceneFadeInOut.Instance.alphaValue = 0.01f;
}
}
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point1Done)
{
listOfCamera[1].SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point1Done)
{
if (!point2Done)
{
if (reset2)
{
moveToEndPoint2.Reset();
reset2 = false;
}
listOfCamera[1].GetComponent<Transform>().LocalPosition = moveToEndPoint2.GetValue();
if (moveToEndPoint2.IsCompleted())
{
point2Done = true;
SceneFadeInOut.Instance.CallFadeIn();
SceneFadeInOut.Instance.alphaValue = 0.01f;
}
}
}
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point2Done)
{
listOfCamera[2].SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point2Done)
{
if (!point3Done)
{
if (reset3)
{
moveToEndPoint3 = TweenManager.CreateTweenThreadVec3(duration, listOfCamera[2].GetComponent<Transform>().LocalPosition, endPoint3, EASING_METHOD.EASE_IN_SINE);
reset3 = false;
}
listOfCamera[2].GetComponent<Transform>().LocalPosition = moveToEndPoint3.GetValue();
if (moveToEndPoint3.IsCompleted())
{
point3Done = true;
SceneFadeInOut.Instance.CallFadeIn();
SceneFadeInOut.Instance.alphaValue = 0.01f;
}
}
}
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeInFinished() && point3Done)
{
playerCamera.GetComponent<Camera>().SetMainCamera();
SceneFadeInOut.Instance.CallFadeOut();
}
if (SceneFadeInOut.Instance && SceneFadeInOut.Instance.FadeOutFinished() && point3Done)
{
GameManager.Instance.PreviewLevelDone = true;
if (gameplayCanvas)
gameplayCanvas.SetActive(true);
}
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_PreviewLevel
ID: 155897609
Type: 9

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting
{
static public class Settings
{
static public float cameraSensitivity = 100.0f;
static public float cameraFOV = 90.0f;
static public float masterVolume = 100.0f;
static public float sfxVolume = 100.0f;
static public float bgmVolume = 100.0f;
}
}

View File

@ -0,0 +1,3 @@
Name: Settings
ID: 163325256
Type: 9

View File

@ -52,12 +52,15 @@ namespace SHADE_Scripting.UI
private static float EaseInSine(float value) private static float EaseInSine(float value)
{ {
return (float)(1.0f - Math.Cos((value * Math.PI) / 2.0f));
return (float)(1.0f - Math.Cos((value * Math.PI / 2.0f) ));
} }
private static float EaseOutSine(float value) private static float EaseOutSine(float value)
{ {
return (float)(1.0f - Math.Sin(value * Math.PI) / 2.0f); return (float)(Math.Sin(value * Math.PI / 2.0f) );
} }

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;
@ -9,10 +9,10 @@ namespace SHADE_Scripting.UI
{ {
public class ButtonFX:Script public class ButtonFX:Script
{ {
public string onHoverEnterSound = "event:/Music/player_undetected"; public string onHoverEnterSound = "Empty";
public string onHoverExitSound = "event:/Music/player_undetected"; public string onHoverExitSound = "Empty";
public string onClickSound = "event:/Music/player_undetected"; public string onClickSound = "event:/UI/mouse_down_element";
public string onReleaseSound = "event:/Music/player_undetected"; public string onReleaseSound = "Empty";
[NonSerialized] [NonSerialized]
private AudioClipHandler onHoverEnterACHandler; private AudioClipHandler onHoverEnterACHandler;
@ -40,13 +40,16 @@ namespace SHADE_Scripting.UI
protected override void awake() protected override void awake()
{ {
onHoverEnterACHandler = SHADE.Audio.CreateAudioClip(onHoverEnterSound); if(onHoverEnterSound != "Empty")
onHoverExitACHandler = SHADE.Audio.CreateAudioClip(onHoverExitSound); onHoverEnterACHandler = SHADE.Audio.CreateAudioClip(onHoverEnterSound);
onClickACHandler = SHADE.Audio.CreateAudioClip(onClickSound);
onReleaseACHandler = SHADE.Audio.CreateAudioClip(onReleaseSound);
if(onHoverExitSound != "Empty")
onHoverExitACHandler = SHADE.Audio.CreateAudioClip(onHoverExitSound);
if (onClickSound != "Empty")
onClickACHandler = SHADE.Audio.CreateAudioClip(onClickSound);
if (onReleaseSound != "Empty")
onReleaseACHandler = SHADE.Audio.CreateAudioClip(onReleaseSound);
} }
protected override void start() protected override void start()
@ -67,7 +70,7 @@ namespace SHADE_Scripting.UI
ui.OnClick.RegisterAction(() => ui.OnClick.RegisterAction(() =>
{ {
if (onClickSound != "") if (onClickSound != "Empty")
onClickACHandler.Play(); onClickACHandler.Play();
tweening = true; tweening = true;
if(thread != null) if(thread != null)
@ -76,8 +79,10 @@ namespace SHADE_Scripting.UI
ui.OnRelease.RegisterAction(() => ui.OnRelease.RegisterAction(() =>
{ {
if (onReleaseSound != "") if (onReleaseSound != "Empty")
onReleaseACHandler.Play(); onReleaseACHandler.Play();
tweening = true; tweening = true;
if (thread != null) if (thread != null)
thread.Reset(currentScale, 1.0f); thread.Reset(currentScale, 1.0f);
@ -85,8 +90,12 @@ namespace SHADE_Scripting.UI
ui.OnHoverEnter.RegisterAction(() => ui.OnHoverEnter.RegisterAction(() =>
{ {
if (onHoverEnterSound != "") if (onHoverEnterSound!="Empty")
{
onHoverEnterACHandler.Play(); onHoverEnterACHandler.Play();
}
tweening = true; tweening = true;
if (thread != null) if (thread != null)
thread.Reset(currentScale, hoverScale); thread.Reset(currentScale, hoverScale);
@ -94,7 +103,7 @@ namespace SHADE_Scripting.UI
ui.OnHoverExit.RegisterAction(() => ui.OnHoverExit.RegisterAction(() =>
{ {
if (onHoverExitSound != "") if (onHoverExitSound != "Empty")
onHoverExitACHandler.Play(); onHoverExitACHandler.Play();
tweening = true; tweening = true;
if (thread != null) if (thread != null)
@ -110,7 +119,7 @@ namespace SHADE_Scripting.UI
return; return;
if (tweening == true && thread != null) if (tweening == true && thread != null)
{ {
Debug.Log("Tweening value " + thread.GetValue());
transform.LocalScale = defaultScale * thread.GetValue(); transform.LocalScale = defaultScale * thread.GetValue();
currentScale = thread.GetValue(); currentScale = thread.GetValue();
if (thread.IsCompleted()) if (thread.IsCompleted())

View File

@ -1,10 +1,19 @@
using System; using System;
using System.Reflection.Metadata.Ecma335;
using SHADE; using SHADE;
using SHADE_Scripting.UI;
public class ChangeSceneButton : Script public class ChangeSceneButton : Script
{ {
public uint sceneID = 0; public uint sceneID = 0;
//Whether the scene changing button has been clicked
private bool clickedFlag;
protected override void awake()
{
clickedFlag = false;
}
protected override void start() protected override void start()
{ {
@ -13,23 +22,26 @@ public class ChangeSceneButton : Script
{ {
ui.OnRelease.RegisterAction(() => ui.OnRelease.RegisterAction(() =>
{ {
if (sceneID != 0) if (sceneID != 0)
{ {
Audio.PlaySFXOnce2D("event:/UI/success"); Audio.PlaySFXOnce2D("event:/UI/success");
SceneManager.ChangeScene(sceneID); Audio.StopAllSounds();
Audio.StopAllSounds(); if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
clickedFlag = true;
} }
}); });
} }
else else
{ {
Debug.LogError("Failed to register button action for ChangeSceneButton."); Debug.LogError("Failed to register button action for ChangeSceneButton.");
} }
} }
protected override void update() protected override void update()
{ {
if (clickedFlag && sceneID != 0 && SceneFadeInOut.Instance.FadeInFinished())
{
SceneManager.ChangeScene(sceneID);
}
} }
} }

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.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene4Done || !cutscene5Done))
{
skip = true;
oldDuration = duration;
duration = skipDuration;
}
if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene4Done && canvas4.IsActiveSelf)
{
canvas4.SetActive(false);
canvas5.SetActive(true);
duration = oldDuration;
skip = false;
}
if (Input.GetKeyUp(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;
@ -93,14 +95,14 @@ public class Cutscene : Script
Canvas2(); Canvas2();
Canvas3(); Canvas3();
if (Input.GetKeyDown(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done)) if (Input.GetKeyUp(Input.KeyCode.Space) && !skip && (!cutscene1Done || !cutscene2Done || !cutscene3Done))
{ {
skip = true; skip = true;
oldDuration = duration; oldDuration = duration;
duration = 0.1f; duration = skipDuration;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene1Done && canvas1.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene1Done && canvas1.IsActiveSelf)
{ {
canvas1.SetActive(false); canvas1.SetActive(false);
canvas2.SetActive(true); canvas2.SetActive(true);
@ -108,7 +110,7 @@ public class Cutscene : Script
skip = false; skip = false;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene2Done && canvas2.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene2Done && canvas2.IsActiveSelf)
{ {
canvas2.SetActive(false); canvas2.SetActive(false);
canvas3.SetActive(true); canvas3.SetActive(true);
@ -116,9 +118,9 @@ public class Cutscene : Script
skip = false; skip = false;
} }
if (Input.GetKeyDown(Input.KeyCode.Space) && cutscene3Done && canvas3.IsActiveSelf) if (Input.GetKeyUp(Input.KeyCode.Space) && cutscene3Done && canvas3.IsActiveSelf)
{ {
//change scene SceneManager.ChangeScene(nextScene);
} }
} }
@ -409,7 +411,11 @@ public class Cutscene : Script
private void initCutscene1() private void initCutscene1()
{ {
listOfCutscene1Points = cutscene1Points.GetComponentsInChildren<Transform>().ToList(); if(cutscene1Points)
listOfCutscene1Points = cutscene1Points.GetComponentsInChildren<Transform>().ToList();
else
Debug.LogError("Cutscene1Points Missing");
if (listOfCutscene1Points.Count == 0) if (listOfCutscene1Points.Count == 0)
Debug.LogError("Cutscene1Points Empty"); Debug.LogError("Cutscene1Points Empty");
@ -455,7 +461,11 @@ public class Cutscene : Script
private void initCutscene2() private void initCutscene2()
{ {
listOfCutscene2Points = cutscene2Points.GetComponentsInChildren<Transform>().ToList(); if(cutscene2Points)
listOfCutscene2Points = cutscene2Points.GetComponentsInChildren<Transform>().ToList();
else
Debug.LogError("cutscene2Points Missing");
if (listOfCutscene2Points.Count == 0) if (listOfCutscene2Points.Count == 0)
Debug.LogError("Cutscene2Points Empty"); Debug.LogError("Cutscene2Points Empty");
@ -503,7 +513,11 @@ public class Cutscene : Script
private void initCutscene3() private void initCutscene3()
{ {
listOfCutscene3Points = cutscene3Points.GetComponentsInChildren<Transform>().ToList(); if(cutscene3Points)
listOfCutscene3Points = cutscene3Points.GetComponentsInChildren<Transform>().ToList();
else
Debug.LogError("cutscene3Points Missing");
if (listOfCutscene3Points.Count == 0) if (listOfCutscene3Points.Count == 0)
Debug.LogError("Cutscene3Points Empty"); Debug.LogError("Cutscene3Points Empty");

View File

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

View File

@ -1,6 +1,7 @@
using System; using System;
using SHADE; using SHADE;
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using SHADE_Scripting.UI;
public class EndScene : Script public class EndScene : Script
{ {
@ -12,6 +13,15 @@ public class EndScene : Script
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()
{
Debug.Log("EndScene::Start():");
Input.SetMouseCentering(false);
Application.IsCursorVisible = true;
SceneFadeInOut.Instance.CallFadeOut();
}
protected override void update() protected override void update()
{ {
if (Input.GetKeyDown(Input.KeyCode.R)) if (Input.GetKeyDown(Input.KeyCode.R))
@ -23,7 +33,7 @@ public class EndScene : Script
{ {
//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);
} }
@ -37,7 +47,7 @@ public class EndScene : Script
{ {
//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

@ -1,6 +1,7 @@
using System; using System;
using SHADE; using SHADE;
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using SHADE_Scripting.UI;
public class MainMenu : Script public class MainMenu : Script
{ {
@ -23,40 +24,12 @@ public class MainMenu : Script
protected override void start() protected override void start()
{ {
Input.SetMouseCentering(false);
Application.IsCursorVisible = true;
SceneFadeInOut.Instance.CallFadeOut();
} }
protected override void update() protected override void update()
{ {
/* if (Input.GetKeyDown(Input.KeyCode.K) && obj)
{
if (testRenderable.Material.GetProperty<float>("data.alpha") == 1)
{
testRenderable.Material.SetProperty<float>("data.alpha", 0);
}
else if (testRenderable.Material.GetProperty<float>("data.alpha") == 0)
{
testRenderable.Material.SetProperty<float>("data.alpha", 1);
}
}*/
if (Input.GetKeyDown(Input.KeyCode.Space))
{
//Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
}
if (Input.GetKeyUp(Input.KeyCode.Space))
{
//Audio.PlaySFXOnce2D("event:/UI/success");
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
SceneManager.ChangeScene(sceneID);
Audio.StopAllSounds();
}
if (Input.GetKeyDown(Input.KeyCode.Escape))
{
Audio.StopAllSounds();
Application.Quit();
}
} }
} }

View File

@ -0,0 +1,112 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class MultiplierTextFx : Script
{
[NonSerialized]
private TweenThread sizeThread;
private TweenThread sizeInvertThread;
private TweenThread alphaThread;
public float maxSize = 1.0f;
public float minSize = 0.3f;
public float minAlpha = 0.3f;
private bool showMultiplier = false;
const float sizeUpDuration = 0.1f;
[NonSerialized]
private Vector3 defaultScale;
protected override void start()
{
sizeThread = TweenManager.CreateTweenThread(0.0f, maxSize, minSize, EASING_METHOD.EASE_IN_SINE);
sizeInvertThread = TweenManager.CreateTweenThread(sizeUpDuration, minSize, maxSize, EASING_METHOD.EASE_IN_SINE);
alphaThread = TweenManager.CreateTweenThread(0.0f, 1.0f, minAlpha, EASING_METHOD.EASE_OUT_SINE);
Transform transform = GetComponent<Transform>();
if (transform != null)
{
defaultScale = transform.LocalScale;
transform.LocalScale = Vector3.Zero;
}
showMultiplier = false;
}
protected override void update()
{
Transform transform = GetComponent<Transform>();
if (transform != null && showMultiplier == true)
{
if(!sizeInvertThread.IsCompleted())
{
transform.LocalScale = defaultScale * sizeInvertThread.GetValue();
Renderable rend = GetComponentInChildren<Renderable>();
if(rend)
{
rend.Material.SetProperty<float>("data.alpha", 1.0f);
}
TextRenderable text = GetComponent<TextRenderable>();
if (text)
{
Color clr = text.TextColor;
text.TextColor = new Color(clr.r, clr.g, clr.b, 1.0f);
}
return;
}
if(sizeThread.IsCompleted())
{
transform.LocalScale = Vector3.Zero;
showMultiplier = false;
}
else
{
transform.LocalScale = defaultScale * sizeThread.GetValue();
Renderable rend = GetComponentInChildren<Renderable>();
if (rend)
{
rend.Material.SetProperty<float>("data.alpha", alphaThread.GetValue());
}
TextRenderable text = GetComponent<TextRenderable>();
if(text)
{
Color clr = text.TextColor;
text.TextColor = new Color(clr.r,clr.g,clr.b,alphaThread.GetValue() * 1.3f);
}
}
}
}
public void ShowMultiplier(int multiplier, float duration)
{
GetComponent<TextRenderable>().Text = $"X {multiplier}";
sizeThread.duration = duration + sizeUpDuration;
alphaThread.duration = duration + sizeUpDuration;
sizeInvertThread.Reset();
sizeThread.Reset();
alphaThread.Reset();
showMultiplier = true;
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_MultiplierTextFx
ID: 158917210
Type: 9

View File

@ -0,0 +1,95 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class Options:Script
{
public GameObject masterVolSlider;
public GameObject sfxVolSlider;
public GameObject bgmVolSlider;
public GameObject fovSlider;
public GameObject sensitivitySlider;
protected override void awake()
{
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)
{
mv.ScaledValue = Settings.masterVolume;
}
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;
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_Options
ID: 162565004
Type: 9

View File

@ -8,16 +8,19 @@ public class PauseMenu : Script
public GameObject retryBtn; public GameObject retryBtn;
public GameObject quitBtn; public GameObject quitBtn;
public GameObject gamePauseText; private TextRenderable gamePauseText;
public GameObject canvas; public GameObject canvas;
protected override void awake() protected override void awake()
{ {
GameManager.Instance.GamePause = false; if (GameManager.Instance != null)
if (gamePauseText) GameManager.Instance.GamePause = false;
gamePauseText.GetComponent<TextRenderable>().Enabled = false;
if (canvas) if (canvas)
{
gamePauseText = canvas.GetComponentInChildren<TextRenderable>();
canvas.SetActive(false); canvas.SetActive(false);
}
if (!resumeBtn) if (!resumeBtn)
Debug.LogError("Resume Btn missing"); Debug.LogError("Resume Btn missing");
@ -34,16 +37,19 @@ public class PauseMenu : Script
UIElement resume = resumeBtn.GetComponent<UIElement>(); UIElement resume = resumeBtn.GetComponent<UIElement>();
if (resume != null) if (resume != null)
{ {
resume.OnClick.RegisterAction(() => resume.OnRelease.RegisterAction(() =>
{ {
if (GameManager.Instance.GamePause) if (GameManager.Instance.GamePause)
{ {
GameManager.Instance.GamePause = false; GameManager.Instance.GamePause = false;
AudioHandler.pauseAllSounds(false); Input.SetMouseCentering(true);
Application.IsCursorVisible = false;
AudioHandler.PauseAllSounds(false);
if (gamePauseText) if (gamePauseText)
gamePauseText.GetComponent<TextRenderable>().Enabled = false; gamePauseText.Enabled = false;
if (canvas) if (canvas)
canvas.SetActive(false); canvas.SetActive(false);
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
} }
}); });
} }
@ -56,10 +62,13 @@ public class PauseMenu : Script
UIElement retry = retryBtn.GetComponent<UIElement>(); UIElement retry = retryBtn.GetComponent<UIElement>();
if (retry != null) if (retry != null)
{ {
retry.OnClick.RegisterAction(() => retry.OnRelease.RegisterAction(() =>
{ {
Audio.StopAllSounds(); Audio.StopAllSounds();
SceneManager.RestartScene(); SceneManager.RestartScene();
GameManager.Instance.GamePause = false;
GameManager.Instance.stealFoodPopUpDone = false;
GameManager.Instance.PreviewLevelDone = false;
}); });
} }
else else
@ -70,7 +79,7 @@ public class PauseMenu : Script
UIElement quit = quitBtn.GetComponent<UIElement>(); UIElement quit = quitBtn.GetComponent<UIElement>();
if (quit != null) if (quit != null)
{ {
quit.OnClick.RegisterAction(() => quit.OnRelease.RegisterAction(() =>
{ {
Audio.StopAllSounds(); Audio.StopAllSounds();
//go to main menu //go to main menu
@ -86,14 +95,17 @@ public class PauseMenu : Script
protected override void update() protected override void update()
{ {
if (Input.GetKeyDown(Input.KeyCode.Escape) && !GameManager.Instance.GamePause) if (Input.GetKeyUp(Input.KeyCode.Escape) && !GameManager.Instance.GamePause && GameManager.Instance.stealFoodPopUpDone)
{ {
GameManager.Instance.GamePause = true; GameManager.Instance.GamePause = true;
AudioHandler.pauseAllSounds(true); Input.SetMouseCentering(false);
Application.IsCursorVisible = true;
AudioHandler.PauseAllSounds(true);
if (gamePauseText) if (gamePauseText)
gamePauseText.GetComponent<TextRenderable>().Enabled = true; gamePauseText.Enabled = true;
if (canvas) if (canvas)
canvas.SetActive(true); canvas.SetActive(true);
Application.FixDeltaTime = 0;
} }
} }

View File

@ -0,0 +1,132 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class SceneFadeInOut : Script
{
//[Tooltip("If true, the panel fadeUI fades in (increasing alpha). If false, no fading. Mutually exclusive with fadeIn")]
private bool fadeIn;
//[Tooltip("If true, the panel fadeUI fades out (decreasing alpha). If false, no fading. Mutually exclusive with fadeIn")]
private bool fadeOut;
[Tooltip("The initial alpha value of the UI that is faded. Between 0 and 1 inclusive.")]
public float alphaValue;
[SerializeField]
private float fadeInTime;
[SerializeField]
private float fadeOutTime;
private Renderable fadeR;
public static SceneFadeInOut Instance { get; private set; }
protected override void awake()
{
if (Instance != null && Instance != this)
RemoveScript<SceneFadeInOut>();
else
Instance = this;
fadeR = GameObject.GetComponent<Renderable>();
fadeR.Material.SetProperty<float>("data.alpha", alphaValue);
GameObject.Parent.SetActive(false);
//alphaValue = fadeR.Material.GetProperty<float>("data.alpha");
}
protected override void start()
{
}
protected override void update()
{
if (fadeR != null)
{
if (fadeIn) //fading in
{
fadeOut = false;
if (fadeInTime == 0.0f)
{
alphaValue = 1.0f;
}
else
{
alphaValue += (1.0f / fadeInTime) * Time.DeltaTimeF;
}
if (alphaValue >= 1.0f)
{
alphaValue = 1.0f;
//GameObject.Parent.SetActive(false);
}
}
if (fadeOut) //fading out
{
fadeIn = false;
if (fadeOutTime == 0.0f)
{
alphaValue = 0.0f;
}
else
{
alphaValue -= (1.0f / fadeOutTime) * Time.DeltaTimeF;
}
if (alphaValue <= 0.0f)
{
alphaValue = 0.0f;
//This line is to be added so that (because the fade in and out item is usually the front-most UI element)
//the fade in and out UI element does not block functionality of other UI elements
GameObject.Parent.SetActive(false);
}
}
fadeR.Material.SetProperty<float>("data.alpha", alphaValue);
}
}
protected override void onDestroy()
{
if (Instance == this)
Instance = null;
}
public void CallFadeIn()
{
fadeIn = true;
fadeOut = false;
GameObject.Parent.SetActive(true);
}
public void CallFadeOut()
{
fadeOut = true;
fadeIn = false;
GameObject.Parent.SetActive(true);
}
public void CallFadeStop()
{
fadeOut = false;
fadeIn = false;
GameObject.Parent.SetActive(false);
}
public bool FadeOutFinished()
{
return (alphaValue <= 0.0f);
}
public bool FadeInFinished()
{
return (alphaValue >= 1.0f);
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_SceneFadeInOut
ID: 153328192
Type: 9

View File

@ -0,0 +1,49 @@
using System;
using SHADE;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class ScrollingCredits: Script
{
public float endY = 4000.0f;
public float duration = 30.0f;
[NonSerialized]
TweenThread thread;
protected override void awake()
{
base.awake();
}
protected override void start()
{
base.start();
Transform transform = GetComponent<Transform>();
if(transform != null)
{
thread = TweenManager.CreateTweenThread(duration, transform.LocalPosition.y, endY, EASING_METHOD.EASE_IN_SINE);
}
}
protected override void update()
{
base.update();
Transform transform = GetComponent<Transform>();
if(thread != null && transform != null)
{
transform.LocalPosition = new Vector3( transform.LocalPosition.x ,thread.GetValue() , transform.LocalPosition.z);
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_ScrollingCredits
ID: 159139676
Type: 9

View File

@ -11,8 +11,6 @@ namespace SHADE_Scripting.UI
{ {
public GameObject sliderObj; public GameObject sliderObj;
public int minValue = 0;
public int maxValue = 0;
protected override void start() protected override void start()
{ {
@ -22,7 +20,7 @@ namespace SHADE_Scripting.UI
if (slider != null && text != null) if (slider != null && text != null)
{ {
text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString(); text.Text = ((int)(slider.ScaledValue)).ToString();
} }
} }
protected override void update() protected override void update()
@ -32,7 +30,7 @@ namespace SHADE_Scripting.UI
if(slider != null && text != null) if(slider != null && text != null)
{ {
text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString(); text.Text = ((int)(slider.ScaledValue)).ToString();
} }
} }

View File

@ -51,6 +51,13 @@ namespace SHADE_Scripting.UI
//538x377 //538x377
protected override void update() protected override void update()
{ {
if (!GameManager.Instance.PreviewLevelDone)
{
rot.Reset();
scaleX.Reset();
scaleY.Reset();
return;
}
if (!popInDone) if (!popInDone)
{ {
@ -79,11 +86,11 @@ namespace SHADE_Scripting.UI
if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted()) if (scaleOutX.IsCompleted() && scaleOutY.IsCompleted())
{ {
GameObject.SetActive(false); GameObject.SetActive(false);
GameManager.Instance.stealFoodPopUpDone = true;
} }
} }
} }
} }
} }

View File

@ -16,8 +16,6 @@ namespace SHADE_Scripting.UI
private float value = 0.0f; private float value = 0.0f;
public float startValue = 0.0f; public float startValue = 0.0f;
public float endValue = 1.0f; public float endValue = 1.0f;
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method) public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{ {
this.duration = duration; this.duration = duration;
@ -25,7 +23,6 @@ namespace SHADE_Scripting.UI
this.startValue = startValue; this.startValue = startValue;
this.endValue = endValue; this.endValue = endValue;
} }
public void Update(float deltaTime) public void Update(float deltaTime)
{ {
if (timer >= duration) if (timer >= duration)
@ -37,12 +34,10 @@ namespace SHADE_Scripting.UI
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ; value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
} }
public bool IsCompleted() public bool IsCompleted()
{ {
return timer >= duration; return timer >= duration;
} }
public void Reset() public void Reset()
{ {
timer = 0.0f; timer = 0.0f;
@ -61,15 +56,69 @@ namespace SHADE_Scripting.UI
startValue = endValue; startValue = endValue;
endValue = temp; endValue = temp;
} }
public float GetValue() public float GetValue()
{ {
return value; 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 class TweenManager : Script
{ {
public static TweenManager Instance { get; private set; } public static TweenManager Instance { get; private set; }
@ -77,6 +126,9 @@ namespace SHADE_Scripting.UI
[NonSerialized] [NonSerialized]
private List<TweenThread> threadList; private List<TweenThread> threadList;
[NonSerialized]
private List<TweenThreadVec3> threadVec3List;
protected override void awake() protected override void awake()
{ {
if (Instance != null && Instance != this) if (Instance != null && Instance != this)
@ -85,6 +137,7 @@ namespace SHADE_Scripting.UI
Instance = this; Instance = this;
threadList = new List<TweenThread>(); threadList = new List<TweenThread>();
threadVec3List = new List<TweenThreadVec3>();
} }
@ -101,6 +154,11 @@ namespace SHADE_Scripting.UI
{ {
thread.Update(Time.DeltaTimeF); thread.Update(Time.DeltaTimeF);
} }
foreach (TweenThreadVec3 thread in threadVec3List)
{
thread.Update(Time.DeltaTimeF);
}
} }
@ -116,5 +174,20 @@ namespace SHADE_Scripting.UI
return thread; 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

@ -78,8 +78,12 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
float pMax = LinStep (variance / (variance + (d * d)), 0.9f, 1.0f); float pMax = LinStep (variance / (variance + (d * d)), 0.9f, 1.0f);
return min (max (p, pMax), 1.0f); return min (max (p, pMax), 1.0f);
} }
else if (fragPosLightPOV.z > 1.0f)
{
return 0.0f;
}
else else
return 1.0f; return 0.3f;
// return step (fragPosLightPOV.z, ); // return step (fragPosLightPOV.z, );
} }
@ -125,7 +129,7 @@ void main()
vec3 dLightNormalized = normalize (DirLightData.dLightData[i].direction); vec3 dLightNormalized = normalize (DirLightData.dLightData[i].direction);
// Get diffuse strength // Get diffuse strength
float diffuseStrength = max (0, dot (dLightNormalized, normalView)); float diffuseStrength = max (0, dot (-dLightNormalized, normalView));
// Calculate the fragment color // Calculate the fragment color
fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse; fragColor += DirLightData.dLightData[i].diffuseColor.rgb * diffuseStrength.rrr * pixelDiffuse;

View File

@ -0,0 +1,117 @@
#version 450
layout(local_size_x = 128) in;
struct EmitterParameters
{
vec4 angularMin;
vec4 angularMax;
vec4 lifeAndSizeRange; // min life, max life, min size, max size
}
struct ParticleData
{
vec4 position;
vec4 rotation;
vec4 velocity;
vec4 acceleration;
vec4 scaleAndDecay;
float life;
uint textureIndex;
}
struct GenericData
{
//! Delta time
float dt;
//! Elapsed time of the application
float elapsedTime;
//! Viewport width of the scene (excluding imgui, that means smaller than window)
uint viewportWidth;
//! Ditto but for height
uint viewportHeight;
};
layout (set = 0, binding = 0) uniform GenericDataBuffer
{
GenericData data;
} genericDataBuffer;
layout (std430, set = 2, binding = 0) readonly buffer EmitterBuffer
{
EmitterParameters data;
} emitterParams;
layout (std430, set = 2, binding = 1) coherent restrict buffer ParticlesInputBuffer
{
ParticleData data[];
} inputParticles;
// output buffer not needed
// layout (std430, set = 2, binding = 2) coherent restrict buffer ParticlesOutputBuffer
// {
// ParticleData data[];
// } outputParticles;
layout (std430, set = 2, binding = 3) coherent restrict buffer ParticlesFreelistBuffer
{
int freeCount;
int freeIndices[];
} freelist;
// push constants
layout(std140, push_constant) uniform EmitterPushConstant
{
vec4 emitterPosition;
uint emissionCount;
} emitterPushConstant;
uint pcg_hash(uint seed)
{
uint state = seed * 747796405u + 2891336453u;
uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
return (word >> 22u) ^ word;
}
// Used to advance the PCG state.
uint rand_pcg(inout uint rng_state)
{
uint state = rng_state;
rng_state = rng_state * 747796405u + 2891336453u;
uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
return (word >> 22u) ^ word;
}
// Advances the prng state and returns the corresponding random float.
float rand(inout uint state)
{
uint x = rand_pcg(state);
state = x;
return float(x)*uintBitsToFloat(0x2f800004u);
}
void main()
{
uint emitterInvocationIndex = gl_GlobalInvocationID.x;
if (emitterInvocationIndex >= emitterPushConstant.emissionCount)
return;
int freelistIndex = atomicAdd (freelist.freeCount, -1) - 1;
if (freelistIndex < 0)
atomicAdd (freelist.freeCount, 1);
ParticleData particle;
int index = freelist.freeIndices[freelistIndex];
particle.position = emitterPosition;
particle.life = emitterParams.10.0f;
particles[index] = particle;
}

View File

@ -0,0 +1,141 @@
#version 450
layout(local_size_x = 128) in;
struct DrawArraysIndirectArgs
{
uint count;
uint instanceCount;
uint first;
uint baseInstance;
};
struct ParticleData
{
vec4 position;
vec4 rotation;
vec4 velocity;
vec4 acceleration;
vec4 scaleAndDecay;
float life;
uint textureIndex;
}
struct GenericData
{
//! Delta time
float dt;
//! Elapsed time of the application
float elapsedTime;
//! Viewport width of the scene (excluding imgui, that means smaller than window)
uint viewportWidth;
//! Ditto but for height
uint viewportHeight;
};
layout(set = 1, binding = 0) uniform CameraData
{
vec4 position;
mat4 vpMat;
mat4 viewMat;
mat4 projMat;
} cameraData;
layout (set = 0, binding = 0) uniform GenericDataBuffer
{
GenericData data;
} genericDataBuffer;
layout (std430, set = 2, binding = 1) coherent restrict readonly buffer ParticlesInputBuffer
{
ParticleData data[];
} inputParticles;
// output buffer not needed
layout (std430, set = 2, binding = 2) coherent restrict buffer ParticlesOutputBuffer
{
ParticleData data[];
} outputParticles;
layout (std430, set = 2, binding = 3) coherent restrict buffer ParticlesFreelistBuffer
{
int freeCount;
int freeIndices[];
} freelist;
layout (std430, set = 2, binding = 4) coherent restrict buffer IndicesData
{
uint indices[];
};
layout (std140, set = 2, binding = 5) coherent restrict uniform IndirectDrawArgs
{
DrawArraysIndirectArgs indirectArgs;
};
// push constants
layout(std140, push_constant) uniform EmitterPushConstant
{
vec4 emitterPosition;
uint emissionCount;
} emitterPushConstant;
uint pcg_hash(uint seed)
{
uint state = seed * 747796405u + 2891336453u;
uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
return (word >> 22u) ^ word;
}
// Used to advance the PCG state.
uint rand_pcg(inout uint rng_state)
{
uint state = rng_state;
rng_state = rng_state * 747796405u + 2891336453u;
uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
return (word >> 22u) ^ word;
}
// Advances the prng state and returns the corresponding random float.
float rand(inout uint state)
{
uint x = rand_pcg(state);
state = x;
return float(x)*uintBitsToFloat(0x2f800004u);
}
void main()
{
uint index = gl_GlobalInvocationID.x;
ParticleData particle = inputParticles.data[index];
if (particle.lifetime > 0.0f)
{
// particle.position += particle.velocity * dt;
// particle.lifetime -= dt;
// particle.size -= 1.2f * dt;
// particle.color += 1.0f * dt;
if (particle.lifetime < 0.0f || particle.size < 0.0f)
{
particle.lifetime = 0.0f;
particle.position.x = 99999.0f;
outputParticles.data[index] = particle;
freelist.freeIndices[atomicAdd(freelist.freeCount, 1)] = int (index);
return;
}
outputParticles.data[index] = particle;
uint drawIndex = atomicAdd (indirectArgs.instanceCount, 1);
indices[drawIndex] = index;
}
}

View File

@ -78,8 +78,14 @@ void main()
outEntityID = In2.eid; outEntityID = In2.eid;
lightLayerIndices = In2.lightLayerIndex; lightLayerIndices = In2.lightLayerIndex;
float vpHeight = float (In2.screenSpacePos.y) - MatProp.data[In2.materialIndex].highlightPosition; // float vpHeight = float (In2.screenSpacePos.y) - MatProp.data[In2.materialIndex].highlightPosition;
vpHeight = float (int (vpHeight) % genericDataBuffer.data.viewportHeight); // bring the frame of reference to the object's screen space pos
int scale = 470;
float vpHeight = float (In2.screenSpacePos.y);
float relativePos = float(int (-MatProp.data[In2.materialIndex].highlightPosition) % scale) - float (scale / 2);
vpHeight += relativePos;
// vpHeight = float (int (vpHeight) % genericDataBuffer.data.viewportHeight);
float scanlineScale = MatProp.data[In2.materialIndex].thickness * (1.0f - In2.screenSpacePos.z) * 100.0f; float scanlineScale = MatProp.data[In2.materialIndex].thickness * (1.0f - In2.screenSpacePos.z) * 100.0f;
float lowerLimit = vpHeight - scanlineScale; float lowerLimit = vpHeight - scanlineScale;

View File

@ -3,7 +3,7 @@
#extension GL_ARB_shading_language_420pack : enable #extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require #extension GL_EXT_nonuniform_qualifier : require
layout (input_attachment_index = 0, set = 3, binding = 0) uniform subpassInput sceneTexture; layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput sceneTexture;
layout(location = 0) out vec4 fragColor; layout(location = 0) out vec4 fragColor;

View File

@ -32,5 +32,5 @@ void main()
Out.uv = aUV; Out.uv = aUV;
Out.color = aColor; Out.color = aColor;
gl_Position = cameraData.projMat * aTransform * vec4(aPos, 1.0f); gl_Position = cameraData.vpMat * aTransform * vec4(aPos, 1.0f);
} }

View File

@ -0,0 +1,49 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
struct MatPropData
{
vec4 color;
int textureIndex;
float alpha;
};
layout(location = 0) in struct
{
vec4 vertPos; // location 0
vec2 uv; // location = 1
vec4 normal; // location = 2
} In;
// material stuff
layout(location = 3) flat in struct
{
int materialIndex;
uint eid;
uint lightLayerIndex;
} In2;
layout (set = 0, binding = 1) uniform sampler2D textures[]; // for textures (global)
layout (std430, set = 2, binding = 0) buffer MaterialProperties // For materials
{
MatPropData data[];
} MatProp;
layout(location = 0) out vec4 fragColor;
layout(location = 1) out uint outEntityID;
void main()
{
fragColor = MatProp.data[In2.materialIndex].color;
if (fragColor.a < 0.01f)
{
discard;
}
fragColor.a = MatProp.data[In2.materialIndex].alpha;
// fragColor.a = 1.0f;
outEntityID = In2.eid;
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: UI_Black_FS
ID: 50110174
Type: 2

View File

@ -37,7 +37,7 @@ layout(location = 1) out uint outEntityID;
void main() void main()
{ {
fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv); fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
if (fragColor.a < 0.01f) if (fragColor.a < 0.1f)
{ {
discard; discard;
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: Button_Credits_Hover
ID: 55990309
Type: 3

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More