Implemented color decay, color range emission and custom VS and FS for particles #447
Binary file not shown.
|
@ -5,3 +5,63 @@ Sub Assets:
|
|||
Name: Full
|
||||
ID: 227644717
|
||||
Type: 13
|
||||
Name: TPose
|
||||
ID: 221337587
|
||||
Type: 13
|
||||
Name: Idle
|
||||
ID: 224442713
|
||||
Type: 13
|
||||
Name: Walk
|
||||
ID: 229189609
|
||||
Type: 13
|
||||
Name: Alerted_by_Racoon
|
||||
ID: 227890696
|
||||
Type: 13
|
||||
Name: Alerted_Idle
|
||||
ID: 234046577
|
||||
Type: 13
|
||||
Name: Alerted_Run
|
||||
ID: 230172366
|
||||
Type: 13
|
||||
Name: Interact
|
||||
ID: 220088098
|
||||
Type: 13
|
||||
Name: Distracted
|
||||
ID: 229108322
|
||||
Type: 13
|
||||
Name: StunStartFront
|
||||
ID: 223296233
|
||||
Type: 13
|
||||
Name: StunLoopFront
|
||||
ID: 230129276
|
||||
Type: 13
|
||||
Name: StunEndFront
|
||||
ID: 224141761
|
||||
Type: 13
|
||||
Name: StunStartBack
|
||||
ID: 218547923
|
||||
Type: 13
|
||||
Name: StunLoopBack
|
||||
ID: 219563559
|
||||
Type: 13
|
||||
Name: StunEndBack
|
||||
ID: 226668516
|
||||
Type: 13
|
||||
Name: React_to_Broken_Stuff
|
||||
ID: 228323560
|
||||
Type: 13
|
||||
Name: Pickup_Item
|
||||
ID: 227002263
|
||||
Type: 13
|
||||
Name: Return_Item
|
||||
ID: 222655168
|
||||
Type: 13
|
||||
Name: Attack_Windup
|
||||
ID: 223078653
|
||||
Type: 13
|
||||
Name: Attack_Hold
|
||||
ID: 228250554
|
||||
Type: 13
|
||||
Name: Attack_Sequence
|
||||
ID: 226129627
|
||||
Type: 13
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,14 +1,14 @@
|
|||
0 StaticObject 1100000000000000
|
||||
1 Player 1100000000000000
|
||||
0 StaticObject 1101000000000000
|
||||
1 Furniture 1101000000000000
|
||||
2 Food 1000000000000000
|
||||
3 Breakable 1100000000000000
|
||||
4 ScoringWallCollider 0110000000000000
|
||||
5 Homeowner 1100000000000000
|
||||
6 Camera 0010000000000000
|
||||
7 StaticWithCameraCollision 1110000000000000
|
||||
8 9 0000000000000000
|
||||
9 10 0000000000000000
|
||||
10 11 0000000000000000
|
||||
7 StaticWithCameraCollision 1111000000000000
|
||||
8 Floor 1100000000000000
|
||||
9 Navigation 0001000000000000
|
||||
10 Player 1100000000000000
|
||||
11 12 0000000000000000
|
||||
12 13 0000000000000000
|
||||
13 14 0000000000000000
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 51238312
|
||||
data.textureIndex: 59076169
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -3,6 +3,6 @@
|
|||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 61471971
|
||||
data.textureIndex: 66572525
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -3,6 +3,6 @@
|
|||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 58217538
|
||||
data.textureIndex: 66182834
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -3,6 +3,6 @@
|
|||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 61980534
|
||||
data.textureIndex: 58009216
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -3,6 +3,6 @@
|
|||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 51561286
|
||||
data.textureIndex: 55022275
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -3,6 +3,6 @@
|
|||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 58181851
|
||||
data.textureIndex: 56004904
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -3,6 +3,6 @@
|
|||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 59379300
|
||||
data.textureIndex: 55278388
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -0,0 +1,8 @@
|
|||
- VertexShader: 46580970
|
||||
FragmentShader: 35983630
|
||||
SubPass: UI
|
||||
Properties:
|
||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||
data.textureIndex: 60776650
|
||||
data.alpha: 1
|
||||
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -0,0 +1,3 @@
|
|||
Name: UIMat_MenuBG
|
||||
ID: 130823048
|
||||
Type: 7
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
Name: MD_CeilingFan
|
||||
ID: 73062062
|
||||
Type: 4
|
||||
Sub Assets:
|
||||
Name: Sphere.005
|
||||
ID: 135521751
|
||||
Type: 8
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: Level1_NavData
|
||||
ID: 257298636
|
||||
Type: 15
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: Level2_AITest_NavData
|
||||
ID: 254149790
|
||||
Type: 15
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: Level2_NavData
|
||||
ID: 260674210
|
||||
Type: 15
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: Level3_NavData
|
||||
ID: 263362242
|
||||
Type: 15
|
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
|
@ -0,0 +1,3 @@
|
|||
Name: Level2_AITest
|
||||
ID: 86300248
|
||||
Type: 5
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,4 @@
|
|||
- NavData: 0
|
||||
- EID: 0
|
||||
Name: Main Menu Canvas
|
||||
IsActive: true
|
||||
|
@ -35,9 +36,9 @@
|
|||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -700, y: 350, z: 0.300000012}
|
||||
Translate: {x: 0, y: 100, z: 0.300000012}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 355.756439, y: 355.756439, z: 1.18585491}
|
||||
Scale: {x: 600, y: 600, z: 1.18585491}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
|
@ -60,9 +61,9 @@
|
|||
NumberOfChildren: 6
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -60, y: 0, z: 0}
|
||||
Translate: {x: 0, y: -400, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 0.899999976, y: 0.899999976, z: 1}
|
||||
Scale: {x: 0.800000012, y: 0.800000012, z: 1}
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 0
|
||||
|
@ -76,9 +77,9 @@
|
|||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -700, y: 100, z: 0.400000006}
|
||||
Translate: {x: 0, y: 0, z: 0.400000006}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 450, y: 100, z: 1}
|
||||
Scale: {x: 400, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
|
@ -95,9 +96,6 @@
|
|||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: ChangeSceneButton
|
||||
Enabled: true
|
||||
sceneID: 91947920
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
onHoverEnterSound: event:/UI/botton_hover
|
||||
|
@ -106,15 +104,18 @@
|
|||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- Type: SHADE_Scripting.UI.ChangeCanvasButton
|
||||
Enabled: true
|
||||
canvasToActivate: 50
|
||||
- EID: 6
|
||||
Name: Quit Game Button
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -700, y: -525, z: 0.400000006}
|
||||
Translate: {x: 900, y: 0, z: 0.400000006}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 450, y: 100, z: 1}
|
||||
Scale: {x: 400, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
|
@ -143,28 +144,28 @@
|
|||
clickScale: 0.899999976
|
||||
- EID: 7
|
||||
Name: Level Select Button
|
||||
IsActive: true
|
||||
IsActive: false
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -700, y: -25, z: 0.400000006}
|
||||
Translate: {x: 0, y: 0, z: 0.400000006}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 450, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Scale: {x: 400, y: 100, z: 1}
|
||||
IsActive: false
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
IsActive: false
|
||||
Button Component:
|
||||
Default Texture: 66852025
|
||||
Hovered Texture: 65992947
|
||||
Clicked Texture: 57197441
|
||||
IsActive: true
|
||||
IsActive: false
|
||||
UI Component:
|
||||
Canvas ID: 0
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
IsActive: false
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.ButtonFX
|
||||
Enabled: true
|
||||
|
@ -183,9 +184,9 @@
|
|||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -700, y: -150, z: 0.400000006}
|
||||
Translate: {x: -450, y: 0, z: 0.400000006}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 450, y: 100, z: 1}
|
||||
Scale: {x: 400, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
|
@ -219,9 +220,9 @@
|
|||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -700, y: -275, z: 0.400000006}
|
||||
Translate: {x: -900, y: 0, z: 0.400000006}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 450, y: 100, z: 1}
|
||||
Scale: {x: 400, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
|
@ -255,9 +256,9 @@
|
|||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -700, y: -400, z: 0.400000006}
|
||||
Translate: {x: 450, y: 0, z: 0.400000006}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 450, y: 100, z: 1}
|
||||
Scale: {x: 400, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
|
@ -343,7 +344,7 @@
|
|||
- EID: 13
|
||||
Name: How To Play Canvas
|
||||
IsActive: false
|
||||
NumberOfChildren: 5
|
||||
NumberOfChildren: 6
|
||||
Components:
|
||||
Canvas Component:
|
||||
Canvas Width: 1920
|
||||
|
@ -479,17 +480,17 @@
|
|||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -800, y: 450, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 3.14159274}
|
||||
Scale: {x: 100, y: 100, z: 1}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 273, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 55358401
|
||||
Hovered Texture: 59400474
|
||||
Clicked Texture: 52333376
|
||||
Default Texture: 59813125
|
||||
Hovered Texture: 59813125
|
||||
Clicked Texture: 59813125
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 13
|
||||
|
@ -508,10 +509,32 @@
|
|||
onReleaseSound: event:/UI/button_fail
|
||||
hoverScale: 1.10000002
|
||||
clickScale: 0.899999976
|
||||
- EID: 444
|
||||
Name: SubMenuBackGround
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 2}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 1920, y: 1080, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 130823048
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 13
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.FadeInOnActive
|
||||
Enabled: true
|
||||
- EID: 19
|
||||
Name: Options Canvas
|
||||
IsActive: false
|
||||
NumberOfChildren: 11
|
||||
NumberOfChildren: 12
|
||||
Components:
|
||||
Canvas Component:
|
||||
Canvas Width: 1920
|
||||
|
@ -525,7 +548,6 @@
|
|||
sfxVolSlider: 30
|
||||
bgmVolSlider: 31
|
||||
fovSlider: 37
|
||||
sensitivitySlider: 38
|
||||
- EID: 20
|
||||
Name: BackGround
|
||||
IsActive: true
|
||||
|
@ -553,17 +575,17 @@
|
|||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -800, y: 450, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 3.14159274}
|
||||
Scale: {x: 100, y: 100, z: 1}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 273, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 55358401
|
||||
Hovered Texture: 59400474
|
||||
Clicked Texture: 52333376
|
||||
Default Texture: 59813125
|
||||
Hovered Texture: 59813125
|
||||
Clicked Texture: 59813125
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
|
@ -824,7 +846,7 @@
|
|||
- EID: 33
|
||||
Name: Camera Text Group
|
||||
IsActive: true
|
||||
NumberOfChildren: 4
|
||||
NumberOfChildren: 3
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -900, y: -220, z: 0}
|
||||
|
@ -859,76 +881,54 @@
|
|||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 35
|
||||
Name: Sensitivity Text
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -100, z: 0.100000001}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 75, y: 75, z: 1}
|
||||
IsActive: true
|
||||
Text Renderer Component:
|
||||
Text: Sensitivity
|
||||
Font: 174412429
|
||||
Color: {x: 0, y: 0, z: 0, w: 1}
|
||||
Text Size: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 449
|
||||
Name: Camera Invert X Text
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -200, z: 0.100000001}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 75, y: 75, z: 1}
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
Text Renderer Component:
|
||||
Text: "Camera Invert X:"
|
||||
Font: 174412429
|
||||
Color: {x: 0, y: 0, z: 0, w: 1}
|
||||
Text Size: {x: 1, y: 1, z: 1}
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 447
|
||||
Name: Camera Invert Y Text
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 800, y: -200, z: 0.100000001}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 75, y: 75, z: 1}
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
Text Renderer Component:
|
||||
Text: "Y:"
|
||||
Font: 174412429
|
||||
Color: {x: 0, y: 0, z: 0, w: 1}
|
||||
Text Size: {x: 1, y: 1, z: 1}
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 36
|
||||
Name: Camera Slider Group
|
||||
IsActive: true
|
||||
NumberOfChildren: 4
|
||||
NumberOfChildren: 3
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 100, y: -200, z: 0}
|
||||
|
@ -966,81 +966,64 @@
|
|||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 38
|
||||
Name: Sensitivity Slider
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -100, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 1000, y: 75, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 128676209
|
||||
IsActive: true
|
||||
Slider Component:
|
||||
Slider Value: 1
|
||||
Min Value: 0
|
||||
Max Value: 100
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 448
|
||||
Name: Invert X Toggle Button
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -300, y: -200, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 75, y: 75, z: 1}
|
||||
IsActive: false
|
||||
Scale: {x: 150, y: 150, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
Toggle Button Component:
|
||||
Non Toggled Texture: 55358401
|
||||
Toggled Texture: 52333376
|
||||
Non Toggled Texture: 50439604
|
||||
Toggled Texture: 64389107
|
||||
Value: false
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: false
|
||||
Scripts: ~
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: InverseCamera
|
||||
Enabled: true
|
||||
inverseX: true
|
||||
inverseY: false
|
||||
- EID: 445
|
||||
Name: Invert Y Toggle Button
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -50, y: -200, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 75, y: 75, z: 1}
|
||||
IsActive: false
|
||||
Scale: {x: 150, y: 150, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
Toggle Button Component:
|
||||
Non Toggled Texture: 55358401
|
||||
Toggled Texture: 52333376
|
||||
Non Toggled Texture: 50439604
|
||||
Toggled Texture: 64389107
|
||||
Value: false
|
||||
IsActive: false
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: false
|
||||
Scripts: ~
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: InverseCamera
|
||||
Enabled: true
|
||||
inverseX: false
|
||||
inverseY: true
|
||||
- EID: 39
|
||||
Name: Audio Slider Text Group
|
||||
IsActive: true
|
||||
|
@ -1135,7 +1118,7 @@
|
|||
- EID: 43
|
||||
Name: Camera Slider Text Group
|
||||
IsActive: true
|
||||
NumberOfChildren: 2
|
||||
NumberOfChildren: 1
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 700, y: -225, z: -0.5}
|
||||
|
@ -1173,21 +1156,19 @@
|
|||
- Type: SHADE_Scripting.UI.SliderText
|
||||
Enabled: true
|
||||
sliderObj: 37
|
||||
- EID: 45
|
||||
Name: Sensitivity Slider Text
|
||||
- EID: 443
|
||||
Name: SubMenuBackGround
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -100, z: 1}
|
||||
Translate: {x: 0, y: 0, z: 1}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 75, y: 75, z: 1}
|
||||
Scale: {x: 1920, y: 1080, z: 1}
|
||||
IsActive: true
|
||||
Text Renderer Component:
|
||||
Text: 100
|
||||
Font: 174412429
|
||||
Color: {x: 0, y: 0, z: 0, w: 1}
|
||||
Text Size: {x: 1, y: 1, z: 1}
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 130823048
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 19
|
||||
|
@ -1195,9 +1176,8 @@
|
|||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.SliderText
|
||||
- Type: SHADE_Scripting.UI.FadeInOnActive
|
||||
Enabled: true
|
||||
sliderObj: 38
|
||||
- EID: 46
|
||||
Name: Credits Canvas
|
||||
IsActive: false
|
||||
|
@ -1231,8 +1211,8 @@
|
|||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.ScrollingCredits
|
||||
Enabled: true
|
||||
endY: 4000
|
||||
duration: 20
|
||||
endY: 4500
|
||||
duration: 32
|
||||
- EID: 48
|
||||
Name: BackButton
|
||||
IsActive: true
|
||||
|
@ -1240,17 +1220,17 @@
|
|||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -800, y: 450, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 3.14159274}
|
||||
Scale: {x: 100, y: 100, z: 1}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 273, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 55358401
|
||||
Hovered Texture: 59400474
|
||||
Clicked Texture: 52333376
|
||||
Default Texture: 59813125
|
||||
Hovered Texture: 59813125
|
||||
Clicked Texture: 59813125
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 46
|
||||
|
@ -1314,7 +1294,7 @@
|
|||
- EID: 50
|
||||
Name: Level Select Canvas
|
||||
IsActive: false
|
||||
NumberOfChildren: 3
|
||||
NumberOfChildren: 5
|
||||
Components:
|
||||
Canvas Component:
|
||||
Canvas Width: 1920
|
||||
|
@ -1349,17 +1329,17 @@
|
|||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -800, y: 450, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 3.14159274}
|
||||
Scale: {x: 100, y: 100, z: 1}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 273, y: 100, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 55358401
|
||||
Hovered Texture: 59400474
|
||||
Clicked Texture: 52333376
|
||||
Default Texture: 59813125
|
||||
Hovered Texture: 59813125
|
||||
Clicked Texture: 59813125
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 50
|
||||
|
@ -1384,7 +1364,7 @@
|
|||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -150, y: 400, z: 0.100000001}
|
||||
Translate: {x: -250, y: 400, z: 0.100000001}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 100, y: 100, z: 1}
|
||||
IsActive: true
|
||||
|
@ -1400,6 +1380,128 @@
|
|||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 442
|
||||
Name: SubMenuBackGround
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 0.5}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 1920, y: 1080, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 130823048
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 50
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.UI.FadeInOnActive
|
||||
Enabled: true
|
||||
- EID: 441
|
||||
Name: Level Select Buttons
|
||||
IsActive: true
|
||||
NumberOfChildren: 3
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: -75, z: 0.100000001}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 50
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 440
|
||||
Name: Level 1 Button
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -600, y: 0, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 345, y: 800, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 55897117
|
||||
Hovered Texture: 56658801
|
||||
Clicked Texture: 58281309
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 50
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: ChangeSceneButton
|
||||
Enabled: true
|
||||
sceneID: 91947920
|
||||
- EID: 439
|
||||
Name: Level 2 Button
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 345, y: 800, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 52151774
|
||||
Hovered Texture: 66730012
|
||||
Clicked Texture: 59730316
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 50
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: ChangeSceneButton
|
||||
Enabled: true
|
||||
sceneID: 86098106
|
||||
- EID: 438
|
||||
Name: Level 3 Button
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 600, y: 0, z: 0}
|
||||
Rotate: {x: 0, y: 0, z: 0}
|
||||
Scale: {x: 345, y: 800, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 141771688
|
||||
Material: 129340704
|
||||
IsActive: true
|
||||
Button Component:
|
||||
Default Texture: 51704639
|
||||
Hovered Texture: 66852283
|
||||
Clicked Texture: 53081657
|
||||
IsActive: true
|
||||
UI Component:
|
||||
Canvas ID: 50
|
||||
Hovered: false
|
||||
Clicked: false
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: ChangeSceneButton
|
||||
Enabled: true
|
||||
sceneID: 88928066
|
||||
- EID: 450
|
||||
Name: TransitionCanvas
|
||||
IsActive: true
|
||||
|
|
|
@ -0,0 +1,320 @@
|
|||
- EID: 0
|
||||
Name: Camera
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 10.2736483, z: 0}
|
||||
Rotate: {x: -1.48352981, y: 1.5, z: 0.5}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 1
|
||||
Name: Floor
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 0}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 12.8000002, y: 1, z: 12.8000002}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142686872
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 2
|
||||
Name: Light
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Light Component:
|
||||
Position: {x: 0, y: 0, z: 0}
|
||||
Type: Directional
|
||||
Direction: {x: 0, y: -1, z: 1}
|
||||
Color: {x: 1, y: 1, z: 1, w: 1}
|
||||
Layer: 4294967295
|
||||
Strength: 0
|
||||
Casting Shadows: false
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 3
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 11, y: 0, z: 0}
|
||||
Rotate: {x: -0, y: 1.57079637, z: -0}
|
||||
Scale: {x: 10.6225176, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 4
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: -11.2958097}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 10.6225176, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 5
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 0, z: 11}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 10.6225176, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 6
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 6.06437206, y: 0, z: -5.60716629}
|
||||
Rotate: {x: -0, y: 1.57079601, z: -0}
|
||||
Scale: {x: 4.99989605, y: 1, z: 0.999986947}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 7
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -11, y: 0, z: 0}
|
||||
Rotate: {x: -0, y: 1.57079637, z: -0}
|
||||
Scale: {x: 10.6225176, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 8
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -4.70212746, y: 0, z: -0.00226712227}
|
||||
Rotate: {x: -0, y: 1.57079601, z: -0}
|
||||
Scale: {x: 4.99982977, y: 1, z: 0.999978602}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 9
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 1.46194017, y: 0, z: 0.71579361}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 4.99985838, y: 1, z: 0.999982238}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 10
|
||||
Name: Wall
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -2.30867815, y: 0, z: -6.02849674}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 4, y: 1, z: 0.999974966}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 142652392
|
||||
Material: 126223465
|
||||
IsActive: true
|
||||
Collider Component:
|
||||
Colliders:
|
||||
- Is Trigger: false
|
||||
Collision Tag: 0
|
||||
Type: Box
|
||||
Half Extents: {x: 2.5, y: 1, z: 1.60000002}
|
||||
Friction: 0.400000006
|
||||
Bounciness: 0
|
||||
Density: 1
|
||||
Position Offset: {x: 0, y: 0, z: 0}
|
||||
Rotation Offset: {x: 0, y: 0, z: 0}
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 11
|
||||
Name: TestAI
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 8.5, y: -1, z: -6.41661787}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 5, y: 5, z: 5}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 140639624
|
||||
Material: 131956078
|
||||
IsActive: true
|
||||
Navigation Component:
|
||||
Target: {x: 0, y: 0, z: 0}
|
||||
Forward: {x: 0, y: 0, z: 0}
|
||||
Recalculate Path: true
|
||||
Unreachable Target: false
|
||||
Acceptance threshold: 1
|
||||
IsActive: true
|
||||
Scripts:
|
||||
- Type: SHADE_Scripting.Gameplay.AIBehaviour.AIRework.NavigationTestScript
|
||||
Enabled: true
|
||||
endPoint: 12
|
||||
speed: 3
|
||||
- EID: 12
|
||||
Name: EndPoint
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: -0.853474855, y: -1, z: 0.354041398}
|
||||
Rotate: {x: -0, y: 0, z: -0}
|
||||
Scale: {x: 5, y: 5, z: 5}
|
||||
IsActive: true
|
||||
Renderable Component:
|
||||
Mesh: 140639624
|
||||
Material: 131956078
|
||||
IsActive: true
|
||||
Scripts: ~
|
||||
- EID: 13
|
||||
Name: Camera
|
||||
IsActive: true
|
||||
NumberOfChildren: 0
|
||||
Components:
|
||||
Transform Component:
|
||||
Translate: {x: 0, y: 10.2736483, z: 0}
|
||||
Rotate: {x: -1.48352981, y: 0, z: 0}
|
||||
Scale: {x: 1, y: 1, z: 1}
|
||||
IsActive: true
|
||||
Camera Component:
|
||||
Position: {x: 0, y: 0, z: 0}
|
||||
Pitch: -85
|
||||
Yaw: 0
|
||||
Roll: 0
|
||||
Width: 1920
|
||||
Near: 0.00999999978
|
||||
Far: 10000
|
||||
Perspective: true
|
||||
FOV: 90
|
||||
IsActive: true
|
||||
Scripts: ~
|
|
@ -0,0 +1,3 @@
|
|||
Name: NavigationTest
|
||||
ID: 100246336
|
||||
Type: 5
|
|
@ -0,0 +1,107 @@
|
|||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
||||
{
|
||||
public class AILineOfSight:Script
|
||||
{
|
||||
public GameObject player;
|
||||
|
||||
public float range = 2.0f;
|
||||
[Tooltip("Angle between player and forward to be within sight")]
|
||||
public float angle = 30.0f;
|
||||
|
||||
[Tooltip("For debug")]
|
||||
public float angleBetween = 0.0f;
|
||||
|
||||
[Tooltip("For debug")]
|
||||
public float distance = 0.0f;
|
||||
|
||||
public float heightLimit = 1.0f;
|
||||
|
||||
public Vector3 rayOffset;
|
||||
|
||||
|
||||
public bool withinRange;
|
||||
public bool withinSight;
|
||||
|
||||
|
||||
public Vector3 lastFoundPos;
|
||||
public float lastFoundTimer = 0.0f;
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if (player == GameObject.Null)
|
||||
return;
|
||||
|
||||
Transform transform = GetComponent<Transform>();
|
||||
Transform playerTransform = player.GetComponent<Transform>();
|
||||
Collider playerCollider = player.GetComponent<Collider>();
|
||||
|
||||
withinRange = false;
|
||||
withinSight = false;
|
||||
|
||||
|
||||
if(transform && playerTransform && playerCollider)
|
||||
{
|
||||
Vector3 pos = transform.GlobalPosition + rayOffset;
|
||||
Vector3 playerPos = playerTransform.GlobalPosition ;
|
||||
Vector3 d = playerPos - pos;
|
||||
distance = d.GetMagnitude();
|
||||
if(distance < range)
|
||||
{
|
||||
Vector3 fwdHorizontal = transform.Forward;
|
||||
fwdHorizontal.y = 0;
|
||||
fwdHorizontal.Normalise();
|
||||
|
||||
Vector3 dHorizontal = d;
|
||||
dHorizontal.y = 0;
|
||||
|
||||
|
||||
float dot = Vector3.Dot(fwdHorizontal, dHorizontal);
|
||||
angleBetween = SHADE.Math.Rad2Deg * MathF.Acos(dot / (dHorizontal.GetMagnitude()));
|
||||
if (angleBetween < angle && playerPos.y < pos.y + heightLimit)
|
||||
{
|
||||
withinRange = true;
|
||||
withinSight = true;
|
||||
Ray sightRay = new Ray(pos, d.GetNormalised());
|
||||
List<RaycastHit> hitResults = Physics.Raycast(sightRay, distance,false, (ushort)65535);
|
||||
|
||||
foreach(RaycastHit hit in hitResults)
|
||||
{
|
||||
if (hit.Hit && hit.Other != player)
|
||||
{
|
||||
//Debug.Log("AI LOS: HIT OTHER");
|
||||
withinSight = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (withinSight == true)
|
||||
{
|
||||
lastFoundPos = playerTransform.GlobalPosition;
|
||||
lastFoundTimer = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastFoundTimer += Time.DeltaTimeF;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: AILineOfSight
|
||||
ID: 152074687
|
||||
Type: 9
|
|
@ -0,0 +1,3 @@
|
|||
Name: BaseState
|
||||
ID: 167091082
|
||||
Type: 9
|
|
@ -0,0 +1,156 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
||||
{
|
||||
public class HomeOwnerAI : Script
|
||||
{
|
||||
public float idleDuration = 1.0f;
|
||||
public float timeoutDuration = 2.0f;
|
||||
public GameObject patrolPointParent;
|
||||
|
||||
public float patrolSpeed = 2.0f;
|
||||
public float chaseSpeed = 3.0f;
|
||||
|
||||
public float alertCooldown = 0.0f;
|
||||
|
||||
public GameObject player;
|
||||
public GameObject attackHitbox;
|
||||
|
||||
public AnimationClipAsset walkingAnim;
|
||||
public AnimationClipAsset idleAnim;
|
||||
public AnimationClipAsset alertAnim;
|
||||
public AnimationClipAsset alertRunAnim;
|
||||
public AnimationClipAsset alertIdleAnim;
|
||||
public AnimationClipAsset timeoutAnim;
|
||||
public AnimationClipAsset atkWindupAnim;
|
||||
public AnimationClipAsset atkHoldAnim;
|
||||
public AnimationClipAsset atkSeqAnim;
|
||||
|
||||
private Vector3 startPos;
|
||||
public bool atk { get; set; }
|
||||
|
||||
[NonSerialized]
|
||||
public IEnumerable<Transform> patrolPointPool;
|
||||
|
||||
private List<Transform> pppList;
|
||||
|
||||
private Transform transform;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
StateMachine machine = GetScript<StateMachine>();
|
||||
if (transform && machine)
|
||||
{
|
||||
transform.GlobalPosition = startPos;
|
||||
machine.SetState(typeof(IdleState));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
StateMachine machine = GetScript<StateMachine>();
|
||||
if (machine)
|
||||
{
|
||||
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
|
||||
dictionary.Add(typeof(IdleState), new IdleState(machine));
|
||||
dictionary.Add(typeof(PatrolState), new PatrolState(machine));
|
||||
dictionary.Add(typeof(TimeoutState), new TimeoutState(machine));
|
||||
dictionary.Add(typeof(ChaseState), new ChaseState(machine));
|
||||
dictionary.Add(typeof(AlertState), new AlertState(machine));
|
||||
dictionary.Add(typeof(AttackState), new AttackState(machine));
|
||||
|
||||
machine.InitStateMachine(dictionary);
|
||||
}
|
||||
|
||||
AudioHandler.audioClipHandlers["HO_footsteps"] = SHADE.Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
|
||||
|
||||
patrolPointPool = patrolPointParent.GetComponentsInChildren<Transform>();
|
||||
pppList = patrolPointPool.ToList<Transform>();
|
||||
transform = GetComponent<Transform>();
|
||||
|
||||
atk = false;
|
||||
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
//attackHitbox.SetActive(false);
|
||||
if (pppList != null)
|
||||
startPos = pppList[0].LocalPosition;
|
||||
}
|
||||
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if (alertCooldown > 0.0f)
|
||||
{
|
||||
alertCooldown -= Time.DeltaTimeF;
|
||||
}
|
||||
else
|
||||
{
|
||||
alertCooldown = 0.0f;
|
||||
}
|
||||
AICheat();
|
||||
}
|
||||
|
||||
public bool ShouldTransitAlert()
|
||||
{
|
||||
AILineOfSight los = GetScript<AILineOfSight>();
|
||||
if (los)
|
||||
{
|
||||
if (los.withinSight && alertCooldown <= 0.0f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RotateToPlayer()
|
||||
{
|
||||
|
||||
//Transform playerTransform = player.GetComponent<Transform>();
|
||||
|
||||
////Rotate to face player.
|
||||
//Transform aiTransform = GetComponent<Transform>();
|
||||
//if(playerTransform && aiTransform)
|
||||
//{
|
||||
// Vector3 direction = playerTransform.GlobalPosition - aiTransform.GlobalPosition;
|
||||
// Quaternion currentRotation = aiTransform.LocalRotation;
|
||||
// Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f);
|
||||
// aiTransform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, 5.0f * (float)Time.FixedDeltaTime);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
private void AICheat()
|
||||
{
|
||||
StateMachine machine = GetScript<StateMachine>();
|
||||
AILineOfSight los = GetScript<AILineOfSight>();
|
||||
if (machine && los)
|
||||
{
|
||||
if (Input.GetKeyDown(Input.KeyCode.K))
|
||||
{
|
||||
los.range = 5.0f;
|
||||
machine.SetState(typeof(AlertState));
|
||||
}
|
||||
if (Input.GetKeyDown(Input.KeyCode.L))
|
||||
{
|
||||
los.range = 0.0f;
|
||||
machine.SetState(typeof(IdleState));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: HomeOwnerAI
|
||||
ID: 162553450
|
||||
Type: 9
|
|
@ -0,0 +1,64 @@
|
|||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static PlayerController;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
||||
{
|
||||
public class HomeOwnerAttackHitbox : Script
|
||||
{
|
||||
public GameObject aiGO;
|
||||
|
||||
private bool raccoonFound = false;
|
||||
Transform transform;
|
||||
Transform aiTransform;
|
||||
|
||||
private PlayerController pc;
|
||||
private HomeOwnerAI ai;
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
transform = GetComponent<Transform>();
|
||||
aiTransform = aiGO.GetComponent<Transform>();
|
||||
ai = aiGO.GetScript<HomeOwnerAI>();
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if (transform && aiTransform)
|
||||
{
|
||||
|
||||
transform.GlobalPosition = aiTransform.GlobalPosition + aiTransform.Forward * 0.7f;
|
||||
transform.GlobalEulerAngles = aiTransform.GlobalEulerAngles;
|
||||
|
||||
}
|
||||
|
||||
if (raccoonFound && pc && ai)
|
||||
{
|
||||
pc.currentState = RaccoonStates.CAUGHT;
|
||||
if (pc.stateMachine && !pc.stateMachine.IsState(typeof(PlayerCaughtState)))
|
||||
pc.stateMachine.SetState(typeof(PlayerCaughtState));
|
||||
|
||||
pc.GotCaught();
|
||||
ai.Reset();
|
||||
raccoonFound = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void onTriggerStay(CollisionInfo info)
|
||||
{
|
||||
pc = info.GameObject.GetScript<PlayerController>();
|
||||
if (ai && ai.atk && pc)
|
||||
{
|
||||
raccoonFound = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: HomeOwnerAttackHitbox
|
||||
ID: 164649501
|
||||
Type: 9
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SHADE;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
||||
{
|
||||
|
||||
|
||||
|
||||
public class NavigationTestScript :Script
|
||||
{
|
||||
public GameObject endPoint;
|
||||
|
||||
public float speed = 1.0f;
|
||||
float timer = 0.0f;
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
|
||||
Navigation nav = GetComponent<Navigation>();
|
||||
Transform endTransform = endPoint.GetComponent<Transform>();
|
||||
if (endTransform)
|
||||
nav.MoveTo(endTransform.GlobalPosition);
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
timer += Time.DeltaTimeF;
|
||||
Navigation nav = GetComponent<Navigation>();
|
||||
Transform transform = GetComponent<Transform>();
|
||||
if (timer >= 1.0f)
|
||||
{
|
||||
timer = 0.0f;
|
||||
|
||||
Transform endTransform = endPoint.GetComponent<Transform>();
|
||||
if (endTransform)
|
||||
nav.MoveTo(endTransform.GlobalPosition);
|
||||
}
|
||||
|
||||
|
||||
if (nav && transform)
|
||||
{
|
||||
transform.LocalPosition = transform.LocalPosition + ( nav.GetForward() * Time.DeltaTimeF * speed);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: NavigationTestScript
|
||||
ID: 162476480
|
||||
Type: 9
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SHADE;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework
|
||||
{
|
||||
public class RotateToVelocity : Script
|
||||
{
|
||||
public float rotationPerSecond = 2.0f;
|
||||
|
||||
public bool active = true;
|
||||
public bool rotateToPlayerLastKnown = false;
|
||||
|
||||
public bool lookAround = false;
|
||||
private bool left = true;
|
||||
private float lookOffset = 0.0f;
|
||||
private float lookAroundAngle = 30.0f;
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
rotateToPlayerLastKnown = false;
|
||||
active = true;
|
||||
}
|
||||
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if (!active)
|
||||
return;
|
||||
|
||||
RigidBody rigid = GetComponent<RigidBody>();
|
||||
Transform transform = GetComponent<Transform>();
|
||||
if(!lookAround)
|
||||
{
|
||||
lookOffset = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(left )
|
||||
{
|
||||
if (lookOffset > -lookAroundAngle)
|
||||
lookOffset -= rotationPerSecond * Time.DeltaTimeF;
|
||||
else
|
||||
left = false;
|
||||
}
|
||||
if (!left)
|
||||
{
|
||||
if (lookOffset < lookAroundAngle)
|
||||
lookOffset += rotationPerSecond * Time.DeltaTimeF;
|
||||
else
|
||||
left = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(rigid && transform)
|
||||
{
|
||||
Vector3 vel = rigid.LinearVelocity;
|
||||
rigid.AngularVelocity = Vector3.Zero;
|
||||
|
||||
|
||||
AILineOfSight los = GetScript<AILineOfSight>();
|
||||
if(los && rotateToPlayerLastKnown)
|
||||
{
|
||||
Vector3 direction = los.lastFoundPos - transform.GlobalPosition;
|
||||
Quaternion currentRotation = transform.LocalRotation;
|
||||
Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z) + lookOffset, 0.0f);
|
||||
transform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationPerSecond * (float)Time.DeltaTimeF);
|
||||
return;
|
||||
}
|
||||
if(vel.GetMagnitude() > 0.01f)
|
||||
{
|
||||
Quaternion currentRotation = transform.LocalRotation;
|
||||
Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(vel.x, vel.z) + lookOffset, 0.0f);
|
||||
transform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationPerSecond * (float)Time.DeltaTimeF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: RotateToVelocity
|
||||
ID: 163814533
|
||||
Type: 9
|
|
@ -0,0 +1,3 @@
|
|||
Name: StateMachine
|
||||
ID: 165140157
|
||||
Type: 9
|
|
@ -0,0 +1,24 @@
|
|||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||
{
|
||||
public abstract class AIBaseState: BaseState
|
||||
{
|
||||
|
||||
protected HomeOwnerAI ai;
|
||||
protected Animator animator;
|
||||
public AIBaseState(StateMachine stateMachine): base(stateMachine, "")
|
||||
{
|
||||
stateName = "AI Base State";
|
||||
ai = stateMachine.GetScript<HomeOwnerAI>();
|
||||
animator = stateMachine.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: AIBaseState
|
||||
ID: 160233845
|
||||
Type: 9
|
|
@ -0,0 +1,58 @@
|
|||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SHADE_Scripting.Audio;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||
{
|
||||
public class AlertState : AIBaseState
|
||||
{
|
||||
const float alertDuration = 16.0f / 30.0f + 1.0f;
|
||||
float alertTimer = alertDuration;
|
||||
|
||||
public AlertState(StateMachine machine) : base(machine)
|
||||
{
|
||||
stateName = "Alert";
|
||||
AudioHandler.audioClipHandlers["raccoondetected"] = SHADE.Audio.CreateAudioClip("event:/Raccoon/raccoon_detected");
|
||||
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
alertTimer = alertDuration;
|
||||
if (animator)
|
||||
{
|
||||
animator.PlayOneShot(ai.alertAnim);
|
||||
|
||||
}
|
||||
SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Detected");
|
||||
AudioHandler.audioClipHandlers["raccoondetected"].Play();
|
||||
}
|
||||
public override void OnExit()
|
||||
{
|
||||
animator.Stop();
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
alertTimer -= Time.DeltaTimeF;
|
||||
if (alertTimer <= 0.0f)
|
||||
{
|
||||
machine.SetState(typeof(ChaseState));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public override void fixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: AlertState
|
||||
ID: 159828775
|
||||
Type: 9
|
|
@ -0,0 +1,155 @@
|
|||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||
{
|
||||
public class AttackState : AIBaseState
|
||||
{
|
||||
|
||||
float timer = 0.0f;
|
||||
|
||||
float windupTime = 8.0f / 30.0f;
|
||||
float holdTime = 0.3f;
|
||||
float seqTime = 8.0f / 30.0f;
|
||||
float endTime = 0.5f;
|
||||
|
||||
|
||||
bool windUp = false;
|
||||
bool hold = false;
|
||||
bool seq = false;
|
||||
bool end = false;
|
||||
|
||||
|
||||
public AttackState(StateMachine machine) : base(machine)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
timer = 0.0f;
|
||||
animator.PlayOneShot(ai.atkWindupAnim);
|
||||
windUp = true;
|
||||
hold = false;
|
||||
seq = false;
|
||||
end = false;
|
||||
timer = windupTime;
|
||||
|
||||
RotateToVelocity rotate = machine.GetScript<RotateToVelocity>();
|
||||
if (rotate)
|
||||
rotate.active = false;
|
||||
|
||||
RigidBody rigid = machine.GetComponent<RigidBody>();
|
||||
if (rigid)
|
||||
{
|
||||
rigid.LinearVelocity = Vector3.Zero;
|
||||
}
|
||||
Transform transform = machine.GetComponent<Transform>();
|
||||
AILineOfSight los = machine.GetScript<AILineOfSight>();
|
||||
Transform playerTransform = ai.player.GetComponent<Transform>();
|
||||
|
||||
|
||||
if (los && transform)
|
||||
{
|
||||
Vector3 direction = playerTransform.GlobalPosition - transform.GlobalPosition;
|
||||
Quaternion targetRotation = Quaternion.Euler(0.0f, MathF.Atan2(direction.x, direction.z), 0.0f);
|
||||
transform.LocalRotation = targetRotation;
|
||||
|
||||
}
|
||||
|
||||
//ai.attackHitbox.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
public override void OnExit()
|
||||
{
|
||||
animator.Stop();
|
||||
RotateToVelocity rotate = ai.GetScript<RotateToVelocity>();
|
||||
if (rotate)
|
||||
{
|
||||
rotate.active = true;
|
||||
rotate.lookAround = false;
|
||||
}
|
||||
|
||||
|
||||
//ai.attackHitbox.SetActive(false);
|
||||
machine.GetScript<HomeOwnerAI>().atk = false;
|
||||
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
timer -= Time.DeltaTimeF;
|
||||
if (windUp)
|
||||
{
|
||||
if (timer <= 0.0f)
|
||||
{
|
||||
windUp = false;
|
||||
hold = true;
|
||||
animator.Play(ai.atkHoldAnim);
|
||||
timer = holdTime;
|
||||
//ai.attackHitbox.SetActive(true);
|
||||
//machine.GetScript<HomeOwnerAI>().atk = true;
|
||||
}
|
||||
}
|
||||
else if (hold)
|
||||
{
|
||||
if (timer <= 0.0f)
|
||||
{
|
||||
hold = false;
|
||||
seq = true;
|
||||
animator.PlayOneShot(ai.atkSeqAnim);
|
||||
timer = seqTime;
|
||||
}
|
||||
}
|
||||
else if (seq)
|
||||
{
|
||||
|
||||
if (timer <= 1.0f / 30.0f)
|
||||
{
|
||||
//ai.attackHitbox.SetActive(true);
|
||||
machine.GetScript<HomeOwnerAI>().atk = true;
|
||||
}
|
||||
|
||||
if (timer <= 0.0f)
|
||||
{
|
||||
seq = false;
|
||||
end = true;
|
||||
|
||||
timer = endTime;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else if (end)
|
||||
{
|
||||
if (timer <= 0.0f)
|
||||
{
|
||||
end = false;
|
||||
AILineOfSight los = ai.GetScript<AILineOfSight>();
|
||||
if (los && los.withinSight)
|
||||
{
|
||||
machine.SetState(typeof(ChaseState));
|
||||
}
|
||||
else
|
||||
{
|
||||
machine.SetState(typeof(TimeoutState));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void fixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: AttackState
|
||||
ID: 156854236
|
||||
Type: 9
|
|
@ -0,0 +1,150 @@
|
|||
using SHADE;
|
||||
using SHADE.Test;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||
{
|
||||
public class ChaseState :AIBaseState
|
||||
{
|
||||
|
||||
float giveUpDuration = 10.0f;
|
||||
float giveUpTimer = 0.0f;
|
||||
float atkDistance = 2.0f;
|
||||
|
||||
|
||||
bool run = true;
|
||||
|
||||
float footStepInterval = 12.0f / 30.0f;
|
||||
float footStepTimer = 0.0f;
|
||||
|
||||
|
||||
public ChaseState(StateMachine machine): base(machine)
|
||||
{
|
||||
stateName = "Chase";
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
giveUpTimer = giveUpDuration;
|
||||
|
||||
animator.Play(ai.alertRunAnim);
|
||||
run = true;
|
||||
RotateToVelocity r = machine.GetScript<RotateToVelocity>();
|
||||
if (r)
|
||||
{
|
||||
r.rotateToPlayerLastKnown = true;
|
||||
}
|
||||
|
||||
|
||||
footStepTimer = footStepInterval * 0.5f;
|
||||
}
|
||||
|
||||
public override void OnExit()
|
||||
{
|
||||
animator.Stop();
|
||||
RotateToVelocity r = machine.GetScript<RotateToVelocity>();
|
||||
if (r)
|
||||
{
|
||||
r.rotateToPlayerLastKnown = false;
|
||||
}
|
||||
RotateToVelocity rotate = ai.GetScript<RotateToVelocity>();
|
||||
if (rotate)
|
||||
{
|
||||
rotate.lookAround = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
Navigation nav = machine.GetComponent<Navigation>();
|
||||
AILineOfSight los = ai.GetScript<AILineOfSight>();
|
||||
RigidBody rigid = machine.GetComponent<RigidBody>();
|
||||
if (los && nav)
|
||||
{
|
||||
Transform playerTransform = los.player.GetComponent<Transform>();
|
||||
if (los.withinSight)
|
||||
{
|
||||
nav.MoveTo(playerTransform.GlobalPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.MoveTo(los.lastFoundPos);
|
||||
giveUpTimer -= Time.DeltaTimeF;
|
||||
}
|
||||
if(los.lastFoundTimer>= 10.0f || giveUpTimer <= 0.0f)
|
||||
{
|
||||
machine.SetState(typeof(TimeoutState));
|
||||
}
|
||||
|
||||
if(los.distance < atkDistance)
|
||||
{
|
||||
machine.SetState(typeof(AttackState));
|
||||
}
|
||||
|
||||
|
||||
if(rigid)
|
||||
{
|
||||
if (los.withinSight)
|
||||
rigid.LinearVelocity = nav.GetForward() * ai.chaseSpeed;
|
||||
else
|
||||
rigid.LinearVelocity = nav.GetForward() * ai.chaseSpeed;
|
||||
}
|
||||
|
||||
if(nav.ReachedTarget())
|
||||
{
|
||||
giveUpTimer -= Time.DeltaTimeF;
|
||||
|
||||
ai.RotateToPlayer();
|
||||
RotateToVelocity rotate = ai.GetScript<RotateToVelocity>();
|
||||
if(rotate)
|
||||
{
|
||||
rotate.lookAround = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (animator && rigid)
|
||||
{
|
||||
if (rigid.LinearVelocity.GetMagnitude() < 0.001f)
|
||||
{
|
||||
if(run)
|
||||
{
|
||||
animator.Play(ai.idleAnim);
|
||||
run = false;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!run)
|
||||
{
|
||||
animator.Play(ai.alertRunAnim);
|
||||
run = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
footStepTimer -= Time.DeltaTimeF;
|
||||
if (footStepTimer <= 0.0f)
|
||||
{
|
||||
footStepTimer += footStepInterval;
|
||||
AudioHandler.audioClipHandlers["HO_footsteps"].Play();
|
||||
}
|
||||
}
|
||||
|
||||
public override void fixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: ChaseState
|
||||
ID: 166357249
|
||||
Type: 9
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SHADE;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||
{
|
||||
public class IdleState: AIBaseState
|
||||
{
|
||||
|
||||
float timer = 0.0f;
|
||||
|
||||
|
||||
|
||||
public IdleState(StateMachine machine): base(machine)
|
||||
{
|
||||
stateName = "Idle";
|
||||
}
|
||||
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
timer = 0.0f;
|
||||
animator.Play(ai.idleAnim);
|
||||
SHADE.Audio.SetParameterWithLabel("PlayerDetection", "Undetected");
|
||||
RotateToVelocity rotate = ai.GetScript<RotateToVelocity>();
|
||||
if (rotate)
|
||||
{
|
||||
rotate.lookAround = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnExit()
|
||||
{
|
||||
animator.Stop();
|
||||
RotateToVelocity rotate = ai.GetScript<RotateToVelocity>();
|
||||
if (rotate)
|
||||
{
|
||||
rotate.lookAround = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
timer += Time.DeltaTimeF;
|
||||
if(timer >= ai.idleDuration)
|
||||
{
|
||||
machine.SetState(typeof(PatrolState));
|
||||
}
|
||||
if(ai.ShouldTransitAlert())
|
||||
{
|
||||
machine.SetState(typeof(AlertState));
|
||||
}
|
||||
}
|
||||
|
||||
public override void fixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: IdleState
|
||||
ID: 164902316
|
||||
Type: 9
|
|
@ -0,0 +1,115 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||
{
|
||||
public class PatrolState: AIBaseState
|
||||
{
|
||||
|
||||
Random rand;
|
||||
Vector3 lastFramePos;
|
||||
|
||||
float stuckTimer;
|
||||
bool run = true;
|
||||
|
||||
float footStepInterval = 12.0f / 30.0f;
|
||||
float footStepTimer = 0.0f;
|
||||
|
||||
public PatrolState(StateMachine machine) : base(machine)
|
||||
{
|
||||
stateName = "Patrol";
|
||||
rand = new Random();
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
Navigation nav = machine.GetComponent<Navigation>();
|
||||
Transform transform = machine.GetComponent<Transform>();
|
||||
if (nav && transform)
|
||||
{
|
||||
|
||||
int index = rand.Next(0, ai.patrolPointPool.Count() - 1);
|
||||
Transform dest = ai.patrolPointPool.ElementAt(index);
|
||||
if (dest)
|
||||
{
|
||||
nav.MoveTo(dest.GlobalPosition);
|
||||
|
||||
}
|
||||
|
||||
lastFramePos = transform.GlobalPosition;
|
||||
|
||||
stuckTimer = 0.0f;
|
||||
|
||||
}
|
||||
|
||||
|
||||
animator.Play(ai.walkingAnim);
|
||||
AudioHandler.audioClipHandlers["HO_footsteps"].Play();
|
||||
footStepTimer = footStepInterval;
|
||||
|
||||
|
||||
RotateToVelocity r = machine.GetScript<RotateToVelocity>();
|
||||
if(r)
|
||||
{
|
||||
r.rotateToPlayerLastKnown = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void OnExit()
|
||||
{
|
||||
animator.Stop();
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
Navigation nav = machine.GetComponent<Navigation>();
|
||||
Transform transform = machine.GetComponent<Transform>();
|
||||
RigidBody rigid = machine.GetComponent<RigidBody>();
|
||||
if(nav && transform && rigid)
|
||||
{
|
||||
rigid.LinearVelocity = nav.GetForward() * ai.patrolSpeed;
|
||||
Vector3 d = lastFramePos - transform.GlobalPosition;
|
||||
if (d.GetSqrMagnitude() < 0.001f)
|
||||
{
|
||||
//stuckTimer += Time.DeltaTimeF;
|
||||
}
|
||||
|
||||
|
||||
if (nav.ReachedTarget())
|
||||
{
|
||||
machine.SetState(typeof(IdleState));
|
||||
}
|
||||
lastFramePos = transform.GlobalPosition;
|
||||
|
||||
}
|
||||
if(stuckTimer >= 0.5f)
|
||||
{
|
||||
machine.SetState(typeof(IdleState));
|
||||
}
|
||||
|
||||
if (ai.ShouldTransitAlert())
|
||||
{
|
||||
machine.SetState(typeof(AlertState));
|
||||
}
|
||||
footStepTimer -= Time.DeltaTimeF;
|
||||
if(footStepTimer <= 0.0f)
|
||||
{
|
||||
footStepTimer += footStepInterval;
|
||||
AudioHandler.audioClipHandlers["HO_footsteps"].Play();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void fixedUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: PatrolState
|
||||
ID: 155844701
|
||||
Type: 9
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SHADE;
|
||||
|
||||
namespace SHADE_Scripting.Gameplay.AIBehaviour.AIRework.States
|
||||
{
|
||||
public class TimeoutState : AIBaseState
|
||||
{
|
||||
float timer = 0.0f;
|
||||
float alertCooldown = 1.0f;
|
||||
|
||||
public TimeoutState(StateMachine machine) : base(machine)
|
||||
{
|
||||
stateName = "Timeout";
|
||||
}
|
||||
|
||||
|
||||
public override void OnEnter()
|
||||
{
|
||||
timer = 0.0f;
|
||||
animator.Play(ai.idleAnim);
|
||||
|
||||
}
|
||||
|
||||
public override void update()
|
||||
{
|
||||
timer += Time.DeltaTimeF;
|
||||
if (timer >= ai.timeoutDuration)
|
||||
{
|
||||
machine.SetState(typeof(PatrolState));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void fixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void OnExit()
|
||||
{
|
||||
ai.alertCooldown = alertCooldown;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: TimeoutState
|
||||
ID: 167077719
|
||||
Type: 9
|
|
@ -14,9 +14,6 @@ public class Breakable : Script
|
|||
public bool isBreak { get; set; }
|
||||
private List<GameObject> itemPieces = new List<GameObject>();
|
||||
|
||||
[SerializeField]
|
||||
private string breakClipHandlerName;
|
||||
|
||||
[SerializeField]
|
||||
private string breakClipPath;
|
||||
|
||||
|
@ -38,7 +35,8 @@ public class Breakable : Script
|
|||
|
||||
isBreak = false;
|
||||
|
||||
AudioHandler.audioClipHandlers[breakClipHandlerName] = Audio.CreateAudioClip(breakClipPath);
|
||||
AudioHandler.audioClipHandlers["break"] = Audio.CreateAudioClip(breakClipPath);
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["break"], GameObject.EntityId);
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
|
@ -81,9 +79,7 @@ public class Breakable : Script
|
|||
|
||||
GameManager.Instance.itemShatter = false;
|
||||
isBreak = false;
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers[breakClipHandlerName], GameObject.EntityId);
|
||||
AudioHandler.audioClipHandlers[breakClipHandlerName].Play();
|
||||
//Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers[breakClipHandlerName]);
|
||||
AudioHandler.audioClipHandlers["break"].Play();
|
||||
GameObject.SetActive(false);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using SHADE_Scripting.Gameplay.AIBehaviour.AIRework;
|
||||
using System;
|
||||
public class Item : Script
|
||||
{
|
||||
|
@ -10,21 +11,29 @@ public class Item : Script
|
|||
HEAVY
|
||||
}
|
||||
|
||||
public enum Food
|
||||
{
|
||||
EGG,
|
||||
APPLE,
|
||||
MEAT,
|
||||
WATERMELON,
|
||||
CHEESE
|
||||
}
|
||||
|
||||
public int Score = 10;
|
||||
|
||||
public ItemCategory currCategory;
|
||||
public Food currFood;
|
||||
public bool returnBack { get; set; }
|
||||
private Transform transform;
|
||||
private RigidBody rb;
|
||||
private bool playSound = false;
|
||||
private bool caputurePos = false;
|
||||
private Vector3 firstPostion;
|
||||
private Collider collider;
|
||||
public float density = 1.0f;
|
||||
private Vector3 firstRotation;
|
||||
public bool dontReturn = false;
|
||||
private bool once = true;
|
||||
|
||||
|
||||
private bool checkSound = false;
|
||||
private bool homeownerOnce = true;
|
||||
public float soundDistance = 10;
|
||||
|
||||
private float highlightPos = 0.0f;
|
||||
|
@ -40,9 +49,6 @@ public class Item : Script
|
|||
{
|
||||
transform = GetComponent<Transform>();
|
||||
rb = GetComponent<RigidBody>();
|
||||
collider = GetComponent<Collider>();
|
||||
if(collider)
|
||||
collider.GetCollisionShape(0).Density = density;
|
||||
|
||||
rend = GetComponent<Renderable>();
|
||||
if (!rend)
|
||||
|
@ -53,6 +59,11 @@ public class Item : Script
|
|||
AudioHandler.audioClipHandlers["SFXImpactElastic"] = Audio.CreateAudioClip("event:/Props/impact_elastic");
|
||||
AudioHandler.audioClipHandlers["SFXImpactHard"] = Audio.CreateAudioClip("event:/Props/impact_hard");
|
||||
|
||||
if (currCategory == ItemCategory.LIGHT)
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactElastic"], GameObject.EntityId);
|
||||
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactHard"], GameObject.EntityId);
|
||||
|
||||
emitter = GetComponent<ParticleEmitter>();
|
||||
}
|
||||
|
||||
|
@ -98,25 +109,15 @@ public class Item : Script
|
|||
rb.ClearTorque();
|
||||
}
|
||||
|
||||
if(transform)
|
||||
if (transform)
|
||||
{
|
||||
transform.LocalEulerAngles = firstRotation;
|
||||
transform.LocalPosition = firstPostion;
|
||||
}
|
||||
|
||||
returnBack = false;
|
||||
}
|
||||
|
||||
|
||||
if (checkSound)
|
||||
{
|
||||
/* //need to wait for collisionEnter Fix
|
||||
Vector3 itemPos = transform.LocalPosition;
|
||||
Vector3 len = Homeowner1.aiInstance.GetComponent<Transform>().LocalPosition - itemPos;
|
||||
Debug.Log($"distance: {len.GetSqrMagnitude()}");
|
||||
if (len.GetSqrMagnitude() <= soundDistance)
|
||||
{
|
||||
//set ai to alert
|
||||
}
|
||||
checkSound = false;*/
|
||||
}
|
||||
}
|
||||
|
||||
protected override void onCollisionEnter(CollisionInfo info)
|
||||
|
@ -125,37 +126,35 @@ public class Item : Script
|
|||
if (!caputurePos)
|
||||
{
|
||||
firstPostion = transform.LocalPosition;
|
||||
firstRotation = transform.LocalEulerAngles;
|
||||
caputurePos = true;
|
||||
}
|
||||
|
||||
if (playSound)
|
||||
if (once)
|
||||
{
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactElastic"], GameObject.EntityId);
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXImpactHard"], GameObject.EntityId);
|
||||
if (currCategory == ItemCategory.LIGHT)
|
||||
AudioHandler.audioClipHandlers["SFXImpactElastic"].Play();
|
||||
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
|
||||
AudioHandler.audioClipHandlers["SFXImpactHard"].Play();
|
||||
playSound = false;
|
||||
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactElastic"]);
|
||||
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactHard"]);
|
||||
|
||||
if(emitter)
|
||||
if (emitter)
|
||||
emitter.Emit();
|
||||
|
||||
Debug.Log("EMIT");
|
||||
once = false;
|
||||
}
|
||||
|
||||
if (info.GameObject.GetScript<Homeowner1>() && !returnBack)
|
||||
|
||||
if (info.GameObject.GetScript<HomeOwnerAI>() && homeownerOnce)
|
||||
{
|
||||
homeownerOnce = false;
|
||||
returnBack = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void onCollisionExit(CollisionInfo info)
|
||||
{
|
||||
playSound = true;
|
||||
checkSound = true;
|
||||
homeownerOnce = true;
|
||||
once = true;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
|
||||
public class PlayerLandState : BaseState
|
||||
|
|
|
@ -6,6 +6,7 @@ public class PlayerRunState : BaseState
|
|||
{
|
||||
private float timer;
|
||||
private float delay = 0.25f;
|
||||
private bool left = true;
|
||||
|
||||
public PlayerRunState(StateMachine stateMachine) : base(stateMachine)
|
||||
{
|
||||
|
@ -14,6 +15,11 @@ public class PlayerRunState : BaseState
|
|||
public override void OnEnter()
|
||||
{
|
||||
//Debug.Log("WALK ENTER");
|
||||
timer = delay;
|
||||
machine.GetScript<PlayerController>().playLandedAnimation = false;
|
||||
machine.GetScript<PlayerController>().Leftsmoke.EmissionCount = machine.GetScript<PlayerController>().smokeCount * 4;
|
||||
machine.GetScript<PlayerController>().Rightsmoke.EmissionCount = machine.GetScript<PlayerController>().smokeCount * 4;
|
||||
|
||||
if (PlayerAnimations.Instance)
|
||||
{
|
||||
PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip);
|
||||
|
@ -29,6 +35,27 @@ public class PlayerRunState : BaseState
|
|||
|
||||
if (timer > delay)
|
||||
{
|
||||
if (left)
|
||||
{
|
||||
if (machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y > 0.0f)
|
||||
machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y - (MathF.PI * 1.5f), machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets.y);
|
||||
else
|
||||
machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y + (MathF.PI * 0.5f), machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets.y);
|
||||
|
||||
machine.GetScript<PlayerController>().Leftsmoke.Emit();
|
||||
left = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y > 0.0f)
|
||||
machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y - (MathF.PI * 1.5f), machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets.y);
|
||||
else
|
||||
machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y + (MathF.PI * 0.5f), machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets.y);
|
||||
|
||||
machine.GetScript<PlayerController>().Rightsmoke.Emit();
|
||||
left = true;
|
||||
}
|
||||
|
||||
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||
timer = 0;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
using SHADE;
|
||||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
|
||||
public class PlayerWalkState : BaseState
|
||||
{
|
||||
private float timer;
|
||||
private float delay = 0.5f;
|
||||
private float delay = 0.4f;
|
||||
private bool left = true;
|
||||
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine)
|
||||
{
|
||||
stateName = "Walk State";
|
||||
|
@ -14,6 +15,8 @@ public class PlayerWalkState : BaseState
|
|||
{
|
||||
//Debug.Log("WALK ENTER");
|
||||
timer = delay;
|
||||
machine.GetScript<PlayerController>().Leftsmoke.EmissionCount = machine.GetScript<PlayerController>().smokeCount;
|
||||
machine.GetScript<PlayerController>().Rightsmoke.EmissionCount = machine.GetScript<PlayerController>().smokeCount;
|
||||
|
||||
machine.GetScript<PlayerController>().playLandedAnimation = false;
|
||||
|
||||
|
@ -47,6 +50,27 @@ public class PlayerWalkState : BaseState
|
|||
|
||||
if (timer > delay)
|
||||
{
|
||||
if (left)
|
||||
{
|
||||
if (machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y > 0.0f)
|
||||
machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y - (MathF.PI * 1.5f), machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets.y);
|
||||
else
|
||||
machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y + (MathF.PI * 0.5f), machine.GetScript<PlayerController>().Leftsmoke.AngularOffsets.y);
|
||||
|
||||
machine.GetScript<PlayerController>().Leftsmoke.Emit();
|
||||
left = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y > 0.0f)
|
||||
machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y - (MathF.PI * 1.5f), machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets.y);
|
||||
else
|
||||
machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets = new Vector2(machine.GetScript<PlayerController>().tranform.LocalEulerAngles.y + (MathF.PI * 0.5f), machine.GetScript<PlayerController>().Rightsmoke.AngularOffsets.y);
|
||||
|
||||
machine.GetScript<PlayerController>().Rightsmoke.Emit();
|
||||
left = true;
|
||||
}
|
||||
|
||||
AudioHandler.audioClipHandlers["footsteps"].Play();
|
||||
timer = 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SHADE;
|
||||
using SHADE;
|
||||
using SHADE_Scripting;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
|
@ -50,10 +50,18 @@ public class PickAndThrow : Script
|
|||
|
||||
public float aimingFOV = 15.0f;
|
||||
|
||||
private TrajectoryRenderable trajComp;
|
||||
private Vector3 currThrowForce;
|
||||
private float currentItemMass;
|
||||
|
||||
public uint trajMaxSteps = 50;
|
||||
public float trajTimeSteps = 0.03f;
|
||||
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
pc = GetScript<PlayerController>();
|
||||
if(!pc)
|
||||
if (!pc)
|
||||
Debug.LogError("PLAYER CONTROLLER EMPTY");
|
||||
|
||||
raccoonHoldLocation = GetComponentInChildren<Transform>();
|
||||
|
@ -61,12 +69,18 @@ public class PickAndThrow : Script
|
|||
Debug.LogError("CHILD EMPTY");
|
||||
|
||||
tpc = GetScriptInChildren<ThirdPersonCamera>();
|
||||
if(!tpc)
|
||||
if (!tpc)
|
||||
Debug.LogError("TPC EMPTY");
|
||||
|
||||
AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw");
|
||||
AudioHandler.audioClipHandlers["SFXThrowLarge"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw_large");
|
||||
AudioHandler.audioClipHandlers["SFXThrowMedium"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw_medium");
|
||||
AudioHandler.audioClipHandlers["SFXThrowSmall"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw_small");
|
||||
|
||||
timer = delayTimer;
|
||||
|
||||
trajComp = GetComponentInChildren<TrajectoryRenderable>();
|
||||
if (!trajComp)
|
||||
Debug.LogError("TrajectoryRenderable MISSING");
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
|
@ -114,7 +128,13 @@ public class PickAndThrow : Script
|
|||
|
||||
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["SFXThrow"].Play();
|
||||
if (itemScript.currCategory == ItemCategory.LIGHT)
|
||||
AudioHandler.audioClipHandlers["SFXThrowSmall"].Play();
|
||||
else if (itemScript.currCategory == ItemCategory.MEDIUM)
|
||||
AudioHandler.audioClipHandlers["SFXThrowMedium"].Play();
|
||||
else
|
||||
AudioHandler.audioClipHandlers["SFXThrowLarge"].Play();
|
||||
|
||||
itemRidigBody.IsGravityEnabled = true;
|
||||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||
pc.isAiming = false;
|
||||
|
@ -161,6 +181,19 @@ public class PickAndThrow : Script
|
|||
PlayPickUpAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
if (pc.isAiming && itemScript)
|
||||
{
|
||||
if (itemScript.currCategory == ItemCategory.LIGHT)
|
||||
currThrowForce = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir) * 0.2f;
|
||||
else if (itemScript.currCategory == ItemCategory.MEDIUM)
|
||||
currThrowForce = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir) * 0.75f;
|
||||
else
|
||||
currThrowForce = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir);
|
||||
|
||||
if (pc.holdItem && trajComp)
|
||||
trajComp.SimulateTrajectory(item.EntityId, currentItemMass, currThrowForce, trajTimeSteps, trajMaxSteps);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void fixedUpdate()
|
||||
|
@ -172,22 +205,21 @@ public class PickAndThrow : Script
|
|||
|
||||
if (throwItem && itemRidigBody && pc)
|
||||
{
|
||||
if (itemScript)
|
||||
{
|
||||
Vector3 vec = new Vector3(throwForce.x * lastXDir, throwForce.y + (throwForce.y * GetPitchRatioRange()), throwForce.z * lastZDir);
|
||||
if (itemScript.currCategory == ItemCategory.LIGHT)
|
||||
itemRidigBody.AddForce(vec * 0.2f);
|
||||
if (itemScript.currCategory == ItemCategory.MEDIUM)
|
||||
itemRidigBody.AddForce(vec * 0.75f);
|
||||
if (itemScript.currCategory == ItemCategory.HEAVY)
|
||||
itemRidigBody.AddForce(vec);
|
||||
}
|
||||
itemRidigBody.AddForce(currThrowForce);
|
||||
itemRidigBody.LinearVelocity += pc.rb.LinearVelocity;
|
||||
throwItem = false;
|
||||
ResetItemObject();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetItemGravityBack()
|
||||
{
|
||||
if(itemRidigBody)
|
||||
itemRidigBody.IsGravityEnabled = true;
|
||||
if(itemCollider)
|
||||
itemCollider.GetCollisionShape(0).IsTrigger = false;
|
||||
}
|
||||
|
||||
public void ResetItemObject()
|
||||
{
|
||||
itemRidigBody = null;
|
||||
|
@ -207,6 +239,7 @@ public class PickAndThrow : Script
|
|||
Debug.Log("Item rb EMPTY");
|
||||
else
|
||||
{
|
||||
currentItemMass = itemRidigBody.Mass;
|
||||
itemRidigBody.IsGravityEnabled = false;
|
||||
}
|
||||
|
||||
|
@ -441,7 +474,7 @@ public class PickAndThrow : Script
|
|||
}
|
||||
}
|
||||
|
||||
private void TweenAimCamArm(bool aim)
|
||||
public void TweenAimCamArm(bool aim)
|
||||
{
|
||||
|
||||
if (aim)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using SHADE;
|
||||
using SHADE;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SHADE_Scripting.Audio;
|
||||
|
@ -24,6 +24,9 @@ public class PlayerController : Script
|
|||
public CameraArm camArm { get; set; }
|
||||
private PickAndThrow pat;
|
||||
public StateMachine stateMachine { get; set; }
|
||||
public ParticleEmitter Leftsmoke { get; set; }
|
||||
public ParticleEmitter Rightsmoke { get; set; }
|
||||
public int smokeCount = 4;
|
||||
|
||||
public bool holdItem { get; set; }
|
||||
public bool isAiming { get; set; }
|
||||
|
@ -92,6 +95,10 @@ public class PlayerController : Script
|
|||
|
||||
public bool playLandedAnimation { get; set; }
|
||||
|
||||
|
||||
public GameObject leftParticle;
|
||||
public GameObject rightParticle;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
//default setup
|
||||
|
@ -143,8 +150,19 @@ public class PlayerController : Script
|
|||
}
|
||||
|
||||
AudioHandler.audioClipHandlers["footsteps"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_footsteps");
|
||||
AudioHandler.audioClipHandlers["Jump"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_jump");
|
||||
AudioHandler.audioClipHandlers["JumpPad"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_jumpPad");
|
||||
AudioHandler.audioClipHandlers["Land"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_land");
|
||||
AudioHandler.audioClipHandlers["RaccoonCaught"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_caught");
|
||||
|
||||
playLandedAnimation = false;
|
||||
|
||||
Leftsmoke = leftParticle.GetComponent<ParticleEmitter>();
|
||||
if (!Leftsmoke)
|
||||
Debug.LogError("left ParticleEmitter MISSING");
|
||||
Rightsmoke = rightParticle.GetComponent<ParticleEmitter>();
|
||||
if (!Leftsmoke)
|
||||
Debug.LogError("right ParticleEmitter MISSING");
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
|
@ -171,7 +189,7 @@ public class PlayerController : Script
|
|||
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;
|
||||
temp = 0.0075f;
|
||||
silhouettePlayerRend.Material.SetProperty<float>("data.offset", temp);
|
||||
silhouetteBagRend.Material.SetProperty<float>("data.offset", temp);
|
||||
}
|
||||
|
@ -209,7 +227,6 @@ public class PlayerController : Script
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
GotCaught();
|
||||
Rotation();
|
||||
MoveKey();
|
||||
|
@ -292,11 +309,11 @@ public class PlayerController : Script
|
|||
|
||||
private void Move()
|
||||
{
|
||||
if (rb != null && currentState != RaccoonStates.CAUGHT)
|
||||
if (rb && currentState != RaccoonStates.CAUGHT)
|
||||
{
|
||||
rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF;
|
||||
|
||||
if (isMoveKeyPress && rb)
|
||||
if (isMoveKeyPress)
|
||||
{
|
||||
Vector3 velNor = rb.LinearVelocity;
|
||||
velNor.y = 0.0f;
|
||||
|
@ -323,7 +340,16 @@ public class PlayerController : Script
|
|||
if (stateMachine && !stateMachine.IsState(typeof(PlayerRunState)))
|
||||
stateMachine.SetState(typeof(PlayerRunState));
|
||||
|
||||
holdItem = false;
|
||||
if (pat && holdItem)
|
||||
{
|
||||
holdItem = false;
|
||||
isAiming = false;
|
||||
cam.FOV = Settings.cameraFOV;
|
||||
pat.TweenAimCamArm(false);
|
||||
pat.SetItemGravityBack();
|
||||
pat.ResetItemObject();
|
||||
}
|
||||
|
||||
if (!sprintIncreaseOnce)
|
||||
{
|
||||
sprintIncreaseOnce = true;
|
||||
|
@ -335,6 +361,13 @@ public class PlayerController : Script
|
|||
}
|
||||
}
|
||||
|
||||
if (Input.GetKey(Input.KeyCode.LeftShift) && !isMoveKeyPress && isGrounded)
|
||||
{
|
||||
currentState = RaccoonStates.IDLE;
|
||||
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
|
||||
stateMachine.SetState(typeof(PlayerIdleState));
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(Input.KeyCode.LeftShift))
|
||||
{
|
||||
if (isMoveKeyPress && isGrounded)
|
||||
|
@ -343,7 +376,7 @@ public class PlayerController : Script
|
|||
if (stateMachine && !stateMachine.IsState(typeof(PlayerWalkState)))
|
||||
stateMachine.SetState(typeof(PlayerWalkState));
|
||||
}
|
||||
else if(!isMoveKeyPress && isGrounded)
|
||||
else if (!isMoveKeyPress && isGrounded)
|
||||
{
|
||||
currentState = RaccoonStates.IDLE;
|
||||
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
|
||||
|
@ -383,7 +416,11 @@ public class PlayerController : Script
|
|||
v.y *= jumpPadMultiplayer;
|
||||
landedOnJumpPad = false;
|
||||
jumpPadDrop = true;
|
||||
AudioHandler.audioClipHandlers["JumpPad"].Play();
|
||||
}
|
||||
else
|
||||
AudioHandler.audioClipHandlers["Jump"].Play();
|
||||
|
||||
rb.LinearVelocity = v;
|
||||
}
|
||||
}
|
||||
|
@ -425,6 +462,7 @@ public class PlayerController : Script
|
|||
isGrounded = true;
|
||||
if (currentState == RaccoonStates.FALLING)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["Land"].Play();
|
||||
currentState = RaccoonStates.LANDED;
|
||||
jumpPadDrop = false;
|
||||
dropTimer = 0.0f;
|
||||
|
@ -467,14 +505,18 @@ public class PlayerController : Script
|
|||
}
|
||||
}
|
||||
|
||||
private void GotCaught()
|
||||
public void GotCaught()
|
||||
{
|
||||
if (currentState == RaccoonStates.CAUGHT && tranform && respawnPoint)
|
||||
{
|
||||
AudioHandler.audioClipHandlers["RaccoonCaught"].Play();
|
||||
currentState = RaccoonStates.IDLE;
|
||||
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
|
||||
stateMachine.SetState(typeof(PlayerIdleState));
|
||||
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
|
||||
|
||||
tranform.GlobalPosition = respawnPoint.GetComponent<Transform>().GlobalPosition;
|
||||
|
||||
GameManager.Instance.RacoonCaught();
|
||||
|
||||
if (pat && pat.item)
|
||||
{
|
||||
|
@ -482,6 +524,8 @@ public class PlayerController : Script
|
|||
{
|
||||
holdItem = false;
|
||||
pat.item.GetScript<Item>().returnBack = true;
|
||||
pat.SetItemGravityBack();
|
||||
pat.ResetItemObject();
|
||||
}
|
||||
if (isAiming)
|
||||
{
|
||||
|
|
|
@ -14,8 +14,6 @@ namespace SHADE_Scripting
|
|||
public float armLength = 2.0f;
|
||||
public float turnSpeedPitch = 0.3f;
|
||||
public float turnSpeedYaw = 0.5f;
|
||||
public bool inverseXControls = false;
|
||||
public bool inverseYControls = false;
|
||||
public float pitchUpperClamp = 45.0f;
|
||||
public float pitchLowerClamp = 5.0f;
|
||||
|
||||
|
@ -51,15 +49,15 @@ namespace SHADE_Scripting
|
|||
if (arm)
|
||||
{
|
||||
Vector2 vel = Input.GetMouseVelocity();
|
||||
if(inverseYControls)
|
||||
if(Settings.inverseY)
|
||||
arm.Pitch -= vel.y * turnSpeedPitch * Time.DeltaTimeF;
|
||||
else
|
||||
arm.Pitch += vel.y * turnSpeedPitch * Time.DeltaTimeF;
|
||||
|
||||
if (inverseXControls)
|
||||
arm.Yaw -= vel.x * turnSpeedYaw * Time.DeltaTimeF;
|
||||
else
|
||||
if (Settings.inverseX)
|
||||
arm.Yaw += vel.x * turnSpeedYaw * Time.DeltaTimeF;
|
||||
else
|
||||
arm.Yaw -= vel.x * turnSpeedYaw * Time.DeltaTimeF;
|
||||
|
||||
if (arm.Pitch > pitchUpperClamp)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.Audio;
|
||||
using System;
|
||||
|
||||
|
||||
|
||||
public class CeilingFan : Script
|
||||
{
|
||||
private Transform tran;
|
||||
private Collider collider;
|
||||
private float rotate = 0.0f;
|
||||
public float rotateSpeed = 10.0f;
|
||||
|
||||
private float rotateCollider1 = 0.0f;
|
||||
private float rotateCollider2 = 0.0f;
|
||||
private float rotateCollider3 = 0.0f;
|
||||
private float rotateCollider4 = 0.0f;
|
||||
private float rotateCollider5 = 0.0f;
|
||||
|
||||
private float defaultCollider1 = 0.0f;
|
||||
private float defaultCollider2 = 0.0f;
|
||||
private float defaultCollider3 = 0.0f;
|
||||
private float defaultCollider4 = 0.0f;
|
||||
private float defaultCollider5 = 0.0f;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
tran = GetComponent<Transform>();
|
||||
if (!tran)
|
||||
Debug.Log("FAN TRAN MISSING");
|
||||
|
||||
collider = GetComponent<Collider>();
|
||||
if (!collider)
|
||||
Debug.Log("FAN COLLIDER MISSING");
|
||||
else
|
||||
{
|
||||
rotateCollider1 = collider.GetCollisionShape(0).RotationOffset.y;
|
||||
defaultCollider1 = collider.GetCollisionShape(0).RotationOffset.y;
|
||||
|
||||
rotateCollider2 = collider.GetCollisionShape(1).RotationOffset.y;
|
||||
defaultCollider2 = collider.GetCollisionShape(1).RotationOffset.y;
|
||||
|
||||
rotateCollider3 = collider.GetCollisionShape(2).RotationOffset.y;
|
||||
defaultCollider3 = collider.GetCollisionShape(2).RotationOffset.y;
|
||||
|
||||
rotateCollider4 = collider.GetCollisionShape(3).RotationOffset.y;
|
||||
defaultCollider4 = collider.GetCollisionShape(3).RotationOffset.y;
|
||||
|
||||
rotateCollider5 = collider.GetCollisionShape(4).RotationOffset.y;
|
||||
defaultCollider5 = collider.GetCollisionShape(4).RotationOffset.y;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void fixedUpdate()
|
||||
{
|
||||
rotate += rotateSpeed * (float)Time.FixedDeltaTime;
|
||||
rotateCollider1 += rotateSpeed * (float)Time.FixedDeltaTime;
|
||||
rotateCollider2 += rotateSpeed * (float)Time.FixedDeltaTime;
|
||||
rotateCollider3 += rotateSpeed * (float)Time.FixedDeltaTime;
|
||||
rotateCollider4 += rotateSpeed * (float)Time.FixedDeltaTime;
|
||||
rotateCollider5 += rotateSpeed * (float)Time.FixedDeltaTime;
|
||||
|
||||
if (rotate >= MathF.PI * 2)
|
||||
{
|
||||
rotate = 0;
|
||||
rotateCollider1 = defaultCollider1;
|
||||
rotateCollider2 = defaultCollider2;
|
||||
rotateCollider3 = defaultCollider3;
|
||||
rotateCollider4 = defaultCollider4;
|
||||
rotateCollider5 = defaultCollider5;
|
||||
}
|
||||
tran.LocalEulerAngles = new Vector3(0.0f, rotate, 0.0f);
|
||||
collider.GetCollisionShape(0).RotationOffset = new Vector3(0.0f, rotateCollider1, 0.0f);
|
||||
collider.GetCollisionShape(1).RotationOffset = new Vector3(0.0f, rotateCollider2, 0.0f);
|
||||
collider.GetCollisionShape(2).RotationOffset = new Vector3(0.0f, rotateCollider3, 0.0f);
|
||||
collider.GetCollisionShape(3).RotationOffset = new Vector3(0.0f, rotateCollider4, 0.0f);
|
||||
collider.GetCollisionShape(4).RotationOffset = new Vector3(0.0f, rotateCollider5, 0.0f);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: SC_CeilingFan
|
||||
ID: 157170734
|
||||
Type: 9
|
|
@ -3,6 +3,7 @@ using SHADE_Scripting.Audio;
|
|||
using SHADE_Scripting.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
public class GameManager : Script
|
||||
{
|
||||
|
@ -27,6 +28,7 @@ public class GameManager : Script
|
|||
|
||||
public GameObject scoreText;
|
||||
public GameObject timeText;
|
||||
public GameObject minusTimerText;
|
||||
|
||||
//mulitpler info
|
||||
public GameObject multiplierText;
|
||||
|
@ -49,6 +51,8 @@ public class GameManager : Script
|
|||
private bool goingToWin;
|
||||
private bool goingToLose;
|
||||
|
||||
private bool playSpeedUp = false;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
if (Instance != null && Instance != this)
|
||||
|
@ -86,6 +90,10 @@ public class GameManager : Script
|
|||
Input.SetMouseCentering(true);
|
||||
Application.IsCursorVisible = false;
|
||||
Application.FixDeltaTime = Time.DefaultFixDeltaTime;
|
||||
|
||||
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
|
||||
AudioHandler.audioClipHandlers["RaccoonScored"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_scored");
|
||||
Audio.SetParameterWithLabel("PlaybackSpeed", "Normal");
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
|
@ -118,6 +126,13 @@ public class GameManager : Script
|
|||
if (currGameState == GameState.START)
|
||||
{
|
||||
timer -= Time.DeltaTimeF;
|
||||
|
||||
if (timer < 30.0f && !playSpeedUp)
|
||||
{
|
||||
Audio.SetParameterWithLabel("PlaybackSpeed", "ToTransition");
|
||||
playSpeedUp = true;
|
||||
}
|
||||
|
||||
if(scoreText)
|
||||
scoreText.GetComponent<TextRenderable>().Text = $"{Score}";
|
||||
if(timeText)
|
||||
|
@ -184,6 +199,19 @@ public class GameManager : Script
|
|||
}
|
||||
}
|
||||
|
||||
public void RacoonCaught()
|
||||
{
|
||||
timer -= 10.0f;
|
||||
if(minusTimerText != GameObject.Null)
|
||||
{
|
||||
MinusTimerText text =minusTimerText.GetScript<MinusTimerText>();
|
||||
if(text)
|
||||
{
|
||||
text.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Cheat()
|
||||
{
|
||||
if (Input.GetKeyUp(Input.KeyCode.F1))
|
||||
|
@ -229,6 +257,10 @@ public class GameManager : Script
|
|||
if (currMultiplierCombo < maxMultiplierCombo)
|
||||
currMultiplierCombo += 1;
|
||||
|
||||
Audio.SetParameter("Multiplier", currMultiplierCombo);
|
||||
AudioHandler.audioClipHandlers["SFXItemScore"].Play();
|
||||
AudioHandler.audioClipHandlers["RaccoonScored"].Play();
|
||||
|
||||
MultiplierTextFx fx = multiplierText.GetScript<MultiplierTextFx>();
|
||||
if (fx)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ public class JumpPad : Script
|
|||
public float scaleDuration = 0.25f;
|
||||
private bool landed = false;
|
||||
private bool scaleUpDone = false;
|
||||
public float itemUpwardForce = 6.0f;
|
||||
|
||||
[NonSerialized]
|
||||
private TweenThread scaleYUp;
|
||||
|
@ -73,6 +74,15 @@ public class JumpPad : Script
|
|||
scaleYUp.Reset();
|
||||
scaleXZUp.Reset();
|
||||
}
|
||||
else if (info.GameObject.GetComponent<RigidBody>())
|
||||
{
|
||||
Audio.AttachAudioClipToObject(AudioHandler.audioClipHandlers["SFXJumpPad"], GameObject.EntityId);
|
||||
AudioHandler.audioClipHandlers["SFXJumpPad"].Play();
|
||||
info.GameObject.GetComponent<RigidBody>().AddForce(new Vector3(0, itemUpwardForce, 0));
|
||||
landed = true;
|
||||
scaleYUp.Reset();
|
||||
scaleXZUp.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,18 +4,28 @@ using System;
|
|||
public class ScoringZone : Script
|
||||
{
|
||||
|
||||
private ParticleEmitter particle;
|
||||
public int startingParticleCount = 10;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
|
||||
particle = GetComponentInChildren<ParticleEmitter>();
|
||||
if (!particle)
|
||||
Debug.LogError("PARTICLE MISSING");
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void onTriggerEnter(CollisionInfo info)
|
||||
{
|
||||
if (GameManager.Instance && info.GameObject.GetScript<Item>() && info.GameObject.IsActiveSelf && !info.GameObject.GetComponent<Collider>().GetCollisionShape(0).IsTrigger )
|
||||
{
|
||||
AudioHandler.audioClipHandlers["SFXItemScore"].Play();
|
||||
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
|
||||
GameManager.Instance.ItemScored();
|
||||
particle.EmissionCount = startingParticleCount * GameManager.Instance.currMultiplierCombo;
|
||||
particle.Emit();
|
||||
info.GameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,8 @@ using System.Threading.Tasks;
|
|||
EASE_OUT_SINE,
|
||||
EASE_OUT_BOUNCE,
|
||||
EASE_IN_BOUNCE,
|
||||
EASE_INOUT_BOUNCE
|
||||
EASE_INOUT_BOUNCE,
|
||||
LINEAR
|
||||
}
|
||||
|
||||
public static class EasingHelper
|
||||
|
@ -24,28 +25,33 @@ public static class EasingHelper
|
|||
{
|
||||
return EaseInSine(value);
|
||||
}
|
||||
break;
|
||||
|
||||
case EASING_METHOD.EASE_OUT_SINE:
|
||||
{
|
||||
return EaseOutSine(value);
|
||||
}
|
||||
break;
|
||||
|
||||
case EASING_METHOD.EASE_OUT_BOUNCE:
|
||||
{
|
||||
return EaseOutBounce(value);
|
||||
}
|
||||
break;
|
||||
|
||||
case EASING_METHOD.EASE_IN_BOUNCE:
|
||||
{
|
||||
return EaseInBounce(value);
|
||||
}
|
||||
break;
|
||||
|
||||
case EASING_METHOD.EASE_INOUT_BOUNCE:
|
||||
{
|
||||
return EaseInOutBounce(value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
case EASING_METHOD.LINEAR:
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SHADE;
|
||||
|
||||
|
||||
namespace SHADE_Scripting.UI
|
||||
{
|
||||
public class FadeInOnActive: Script
|
||||
{
|
||||
[NonSerialized]
|
||||
TweenThread thread;
|
||||
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
thread = TweenManager.CreateTweenThread(0.5f, 0.0f, 1.0f, EASING_METHOD.LINEAR);
|
||||
thread.SetResetOnInactive(GameObject);
|
||||
}
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if(thread != null)
|
||||
{
|
||||
Renderable renderable = GetComponent<Renderable>();
|
||||
if(renderable)
|
||||
{
|
||||
renderable.Material.SetProperty<float>("data.alpha", thread.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: SC_FadeInOnActive
|
||||
ID: 163833605
|
||||
Type: 9
|
|
@ -0,0 +1,52 @@
|
|||
using SHADE;
|
||||
using SHADE_Scripting.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
public class InverseCamera : Script
|
||||
{
|
||||
public bool inverseX = false;
|
||||
public bool inverseY = false;
|
||||
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
UIElement ui = GetComponent<UIElement>();
|
||||
if (ui)
|
||||
{
|
||||
Toggle toggle = ui.GetComponent<Toggle>();
|
||||
|
||||
if(inverseX)
|
||||
toggle.SetValue(Settings.inverseX);
|
||||
if(inverseY)
|
||||
toggle.SetValue(Settings.inverseY);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to register Toggle action for inverse");
|
||||
}
|
||||
}
|
||||
protected override void update()
|
||||
{
|
||||
UIElement ui = GetComponent<UIElement>();
|
||||
if (ui)
|
||||
{
|
||||
Toggle toggle = ui.GetComponent<Toggle>();
|
||||
|
||||
if (inverseX)
|
||||
Settings.inverseX = toggle.GetValue();
|
||||
if (inverseY)
|
||||
Settings.inverseY = toggle.GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Failed to register Toggle action for inverse");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
Name: SC_InverseCamera
|
||||
ID: 160969739
|
||||
Type: 9
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SHADE;
|
||||
|
||||
namespace SHADE_Scripting.UI
|
||||
{
|
||||
public class MinusTimerText: Script
|
||||
{
|
||||
public float duration = 0.5f;
|
||||
|
||||
|
||||
private Vector3 startPos;
|
||||
|
||||
[NonSerialized]
|
||||
TweenThread thread;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
Transform transform = GetComponent<Transform>();
|
||||
if(transform)
|
||||
{
|
||||
startPos = transform.LocalPosition;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
thread = TweenManager.CreateTweenThread(duration, 1.0f, 0.0f, EASING_METHOD.LINEAR);
|
||||
thread.SetResetOnInactive(GameObject);
|
||||
}
|
||||
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if(thread != null)
|
||||
{
|
||||
TextRenderable text = GetComponent<TextRenderable>();
|
||||
if (text)
|
||||
{
|
||||
Color temp = text.TextColor;
|
||||
temp.a = thread.GetValue();
|
||||
text.TextColor = temp;
|
||||
}
|
||||
if(thread.IsCompleted())
|
||||
{
|
||||
GameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
Transform transform = GetComponent<Transform>();
|
||||
if(transform)
|
||||
{
|
||||
Vector3 temp = transform.LocalPosition;
|
||||
temp.y -= (float)Time.DeltaTime;
|
||||
transform.LocalPosition = temp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
GameObject.SetActive(true);
|
||||
thread.Reset();
|
||||
Transform transform = GetComponent<Transform>();
|
||||
if (transform)
|
||||
{
|
||||
transform.LocalPosition = startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Name: SC_MinusTimerText
|
||||
ID: 154875718
|
||||
Type: 9
|
|
@ -13,10 +13,6 @@ namespace SHADE_Scripting.UI
|
|||
public GameObject sfxVolSlider;
|
||||
public GameObject bgmVolSlider;
|
||||
public GameObject fovSlider;
|
||||
public GameObject sensitivitySlider;
|
||||
|
||||
|
||||
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
|
@ -24,9 +20,6 @@ namespace SHADE_Scripting.UI
|
|||
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
||||
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
||||
Slider fov = fovSlider.GetComponent<Slider>();
|
||||
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
||||
|
||||
|
||||
|
||||
if (mv != null)
|
||||
{
|
||||
|
@ -47,12 +40,6 @@ namespace SHADE_Scripting.UI
|
|||
fov.ScaledValue = Settings.cameraFOV;
|
||||
|
||||
}
|
||||
if (sens != null)
|
||||
{
|
||||
sens.ScaledValue = Settings.cameraSensitivity;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -63,7 +50,6 @@ namespace SHADE_Scripting.UI
|
|||
Slider sfx = sfxVolSlider.GetComponent<Slider>();
|
||||
Slider bgm = bgmVolSlider.GetComponent<Slider>();
|
||||
Slider fov = fovSlider.GetComponent<Slider>();
|
||||
Slider sens = sensitivitySlider.GetComponent<Slider>();
|
||||
|
||||
if (mv != null)
|
||||
{
|
||||
|
@ -85,11 +71,6 @@ namespace SHADE_Scripting.UI
|
|||
{
|
||||
Settings.cameraFOV = fov.ScaledValue;
|
||||
}
|
||||
if (sens != null)
|
||||
{
|
||||
Settings.cameraSensitivity = sens.ScaledValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace SHADE_Scripting.UI
|
|||
Transform transform = GetComponent<Transform>();
|
||||
if(transform != null)
|
||||
{
|
||||
thread = TweenManager.CreateTweenThread(duration, transform.LocalPosition.y, endY, EASING_METHOD.EASE_IN_SINE);
|
||||
thread = TweenManager.CreateTweenThread(duration, transform.LocalPosition.y, endY, EASING_METHOD.LINEAR);
|
||||
thread.SetResetOnInactive(GameObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,67 +7,67 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace SHADE_Scripting.UI
|
||||
{
|
||||
public class SingleScaleBounce: Script
|
||||
public class SingleScaleBounce : Script
|
||||
{
|
||||
[NonSerialized]
|
||||
TweenThread thread;
|
||||
|
||||
[NonSerialized]
|
||||
Vector3 defaultScale;
|
||||
|
||||
public float durationUp = 0.15f;
|
||||
public float durationDown = 0.3f;
|
||||
|
||||
public float scaleSize = 1.2f;
|
||||
|
||||
[NonSerialized]
|
||||
private bool scaleUp = false;
|
||||
|
||||
private Transform trans;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
[NonSerialized]
|
||||
TweenThread thread;
|
||||
|
||||
[NonSerialized]
|
||||
Vector3 defaultScale;
|
||||
|
||||
public float durationUp = 0.15f;
|
||||
public float durationDown = 0.3f;
|
||||
|
||||
public float scaleSize = 1.2f;
|
||||
|
||||
[NonSerialized]
|
||||
private bool scaleUp = false;
|
||||
|
||||
protected override void awake()
|
||||
{
|
||||
Transform trans = GetComponent<Transform>();
|
||||
if(trans != null)
|
||||
{
|
||||
defaultScale = trans.LocalScale;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
thread = TweenManager.CreateTweenThread(0.0f,1.0f,1.0f,EASING_METHOD.EASE_IN_SINE);
|
||||
}
|
||||
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if(scaleUp)
|
||||
{
|
||||
if(thread.IsCompleted())
|
||||
{
|
||||
scaleUp = false;
|
||||
thread.duration = durationDown;
|
||||
thread.ResetInvert();
|
||||
}
|
||||
}
|
||||
|
||||
Transform trans = GetComponent<Transform>();
|
||||
if(trans != null)
|
||||
{
|
||||
trans.LocalScale = defaultScale * thread.GetValue();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void ScaleBounceOnce()
|
||||
{
|
||||
scaleUp = true;
|
||||
thread.duration = durationUp;
|
||||
thread.Reset(1.0f, scaleSize);
|
||||
}
|
||||
|
||||
trans = GetComponent<Transform>();
|
||||
if (trans != null)
|
||||
{
|
||||
defaultScale = trans.LocalScale;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void start()
|
||||
{
|
||||
if(thread != null)
|
||||
thread = TweenManager.CreateTweenThread(0.0f, 1.0f, 1.0f, EASING_METHOD.EASE_IN_SINE);
|
||||
}
|
||||
|
||||
|
||||
protected override void update()
|
||||
{
|
||||
if (scaleUp)
|
||||
{
|
||||
if (thread != null && thread.IsCompleted())
|
||||
{
|
||||
scaleUp = false;
|
||||
thread.duration = durationDown;
|
||||
thread.ResetInvert();
|
||||
}
|
||||
}
|
||||
|
||||
if (trans && thread != null)
|
||||
trans.LocalScale = defaultScale * thread.GetValue();
|
||||
}
|
||||
|
||||
public void ScaleBounceOnce()
|
||||
{
|
||||
scaleUp = true;
|
||||
if (thread != null)
|
||||
{
|
||||
thread.duration = durationUp;
|
||||
thread.Reset(1.0f, scaleSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ public class TweenThread
|
|||
private float value = 0.0f;
|
||||
public float startValue = 0.0f;
|
||||
public float endValue = 1.0f;
|
||||
|
||||
private GameObject goToCheckActive = GameObject.Null;
|
||||
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
|
||||
{
|
||||
this.duration = duration;
|
||||
|
@ -21,6 +23,15 @@ public class TweenThread
|
|||
}
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
if (goToCheckActive != GameObject.Null)
|
||||
{
|
||||
if (goToCheckActive.IsActiveInHierarchy == false)
|
||||
{
|
||||
Reset();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (timer >= duration)
|
||||
return;
|
||||
|
||||
|
@ -56,6 +67,11 @@ public class TweenThread
|
|||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void SetResetOnInactive(GameObject go)
|
||||
{
|
||||
goToCheckActive = go;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,6 +83,9 @@ public class TweenThreadVec3
|
|||
private Vector3 value = Vector3.Zero;
|
||||
public Vector3 startValue = Vector3.Zero;
|
||||
public Vector3 endValue = Vector3.Zero;
|
||||
|
||||
private GameObject goToCheckActive = GameObject.Null;
|
||||
|
||||
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
|
||||
{
|
||||
this.duration = duration;
|
||||
|
@ -76,6 +95,16 @@ public class TweenThreadVec3
|
|||
}
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
if(goToCheckActive != GameObject.Null)
|
||||
{
|
||||
if(goToCheckActive.IsActiveInHierarchy == false)
|
||||
{
|
||||
Reset();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (timer >= duration)
|
||||
return;
|
||||
|
||||
|
@ -111,6 +140,11 @@ public class TweenThreadVec3
|
|||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void SetResetOnInactive(GameObject go)
|
||||
{
|
||||
this.goToCheckActive = go;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,5 +13,7 @@ static public class Settings
|
|||
static public float masterVolume = 100.0f;
|
||||
static public float sfxVolume = 100.0f;
|
||||
static public float bgmVolume = 100.0f;
|
||||
static public bool inverseX = false;
|
||||
static public bool inverseY = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ void main()
|
|||
ParticleData particle;
|
||||
|
||||
// Get seed for randomization
|
||||
uint pixel_index = uint (emitterPosition.x + emitterPosition.y + floatBitsToUint(genericDataBuffer.data.elapsedTime) * (gl_GlobalInvocationID.x + 1));
|
||||
uint pixel_index = uint (emitterPosition.x * emitterPosition.y + floatBitsToUint(genericDataBuffer.data.elapsedTime) * (gl_GlobalInvocationID.x + 1));
|
||||
uint seed = pcg_hash (pixel_index);
|
||||
|
||||
int index = freelist.freeIndices[freelistIndex];
|
||||
|
@ -139,19 +139,20 @@ void main()
|
|||
// emit particle from emitter position
|
||||
particle.position = vec4 (emitterPosition.xyz, 1.0f);
|
||||
|
||||
vec2 eulerAngles = vec2 (rand(seed) * angularRangesAndOffsets.x + angularRangesAndOffsets.z,
|
||||
rand(seed) * angularRangesAndOffsets.y + angularRangesAndOffsets.w);
|
||||
vec2 eulerAngles = vec2 ((rand(seed) - 0.5f) * angularRangesAndOffsets.x + angularRangesAndOffsets.z,
|
||||
(rand(seed) - 0.5f) * angularRangesAndOffsets.y + angularRangesAndOffsets.w);
|
||||
|
||||
// Set its velocity
|
||||
// particle.velocity.xyz = vec3 (cos(eulerAngles.x) * cos(eulerAngles.y),
|
||||
// sin(eulerAngles.x) * cos(eulerAngles.y),
|
||||
// sin(eulerAngles.y));
|
||||
|
||||
float heading = eulerAngles.x;
|
||||
float bank = eulerAngles.y;
|
||||
float cb = cos(bank);
|
||||
float sb = sin(bank);
|
||||
float ch = cos (eulerAngles.x);
|
||||
float sh = sin (eulerAngles.x);
|
||||
float ch = cos (heading);
|
||||
float sh = sin (heading);
|
||||
float cp = cos (0.0f);
|
||||
float sp = sin (0.0f);
|
||||
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,173 @@
|
|||
#version 450
|
||||
|
||||
layout(local_size_x = 128) in;
|
||||
|
||||
struct DrawArraysIndirectArgs
|
||||
{
|
||||
uint count;
|
||||
uint instanceCount;
|
||||
uint first;
|
||||
uint baseInstance;
|
||||
};
|
||||
|
||||
struct ParticleData
|
||||
{
|
||||
vec4 position;
|
||||
vec4 orientationSpeedDecay;
|
||||
vec4 velocity;
|
||||
vec4 acceleration;
|
||||
vec4 scaleAndDecay;
|
||||
vec4 colorTint;
|
||||
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 buffer 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.life > 0.0f)
|
||||
{
|
||||
|
||||
// update position from velocity
|
||||
particle.position.xyz += particle.velocity.xyz * genericDataBuffer.data.dt;
|
||||
particle.velocity += particle.acceleration;
|
||||
particle.life -= genericDataBuffer.data.dt;
|
||||
particle.orientationSpeedDecay.x += particle.orientationSpeedDecay.y;
|
||||
// particle.scaleAndDecay.x *= particle.scaleAndDecay.z;
|
||||
// particle.scaleAndDecay.y *= particle.scaleAndDecay.w;
|
||||
|
||||
if (particle.position.w == 0.0f)
|
||||
{
|
||||
particle.scaleAndDecay.x *= particle.scaleAndDecay.z;
|
||||
particle.scaleAndDecay.y *= particle.scaleAndDecay.w;
|
||||
if (particle.scaleAndDecay.x < 0.0f)
|
||||
{
|
||||
particle.scaleAndDecay.x = 0.0f;
|
||||
particle.scaleAndDecay.y = 0.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
particle.scaleAndDecay.x /= particle.scaleAndDecay.z;
|
||||
particle.scaleAndDecay.y /= particle.scaleAndDecay.w;
|
||||
if (particle.scaleAndDecay.x > 0.2f)
|
||||
particle.position.w = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
if (particle.orientationSpeedDecay.y > 0.0f)
|
||||
{
|
||||
particle.orientationSpeedDecay.y -= particle.orientationSpeedDecay.z * genericDataBuffer.data.dt;
|
||||
if (particle.orientationSpeedDecay.y < 0.0f)
|
||||
particle.orientationSpeedDecay.y = 0.0f;
|
||||
}
|
||||
|
||||
if (particle.life < 0.0f || particle.scaleAndDecay.x < 0.0f || particle.scaleAndDecay.y < 0.0f)
|
||||
{
|
||||
particle.life = 0.0f;
|
||||
particle.position.x = 9999.0f;
|
||||
|
||||
outputParticles.data[index] = particle;
|
||||
freelist.freeIndices[atomicAdd(freelist.freeCount, 1)] = int (index);
|
||||
return;
|
||||
}
|
||||
|
||||
uint drawIndex = atomicAdd (indirectArgs.instanceCount, 1);
|
||||
indices[drawIndex] = index;
|
||||
|
||||
}
|
||||
|
||||
outputParticles.data[index] = particle;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: ParticleUpdateGrowThenShrink_CS
|
||||
ID: 42141152
|
||||
Type: 2
|
|
@ -0,0 +1,163 @@
|
|||
#version 450
|
||||
|
||||
layout(local_size_x = 128) in;
|
||||
|
||||
struct DrawArraysIndirectArgs
|
||||
{
|
||||
uint count;
|
||||
uint instanceCount;
|
||||
uint first;
|
||||
uint baseInstance;
|
||||
};
|
||||
|
||||
struct ParticleData
|
||||
{
|
||||
vec4 position;
|
||||
vec4 orientationSpeedDecay;
|
||||
vec4 velocity;
|
||||
vec4 acceleration;
|
||||
vec4 scaleAndDecay;
|
||||
vec4 colorTint;
|
||||
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 buffer 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];
|
||||
|
||||
// Get seed for randomization
|
||||
uint pixel_index = uint (particle.velocity.x + particle.velocity.y + floatBitsToUint(genericDataBuffer.data.elapsedTime) * (gl_GlobalInvocationID.x + 1));
|
||||
uint seed = pcg_hash (pixel_index);
|
||||
|
||||
|
||||
if (particle.life > 0.0f)
|
||||
{
|
||||
// update position from velocity
|
||||
particle.position += particle.velocity * genericDataBuffer.data.dt;
|
||||
particle.velocity += particle.acceleration;
|
||||
particle.life -= genericDataBuffer.data.dt;
|
||||
particle.orientationSpeedDecay.x += particle.orientationSpeedDecay.y;
|
||||
particle.scaleAndDecay.x *= particle.scaleAndDecay.z;
|
||||
particle.scaleAndDecay.y *= particle.scaleAndDecay.w;
|
||||
|
||||
if (particle.colorTint.xyz == vec3(0.0f))
|
||||
{
|
||||
particle.colorTint.xyz = vec3 (rand (seed), rand(seed), rand(seed));
|
||||
}
|
||||
|
||||
if (particle.orientationSpeedDecay.y > 0.0f)
|
||||
{
|
||||
particle.orientationSpeedDecay.y -= particle.orientationSpeedDecay.z * genericDataBuffer.data.dt;
|
||||
if (particle.orientationSpeedDecay.y < 0.0f)
|
||||
particle.orientationSpeedDecay.y = 0.0f;
|
||||
}
|
||||
|
||||
if (particle.life < 0.0f || particle.scaleAndDecay.x < 0.0f || particle.scaleAndDecay.y < 0.0f)
|
||||
{
|
||||
particle.life = 0.0f;
|
||||
particle.position.x = 9999.0f;
|
||||
|
||||
outputParticles.data[index] = particle;
|
||||
freelist.freeIndices[atomicAdd(freelist.freeCount, 1)] = int (index);
|
||||
return;
|
||||
}
|
||||
|
||||
uint drawIndex = atomicAdd (indirectArgs.instanceCount, 1);
|
||||
indices[drawIndex] = index;
|
||||
|
||||
}
|
||||
|
||||
outputParticles.data[index] = particle;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: ParticleUpdateRandomColor_CS
|
||||
ID: 37407233
|
||||
Type: 2
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,3 @@
|
|||
Name: TX_Button_Back
|
||||
ID: 59813125
|
||||
Type: 3
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue