Static variables in scripts are now reset when leaving play mode #351

Merged
Pycorax merged 7 commits from SP3-6-CSharpStaticReset into main 2023-02-20 11:12:09 +08:00
171 changed files with 7327 additions and 1043 deletions
Showing only changes of commit 916a7315da - Show all commits

1
.gitignore vendored
View File

@ -366,3 +366,4 @@ MigrationBackup/
JSON/Schemas/Catalog/ JSON/Schemas/Catalog/
Assets/Editor/Editor.SHConfig Assets/Editor/Editor.SHConfig
Assets/Editor/Layouts/UserLayout.ini

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,16 +1,16 @@
0 1 3 0 StaticObject 1110000000000000
1 2 65535 1 Player 1100000000000000
2 3 65534 2 Food 1000000000000000
3 4 65534 3 Breakable 1100000000000000
4 5 65534 4 ScoringWallCollider 0110000000000000
5 6 65534 5 Homeowner 1100000000000000
6 7 65534 6 Camera 0010000000000000
7 8 65534 7 8 0000000000000000
8 9 65534 8 9 0000000000000000
9 10 65534 9 10 0000000000000000
10 11 65534 10 11 0000000000000000
11 12 65534 11 12 0000000000000000
12 13 65534 12 13 0000000000000000
13 14 65534 13 14 0000000000000000
14 15 65534 14 15 0000000000000000
15 16 65534 15 16 0000000000000000

View File

@ -1,4 +1,4 @@
Start Maximized: true Start Maximized: true
Working Scene ID: 97086054 Working Scene ID: 86098106
Window Size: {x: 1920, y: 1013} Window Size: {x: 1920, y: 1013}
Style: 0 Style: 0

View File

@ -1,167 +0,0 @@
[Window][MainStatusBar]
Pos=0,989
Size=1920,20
Collapsed=0
[Window][SHEditorMenuBar]
Pos=0,48
Size=1920,941
Collapsed=0
[Window][Hierarchy Panel]
Pos=0,187
Size=300,802
Collapsed=0
DockId=0x00000004,0
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Window][Inspector]
Pos=1434,48
Size=486,941
Collapsed=0
DockId=0x00000006,0
[Window][Profiler]
Pos=0,48
Size=300,137
Collapsed=0
DockId=0x00000003,0
[Window][Viewport]
Pos=227,48
Size=1457,1012
Collapsed=0
DockId=0x0000000B,0
[Window][ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌð‡Žoû]
Pos=60,60
Size=32,64
Collapsed=0
[Window][ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ]
Pos=60,60
Size=999,581
Collapsed=0
[Window][ð‡]
Pos=60,60
Size=32,64
Collapsed=0
[Window][ÌÌÌÌ]
Pos=60,60
Size=553,422
Collapsed=0
[Window][]
Pos=60,60
Size=770,394
Collapsed=0
[Window][ Viewport]
Pos=227,48
Size=1457,1012
Collapsed=0
DockId=0x0000000B,0
[Window][ Viewport]
Pos=227,48
Size=1457,1012
Collapsed=0
DockId=0x0000000B,0
[Window][î<> Viewport]
Pos=302,48
Size=1130,705
Collapsed=0
DockId=0x0000000B,0
[Window][V]
Pos=310,722
Size=1501,338
Collapsed=0
DockId=0x00000008,0
[Window][p£€Ê]
Pos=310,750
Size=1501,310
Collapsed=0
DockId=0x0000000A,0
[Window][ Asset Browser]
Pos=302,755
Size=1130,234
Collapsed=0
DockId=0x0000000C,0
[Window][Material Inspector]
Pos=1434,48
Size=486,941
Collapsed=0
DockId=0x00000006,1
[Window][Save scene as...]
Pos=1197,693
Size=165,120
Collapsed=0
[Window][Create New Asset]
Pos=896,472
Size=464,144
Collapsed=0
[Window][Collider Tag Panel]
Pos=302,48
Size=1130,705
Collapsed=0
DockId=0x0000000B,1
[Window][Input Bindings Panel]
Pos=1434,48
Size=486,941
Collapsed=0
DockId=0x00000006,2
[Window][Save Scene As]
Pos=877,444
Size=165,120
Collapsed=0
[Table][0x9D40AE32,17]
Column 0 Weight=0.9945
Column 1 Weight=0.9945
Column 2 Weight=0.9945
Column 3 Weight=0.9945
Column 4 Weight=0.9945
Column 5 Weight=0.9945
Column 6 Weight=0.9945
Column 7 Weight=0.9945
Column 8 Weight=0.9945
Column 9 Weight=0.9945
Column 10 Weight=0.9945
Column 11 Weight=0.9945
Column 12 Weight=1.0132
Column 13 Weight=0.8444
Column 14 Weight=0.9945
Column 15 Weight=1.2009
Column 16 Weight=1.0132
[Docking][Data]
DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=0,71 Size=1920,941 Split=X
DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=1432,1036 Split=X
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=300,1036 Split=Y Selected=0x1E6EB881
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,147 Selected=0x1E6EB881
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=225,863 Selected=0xE096E5AE
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1130,1036 Split=Y Selected=0xB41284E7
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=1501,672 Split=Y Selected=0xB41284E7
DockNode ID=0x00000009 Parent=0x00000007 SizeRef=1501,700 Split=Y Selected=0xB41284E7
DockNode ID=0x0000000B Parent=0x00000009 SizeRef=1501,705 CentralNode=1 Selected=0xB41284E7
DockNode ID=0x0000000C Parent=0x00000009 SizeRef=1501,234 Selected=0xB128252A
DockNode ID=0x0000000A Parent=0x00000007 SizeRef=1501,310 Selected=0xD446F7B6
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=1501,338 Selected=0xD9F31532
DockNode ID=0x00000006 Parent=0xC5C9B8AB SizeRef=486,1036 Selected=0xE7039252

View File

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

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest01_SkinningTest
ID: 72178939
Type: 4
Sub Assets:
Name: Cube
ID: 141097368
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest02_HierachyTest1
ID: 80500944
Type: 4
Sub Assets:
Name: Cube.001
ID: 135102560
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest03_HierachyTest2
ID: 72063399
Type: 4
Sub Assets:
Name: Cube.001
ID: 140361184
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest04_BakedIKLegTest
ID: 80728853
Type: 4
Sub Assets:
Name: Cube
ID: 149723808
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest05_MeshDeformTest
ID: 82124728
Type: 4
Sub Assets:
Name: Sphere
ID: 138773466
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: MD_RigTest06_Piston
ID: 76715962
Type: 4
Sub Assets:
Name: Cube
ID: 134911040
Type: 8

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
- EID: 1 - EID: 1
Name: Canvas Name: Canvas
IsActive: true IsActive: true
NumberOfChildren: 1 NumberOfChildren: 3
Components: Components:
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
@ -23,7 +23,7 @@
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 2 - EID: 2
Name: Default Name: Back Ground
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
@ -36,7 +36,61 @@
Mesh: 141771688 Mesh: 141771688
Material: 123313564 Material: 123313564
IsActive: true IsActive: true
UI Component:
Canvas ID: 1
IsActive: true
Scripts: ~ Scripts: ~
- EID: 5
Name: Main Menu Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 65788519
Hovered Texture: 55999018
Clicked Texture: 66382894
IsActive: true
UI Component:
Canvas ID: 1
IsActive: true
Scripts:
- Type: ChangeSceneButton
Enabled: true
sceneID: 97158628
- EID: 6
Name: Quit Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 66477839
Hovered Texture: 65045286
Clicked Texture: 58607560
IsActive: true
UI Component:
Canvas ID: 1
IsActive: true
Scripts:
- Type: QuitButton
Enabled: true
- EID: 3 - EID: 3
Name: Camera Name: Camera
IsActive: true IsActive: true

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
- EID: 0 - EID: 0
Name: Canvas Name: Canvas
IsActive: true IsActive: true
NumberOfChildren: 1 NumberOfChildren: 3
Components: Components:
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
@ -9,7 +9,7 @@
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 1 - EID: 1
Name: Default Name: Background
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
@ -22,7 +22,61 @@
Mesh: 141771688 Mesh: 141771688
Material: 121834459 Material: 121834459
IsActive: true IsActive: true
UI Component:
Canvas ID: 0
IsActive: true
Scripts: ~ Scripts: ~
- EID: 5
Name: Start Game Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 52901020
Hovered Texture: 62235279
Clicked Texture: 64722619
IsActive: true
UI Component:
Canvas ID: 0
IsActive: true
Scripts:
- Type: ChangeSceneButton
Enabled: true
sceneID: 96668835
- EID: 6
Name: Quit Game Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 66477839
Hovered Texture: 65045286
Clicked Texture: 58607560
IsActive: true
UI Component:
Canvas ID: 0
IsActive: true
Scripts:
- Type: QuitButton
Enabled: true
- EID: 2 - EID: 2
Name: Light Name: Light
IsActive: true IsActive: true
@ -67,3 +121,4 @@
Scripts: Scripts:
- Type: MainMenu - Type: MainMenu
Enabled: true Enabled: true
sceneID: 96668835

View File

@ -1,19 +1,19 @@
- EID: 0 - EID: 0
Name: Default Name: Player
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 7, z: 0} Translate: {x: 0, y: 7, z: 0}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 1.48352981, y: 0, z: 0}
Scale: {x: 0.999999344, y: 0.999999821, z: 0.999999523} Scale: {x: 0.999999344, y: 0.999999821, z: 0.999999523}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.100000001 Angular Drag: 0.100000001
Use Gravity: false Use Gravity: true
Interpolate: true Interpolate: false
Sleeping Enabled: true Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
@ -25,7 +25,7 @@
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 1 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006
@ -39,6 +39,8 @@
Enabled: true Enabled: true
forceAmount: 50 forceAmount: 50
torqueAmount: 500 torqueAmount: 500
- Type: CollisionTest
Enabled: true
- EID: 1 - EID: 1
Name: Default Name: Default
IsActive: true IsActive: true
@ -52,7 +54,7 @@
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 1 Collision Tag: 0
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006
@ -161,7 +163,7 @@
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Collision Tag: 1 Collision Tag: 2
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006
@ -208,3 +210,26 @@
Rotation Offset: {x: 0, y: 0, z: 0} Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 8
Name: Target
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 8, y: 7, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Box
Half Extents: {x: 1, y: 1, z: 1}
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: ~

View File

@ -15,7 +15,7 @@
- EID: 1 - EID: 1
Name: Canvas Name: Canvas
IsActive: true IsActive: true
NumberOfChildren: 1 NumberOfChildren: 3
Components: Components:
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
@ -23,7 +23,7 @@
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 2 - EID: 2
Name: Default Name: Background
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
@ -36,7 +36,61 @@
Mesh: 141771688 Mesh: 141771688
Material: 129138332 Material: 129138332
IsActive: true IsActive: true
UI Component:
Canvas ID: 1
IsActive: true
Scripts: ~ Scripts: ~
- EID: 5
Name: Main Menu Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 65788519
Hovered Texture: 55999018
Clicked Texture: 66382894
IsActive: true
UI Component:
Canvas ID: 1
IsActive: true
Scripts:
- Type: ChangeSceneButton
Enabled: true
sceneID: 97158628
- EID: 6
Name: Quit Button
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 200, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 66477839
Hovered Texture: 65045286
Clicked Texture: 58607560
IsActive: true
UI Component:
Canvas ID: 1
IsActive: true
Scripts:
- Type: QuitButton
Enabled: true
- EID: 3 - EID: 3
Name: Camera Name: Camera
IsActive: true IsActive: true

View File

@ -0,0 +1,23 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.Audio
{
public static class AudioHandler
{
public static Dictionary<string, AudioClipHandler> audioClipHandlers = new Dictionary<string, AudioClipHandler>();
//Functions here, maybe
public static void stopAllSounds(bool fadeOut)
{
foreach (KeyValuePair<string, AudioClipHandler> h in audioClipHandlers)
{
h.Value.Stop(fadeOut);
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: AudioHandler
ID: 159235425
Type: 9

View File

@ -0,0 +1,19 @@
using System;
using SHADE;
public class FixRotation : Script
{
Transform tran;
protected override void awake()
{
tran = GetComponent<Transform>();
}
protected override void update()
{
if(tran)
tran.LocalEulerAngles = Vector3.Zero;
}
}

View File

@ -0,0 +1,3 @@
Name: FixRotation
ID: 162507316
Type: 9

View File

@ -14,6 +14,7 @@
using SHADE; using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree; using SHADE_Scripting.AIBehaviour.BehaviourTree;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -99,6 +100,17 @@ public partial class Homeowner1 : BehaviourTree
SetData("turningSpeed", turningSpeed); SetData("turningSpeed", turningSpeed);
SetData("distanceToCapture", distanceToCapture); SetData("distanceToCapture", distanceToCapture);
SetData("baseCaptureTime", captureTime);*/ SetData("baseCaptureTime", captureTime);*/
//These should be somewhere else
//Debug.Log("TESTING");
AudioHandler.audioClipHandlers["BGMUnalert"] = Audio.CreateAudioClip("event:/Music/player_undetected");
AudioHandler.audioClipHandlers["BGMAlert"] = Audio.CreateAudioClip("event:/Music/player_detected");
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
AudioHandler.audioClipHandlers["SFXFootstep"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_footsteps");
AudioHandler.audioClipHandlers["SFXDetectAh"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_detect_raccoon");
AudioHandler.audioClipHandlers["SFXDetectSting"] = Audio.CreateAudioClip("event:/Music/stingers/player_detected");
} }
//Called every tick //Called every tick
@ -132,7 +144,6 @@ public partial class Homeowner1 : BehaviourTree
if (GetData("baseCaptureTime") == null || (float)GetData("baseCaptureTime") != captureTime) if (GetData("baseCaptureTime") == null || (float)GetData("baseCaptureTime") != captureTime)
SetData("baseCaptureTime", captureTime); SetData("baseCaptureTime", captureTime);
events.Tick(); events.Tick();
//Footsteps SFX, move them somewhere else soon //Footsteps SFX, move them somewhere else soon
@ -141,7 +152,8 @@ public partial class Homeowner1 : BehaviourTree
footstepTimeRemaining -= velocity * Time.DeltaTimeF; footstepTimeRemaining -= velocity * Time.DeltaTimeF;
if (footstepTimeRemaining < 0.0f) if (footstepTimeRemaining < 0.0f)
{ {
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_footsteps"); //Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_footsteps");
//AudioHandler.audioClipHandlers["SFXFootstep"].Play();
footstepTimeRemaining = footstepSFXIntervalMultiplier; footstepTimeRemaining = footstepSFXIntervalMultiplier;
} }
//Debug.Log("Ticked"); //Debug.Log("Ticked");

View File

@ -11,6 +11,7 @@
using SHADE; using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree; using SHADE_Scripting.AIBehaviour.BehaviourTree;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -111,7 +112,9 @@ public partial class LeafChase : BehaviourTreeNode
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{ {
Audio.PlaySFXOnce2D("event:/Homeowner/humming"); //AudioHandler.audioClipHandlers["BGMAdpative"].SetParameter("Detected", 0.0f);
Audio.SetParameter("Detected", 0.0f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
} }
SetNodeData("isAlert", false); SetNodeData("isAlert", false);

View File

@ -11,6 +11,7 @@
using SHADE; using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree; using SHADE_Scripting.AIBehaviour.BehaviourTree;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -239,9 +240,12 @@ public partial class LeafPatrol : BehaviourTreeNode
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert")) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert"))
{ {
//Debug.Log("Unalert"); //Debug.Log("Unalert");
Audio.PlaySFXOnce2D("event:/Homeowner/humming"); //AudioHandler.audioClipHandlers["BGMAlert"].Stop(true);
Audio.StopAllSounds(); //Audio.PlaySFXOnce2D("event:/Homeowner/humming");
Audio.PlayBGMOnce2D("event:/Music/player_undetected"); AudioHandler.audioClipHandlers["SFXHumming"].Play();
//AudioHandler.audioClipHandlers["BGMUnalert"].Play();
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
Audio.SetParameter("Detected", 0.0f);
} }
SetNodeData("isAlert", false); SetNodeData("isAlert", false);
} }

View File

@ -11,6 +11,7 @@
using SHADE; using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree; using SHADE_Scripting.AIBehaviour.BehaviourTree;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -65,7 +66,9 @@ public partial class LeafSearch : BehaviourTreeNode
{ {
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{ {
Audio.PlaySFXOnce2D("event:/Homeowner/humming"); //AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
Audio.SetParameter("Detected", 0.0f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
reevaluateWaypoint(); reevaluateWaypoint();
} }
SetNodeData("isAlert", false); SetNodeData("isAlert", false);
@ -185,19 +188,27 @@ public partial class LeafSearch : BehaviourTreeNode
if (GetNodeData("isAlert") == null) if (GetNodeData("isAlert") == null)
{ {
SetNodeData("isAlert", true); SetNodeData("isAlert", true);
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon"); //Audio.StopAllSounds();
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected"); AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
Audio.StopAllSounds(); AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
Audio.PlayBGMOnce2D("event:/Music/player_detected"); //AudioHandler.audioClipHandlers["BGMAlert"].Play();
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
Audio.SetParameter("Detected", 1.0f);
} }
else else
{ {
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false)
{ {
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon"); //Audio.StopAllSounds();
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected"); AudioHandler.audioClipHandlers["SFXDetectAh"].Play();
Audio.StopAllSounds(); AudioHandler.audioClipHandlers["SFXDetectSting"].Play();
Audio.PlayBGMOnce2D("event:/Music/player_detected"); //AudioHandler.audioClipHandlers["BGMAlert"].Play();
AudioHandler.audioClipHandlers["SFXHumming"].Stop(false);
//AudioHandler.audioClipHandlers["BGMUnalert"].Stop(true);
//AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 1.0f);
Audio.SetParameter("Detected", 1.0f);
} }
SetNodeData("isAlert", true); SetNodeData("isAlert", true);
} }

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@ -12,7 +13,6 @@ public class Breakable : Script
private Transform trans; private Transform trans;
public bool isBreak { get; set; } public bool isBreak { get; set; }
private List<GameObject> itemPieces = new List<GameObject>(); private List<GameObject> itemPieces = new List<GameObject>();
private Random ran = new Random();
protected override void awake() protected override void awake()
{ {
@ -31,6 +31,8 @@ public class Breakable : Script
} }
isBreak = false; isBreak = false;
AudioHandler.audioClipHandlers["SFXBreak"] = Audio.CreateAudioClip("event:/Props/impact_break");
} }
protected override void update() protected override void update()
@ -44,7 +46,8 @@ public class Breakable : Script
if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>()) if (ignoreRaccoon && info.GameObject.GetScript<PlayerController>())
return; return;
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold)
if (rb.LinearVelocity.GetSqrMagnitude() > threshHold && !info.GameObject.GetScript<PlayerController>())
{ {
isBreak = true; isBreak = true;
if(GameObject.GetScript<Item>()) if(GameObject.GetScript<Item>())
@ -69,7 +72,7 @@ public class Breakable : Script
} }
isBreak = false; isBreak = false;
Audio.PlaySFXOnce2D("event:/Props/impact_break"); AudioHandler.audioClipHandlers["SFXBreak"].Play();
GameObject.SetActive(false); GameObject.SetActive(false);
} }
} }

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class Item : Script public class Item : Script
{ {
@ -14,6 +15,7 @@ public class Item : Script
public ItemCategory currCategory; public ItemCategory currCategory;
public bool returnBack { get; set; } public bool returnBack { get; set; }
private Transform transform; private Transform transform;
private RigidBody rb;
private bool playSound = false; private bool playSound = false;
private bool caputurePos = false; private bool caputurePos = false;
private Vector3 firstPostion; private Vector3 firstPostion;
@ -21,14 +23,19 @@ public class Item : Script
public float density = 1.0f; public float density = 1.0f;
public bool dontReturn = false; public bool dontReturn = false;
protected override void awake() protected override void awake()
{ {
transform = GetComponent<Transform>(); transform = GetComponent<Transform>();
rb = GetComponent<RigidBody>();
collider = GetComponent<Collider>(); collider = GetComponent<Collider>();
if(collider) if(collider)
collider.GetCollisionShape(0).Density = density; collider.GetCollisionShape(0).Density = density;
returnBack = false; returnBack = false;
AudioHandler.audioClipHandlers["SFXImpactElastic"] = Audio.CreateAudioClip("event:/Props/impact_elastic");
AudioHandler.audioClipHandlers["SFXImpactHard"] = Audio.CreateAudioClip("event:/Props/impact_hard");
} }
protected override void start() protected override void start()
@ -40,7 +47,12 @@ public class Item : Script
{ {
if (returnBack && !dontReturn) if (returnBack && !dontReturn)
{ {
if(transform)
transform.LocalPosition = firstPostion; transform.LocalPosition = firstPostion;
if (rb)
rb.LinearVelocity = Vector3.Zero;
returnBack = false; returnBack = false;
} }
} }
@ -56,13 +68,13 @@ public class Item : Script
if (playSound) if (playSound)
{ {
if (currCategory == ItemCategory.LIGHT) if (currCategory == ItemCategory.LIGHT)
Audio.PlaySFXOnce2D("event:/Props/impact_elastic"); AudioHandler.audioClipHandlers["SFXImpactElastic"].Play();
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY) else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
Audio.PlaySFXOnce2D("event:/Props/impact_hard"); AudioHandler.audioClipHandlers["SFXImpactHard"].Play();
playSound = false; playSound = false;
} }
if (info.GameObject.GetScript<Homeowner1>()) if (info.GameObject.GetScript<Homeowner1>() && !returnBack)
{ {
returnBack = true; returnBack = true;
} }

View File

@ -1,5 +1,6 @@
using SHADE; using SHADE;
using SHADE_Scripting; using SHADE_Scripting;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using static PlayerController; using static PlayerController;
@ -29,6 +30,9 @@ public class PickAndThrow : Script
[Tooltip("Lenght of ray")] [Tooltip("Lenght of ray")]
public float rayDistance = 1; public float rayDistance = 1;
[Tooltip("Height of ray")]
public float rayHeight = 0.1f;
protected override void awake() protected override void awake()
{ {
pc = GetScript<PlayerController>(); pc = GetScript<PlayerController>();
@ -43,6 +47,8 @@ public class PickAndThrow : Script
if(!tpc) if(!tpc)
Debug.LogError("TPC EMPTY"); Debug.LogError("TPC EMPTY");
AudioHandler.audioClipHandlers["SFXThrow"] = Audio.CreateAudioClip("event:/Raccoon/raccoon_throw");
timer = delayTimer; timer = delayTimer;
} }
protected override void update() protected override void update()
@ -72,7 +78,7 @@ public class PickAndThrow : Script
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming) if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
{ {
Audio.PlaySFXOnce2D("event:/Raccoon/raccoon_throw"); AudioHandler.audioClipHandlers["SFXThrow"].Play();
itemRidigBody.IsGravityEnabled = true; itemRidigBody.IsGravityEnabled = true;
itemCollider.GetCollisionShape(0).IsTrigger = false; itemCollider.GetCollisionShape(0).IsTrigger = false;
pc.isAiming = false; pc.isAiming = false;
@ -202,18 +208,29 @@ public class PickAndThrow : Script
{ {
Vector3 dirNor = pc.tranform.Forward; Vector3 dirNor = pc.tranform.Forward;
Vector3 playerRayPos = pc.tranform.GlobalPosition; Vector3 playerRayPos = pc.tranform.GlobalPosition;
playerRayPos.y += 0.05f; playerRayPos.y += rayHeight;
dirNor.Normalise(); dirNor.Normalise();
List<RaycastHit> rayList1 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(22.5f))), rayDistance, false, (ushort)65535); List<RaycastHit> rayList1 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(22.5f))), rayDistance, false, (ushort)65535);
List<RaycastHit> rayList2 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(-22.5f))), rayDistance, false, (ushort)65535); List<RaycastHit> rayList2 = Physics.Raycast(new Ray(playerRayPos, Vector3.RotateY(dirNor, SHADE.Math.DegreesToRadians(-22.5f))), rayDistance, false, (ushort)65535);
List<RaycastHit> rayList3 = Physics.Raycast(new Ray(playerRayPos, dirNor), rayDistance * 0.75f, false, (ushort)65535); List<RaycastHit> rayList3 = Physics.Raycast(new Ray(playerRayPos, dirNor), rayDistance * 0.75f, false, (ushort)65535);
if (rayList1.Count > 0 && rayList2.Count > 0 && rayList3.Count > 0) if (rayList1.Count > 0)
{ {
RaycastHit ray1 = rayList1[0]; RaycastHit ray1 = rayList1[0];
inRange = CheckForItem(ray1);
return;
}
else if (rayList2.Count > 0)
{
RaycastHit ray2 = rayList2[0]; RaycastHit ray2 = rayList2[0];
inRange = CheckForItem(ray2);
return;
}
else if (rayList3.Count > 0)
{
RaycastHit ray3 = rayList3[0]; RaycastHit ray3 = rayList3[0];
inRange = CheckForItem(ray1) || CheckForItem(ray2) || CheckForItem(ray3); inRange = CheckForItem(ray3);
return;
} }
else else
{ {

View File

@ -150,7 +150,13 @@ public class PlayerController : Script
if(!camArm) if(!camArm)
camArm = GetComponentInChildren<CameraArm>(); camArm = GetComponentInChildren<CameraArm>();
//tempFix
if (tranform)
tranform.LocalEulerAngles = new Vector3(0.0f, tranform.LocalEulerAngles.y, 0.0f);
Rotation(); Rotation();
MoveKey();
Sprint();
Jump(); Jump();
GotCaught(); GotCaught();
//Debug.Log($"{currentState}"); //Debug.Log($"{currentState}");
@ -161,10 +167,7 @@ public class PlayerController : Script
protected override void fixedUpdate() protected override void fixedUpdate()
{ {
MoveKey();
Move(); Move();
Sprint();
Gravity(); Gravity();
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}"); //Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}");
} }
@ -371,7 +374,7 @@ public class PlayerController : Script
stateMachine.SetState(typeof(PlayerIdleState)); stateMachine.SetState(typeof(PlayerIdleState));
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition; tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
if (pat && pat.item.GetScript<Item>()) if (pat && pat.item)
{ {
holdItem = false; holdItem = false;
isAiming = false; isAiming = false;

View File

@ -17,6 +17,7 @@ namespace SHADE_Scripting
public float pitchClamp = 45.0f; public float pitchClamp = 45.0f;
public bool inverseXControls = false; public bool inverseXControls = false;
public bool inverseYControls = false; public bool inverseYControls = false;
public float lowerClamp = 5.0f;
protected override void awake() protected override void awake()
{ {
@ -58,9 +59,9 @@ namespace SHADE_Scripting
{ {
arm.Pitch = pitchClamp; arm.Pitch = pitchClamp;
} }
else if (arm.Pitch < 0) else if (arm.Pitch < lowerClamp)
{ {
arm.Pitch = 0; arm.Pitch = lowerClamp;
} }
} }
} }

View File

@ -1,4 +1,5 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -26,8 +27,35 @@ public class GameManager : Script
public GameObject scoreText; public GameObject scoreText;
public GameObject timeText; public GameObject timeText;
//mulitpler info
public GameObject multiplierText;
public float maxMultiplierDuration = 5.0f;
public float currMultiplierDuration { get; set; }
public int maxMultiplierCombo = 10;
public bool itemScored {get;set;}
public int currMultiplierCombo { get; set;}
public float multiplierFont = 60.0f;
private Vector3 fontScalar;
public static GameManager Instance { get; private set; } public static GameManager Instance { get; private set; }
protected override void start()
{
base.start();
AudioHandler.audioClipHandlers["BGMAdaptive"] = Audio.CreateAudioClip("event:/Music/bgm_adaptive");
AudioHandler.audioClipHandlers["BGMAdaptive"].Play();
Audio.SetParameter("Detected", 0.0f);
AudioHandler.audioClipHandlers["KitchenAmbience"] = Audio.CreateAudioClip("event:/Ambience/roomtone_kitchen");
AudioHandler.audioClipHandlers["KitchenAmbience"].Play();
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
}
protected override void awake() protected override void awake()
{ {
if (Instance != null && Instance != this) if (Instance != null && Instance != this)
@ -35,17 +63,27 @@ public class GameManager : Script
else else
Instance = this; Instance = this;
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
Audio.PlayBGMOnce2D("event:/Ambience/roomtone_kitchen"); //AudioHandler.audioClipHandlers["BGMAdaptive"].SetParameter("Detected", 0.0f);
//Audio.PlayBGMOnce2D("event:/Music/player_undetected");
//Audio.PlayBGMOnce2D("event:/Ambience/roomtone_kitchen");
totalItemCount = 0; totalItemCount = 0;
Score = 0; Score = 0;
currGameState = GameState.START; currGameState = GameState.START;
itemScored = false;
currMultiplierCombo = 1;
currMultiplierDuration = 0;
fontScalar = new Vector3(multiplierFont / maxMultiplierDuration, multiplierFont / maxMultiplierDuration , multiplierFont / maxMultiplierDuration);
AudioHandler.audioClipHandlers["BGMWin"] = Audio.CreateAudioClip("event:/Music/stingers/game_win");
AudioHandler.audioClipHandlers["BGMLose"] = Audio.CreateAudioClip("event:/Music/stingers/game_lose");
} }
protected override void update() protected override void update()
{ {
Cheats(); Cheats();
if (currGameState == GameState.START) if (currGameState == GameState.START)
{ {
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
@ -54,19 +92,44 @@ public class GameManager : Script
if(timeText) if(timeText)
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}"; timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}";
if ((timer > 0 && totalItemCount < 0) || Input.GetKeyDown(Input.KeyCode.F1)) if (itemScored)
{
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
currMultiplierDuration += Time.DeltaTimeF;
if (currMultiplierDuration >= maxMultiplierDuration)
{
itemScored = false;
currMultiplierCombo = 1;
currMultiplierDuration = 0;
}
}
else
{
multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
}
if ((timer > 0 && totalItemCount <= 0) || Input.GetKeyDown(Input.KeyCode.F1))
{ {
currGameState = GameState.WIN; currGameState = GameState.WIN;
Audio.StopAllSounds(); //Audio.StopAllSounds(); //Calling this outright breaks audio clip handlers
AudioHandler.stopAllSounds(false);
AudioHandler.audioClipHandlers["BGMWin"].Play();
SceneManager.ChangeScene(winScene); SceneManager.ChangeScene(winScene);
Audio.PlaySFXOnce2D("event:/Music/stingers/game_win"); //Audio.PlaySFXOnce2D("event:/Music/stingers/game_win");
} }
else if(timer < 0 || Input.GetKeyDown(Input.KeyCode.F2)) else if(timer < 0 || Input.GetKeyDown(Input.KeyCode.F2))
{ {
currGameState = GameState.LOSE; currGameState = GameState.LOSE;
Audio.StopAllSounds(); //Audio.StopAllSounds();
AudioHandler.stopAllSounds(false);
AudioHandler.audioClipHandlers["BGMLose"].Play();
SceneManager.ChangeScene(loseScene); SceneManager.ChangeScene(loseScene);
Audio.PlaySFXOnce2D("event:/Music/stingers/game_lose"); //Audio.PlaySFXOnce2D("event:/Music/stingers/game_lose");
} }
} }
} }
@ -86,4 +149,14 @@ public class GameManager : Script
} }
} }
public void ItemScored()
{
totalItemCount -= 1;
itemScored = true;
currMultiplierDuration = 0;
multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont);
if (currMultiplierCombo < maxMultiplierCombo)
currMultiplierCombo += 1;
}
} }

View File

@ -1,19 +1,21 @@
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
using System; using System;
public class ScoringZone : Script public class ScoringZone : Script
{ {
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["SFXItemScore"] = Audio.CreateAudioClip("event:/Music/stingers/item_scored");
} }
protected override void onTriggerEnter(CollisionInfo info) protected override void onTriggerEnter(CollisionInfo info)
{ {
if (GameManager.Instance && info.GameObject.GetScript<Item>()) if (GameManager.Instance && info.GameObject.GetScript<Item>() && info.GameObject.IsActiveSelf && !info.GameObject.GetComponent<Collider>().GetCollisionShape(0).IsTrigger )
{ {
Audio.PlaySFXOnce2D("event:/Music/stingers/item_scored"); AudioHandler.audioClipHandlers["SFXItemScore"].Play();
GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score; GameManager.Instance.Score += info.GameObject.GetScript<Item>().Score * GameManager.Instance.currMultiplierCombo;
GameManager.Instance.totalItemCount -= 1; GameManager.Instance.ItemScored();
info.GameObject.SetActive(false); info.GameObject.SetActive(false);
} }
} }

View File

@ -0,0 +1,45 @@
using SHADE;
using System;
using System.Collections.Generic;
using static Item;
public class CollisionTest : Script
{
public Collider collider { get; set; }
private bool printStay = false;
protected override void awake()
{
collider = GetComponent<Collider>();
}
protected override void onCollisionEnter(CollisionInfo info)
{
base.onCollisionEnter(info);
Debug.Log("Collision Enter");
printStay = false;
}
protected override void onCollisionStay(CollisionInfo info)
{
base.onCollisionStay(info);
if (!printStay)
{
Debug.Log("Collision Stay");
printStay= true;
}
}
protected override void onCollisionExit(CollisionInfo info)
{
base.onCollisionExit(info);
Debug.Log("Collision Exit");
printStay = false;
}
};

View File

@ -0,0 +1,3 @@
Name: CollisionTest
ID: 163810535
Type: 9

View File

@ -6,6 +6,7 @@ using static Item;
public class PhysicsTestObj : Script public class PhysicsTestObj : Script
{ {
public Transform tf { get; set; }
public RigidBody body { get; set; } public RigidBody body { get; set; }
public Collider collider { get; set; } public Collider collider { get; set; }
@ -68,6 +69,7 @@ public class PhysicsTestObj : Script
protected override void awake() protected override void awake()
{ {
tf = GetComponent<Transform>();
body = GetComponent<RigidBody>(); body = GetComponent<RigidBody>();
collider = GetComponent<Collider>(); collider = GetComponent<Collider>();
@ -80,9 +82,12 @@ public class PhysicsTestObj : Script
protected override void update() protected override void update()
{ {
Ray colliderRay = new Ray(); GameObject? target = GameObject.Find("Target");
colliderRay.Direction = Vector3.Right; if (target.HasValue)
Physics.ColliderRaycast(collider.Owner, colliderRay, false, 8); {
Physics.ColliderLineCast(collider.Owner, Vector3.Zero, target.Value.GetComponent<Transform>().GlobalPosition, false, (ushort)64);
}
for (int i = 0; i < 6; ++i) for (int i = 0; i < 6; ++i)
{ {

View File

@ -0,0 +1,33 @@
using SHADE;
using System;
using System.Collections.Generic;
using static Item;
public class TriggerTest : Script
{
public Collider collider { get; set; }
protected override void awake()
{
collider = GetComponent<Collider>();
}
protected override void onTriggerEnter(CollisionInfo info)
{
base.onTriggerEnter(info);
Debug.Log("Trigger Enter");
}
protected override void onTriggerStay(CollisionInfo info)
{
base.onTriggerStay(info);
Debug.Log("Trigger Stay");
}
protected override void onTriggerExit(CollisionInfo info)
{
base.onTriggerExit(info);
Debug.Log("Trigger Exit");
}
};

View File

@ -0,0 +1,3 @@
Name: TriggerTest
ID: 159344038
Type: 9

View File

@ -0,0 +1,33 @@
using System;
using SHADE;
public class ChangeSceneButton : Script
{
public uint sceneID = 0;
protected override void start()
{
UIElement ui = GetComponent<UIElement>();
if (ui != null)
{
ui.OnClick.RegisterAction(() =>
{
if (sceneID != 0)
{
Audio.PlaySFXOnce2D("event:/UI/success");
SceneManager.ChangeScene(sceneID);
Audio.StopAllSounds();
}
});
}
else
{
Debug.LogError("Failed to register button action for ChangeSceneButton.");
}
}
protected override void update()
{
}
}

View File

@ -0,0 +1,3 @@
Name: SC_ChangeSceneButton
ID: 155329160
Type: 9

View File

@ -1,5 +1,6 @@
using System; using System;
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
public class EndScene : Script public class EndScene : Script
{ {
@ -8,28 +9,36 @@ public class EndScene : Script
protected override void awake() protected override void awake()
{ {
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
} }
protected override void update() protected override void update()
{ {
if (Input.GetKeyDown(Input.KeyCode.R)) if (Input.GetKeyDown(Input.KeyCode.R))
{ {
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element"); //Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
} }
if (Input.GetKeyUp(Input.KeyCode.R)) if (Input.GetKeyUp(Input.KeyCode.R))
{ {
Audio.PlaySFXOnce2D("event:/UI/success"); //Audio.PlaySFXOnce2D("event:/UI/success");
Audio.StopAllSounds(); //Audio.StopAllSounds();
AudioHandler.stopAllSounds(false);
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
SceneManager.ChangeScene(mainGameScene); SceneManager.ChangeScene(mainGameScene);
} }
if (Input.GetKeyDown(Input.KeyCode.M)) if (Input.GetKeyDown(Input.KeyCode.M))
{ {
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element"); //Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
} }
if (Input.GetKeyUp(Input.KeyCode.M)) if (Input.GetKeyUp(Input.KeyCode.M))
{ {
Audio.PlaySFXOnce2D("event:/UI/success"); //Audio.PlaySFXOnce2D("event:/UI/success");
Audio.StopAllSounds(); //Audio.StopAllSounds();
AudioHandler.stopAllSounds(false);
AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
SceneManager.ChangeScene(mainMainScene); SceneManager.ChangeScene(mainMainScene);
} }

View File

@ -1,23 +1,31 @@
using System; using System;
using SHADE; using SHADE;
using SHADE_Scripting.Audio;
public class MainMenu : Script public class MainMenu : Script
{ {
public uint sceneID;
protected override void awake() protected override void awake()
{ {
Audio.PlayBGMOnce2D("event:/Music/main_menu"); AudioHandler.audioClipHandlers["BGMMainMenu"] = Audio.CreateAudioClip("event:/Music/main_menu");
AudioHandler.audioClipHandlers["SFXMouseDownElement"] = Audio.CreateAudioClip("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXUISuccess"] = Audio.CreateAudioClip("event:/UI/success");
//Audio.PlayBGMOnce2D("event:/Music/main_menu");
AudioHandler.audioClipHandlers["BGMMainMenu"].Play();
} }
protected override void update() protected override void update()
{ {
if (Input.GetKeyDown(Input.KeyCode.Space)) if (Input.GetKeyDown(Input.KeyCode.Space))
{ {
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element"); //Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
AudioHandler.audioClipHandlers["SFXMouseDownElement"].Play();
} }
if (Input.GetKeyUp(Input.KeyCode.Space)) if (Input.GetKeyUp(Input.KeyCode.Space))
{ {
Audio.PlaySFXOnce2D("event:/UI/success"); //Audio.PlaySFXOnce2D("event:/UI/success");
SceneManager.ChangeScene(86098106); AudioHandler.audioClipHandlers["SFXUISuccess"].Play();
SceneManager.ChangeScene(sceneID);
Audio.StopAllSounds(); Audio.StopAllSounds();
} }

View File

@ -0,0 +1,31 @@
using System;
using SHADE;
public class QuitButton : Script
{
protected override void start()
{
UIElement ui = GetComponent<UIElement>();
if (ui != null)
{
ui.OnClick.RegisterAction(() =>
{
ui.OnClick.RegisterAction(() =>
{
Audio.StopAllSounds();
Application.Quit();
});
});
}
else
{
Debug.LogError("Failed to register button action for QuitButton.");
}
}
protected override void update()
{
}
}

View File

@ -0,0 +1,3 @@
Name: SC_QuitButton
ID: 163136401
Type: 9

View File

@ -60,7 +60,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV
if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f) if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f)
{ {
return 0.0f; return 0.7f;
} }
else else
return 1.0f; return 1.0f;

View File

@ -0,0 +1,10 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
#extension GL_EXT_nonuniform_qualifier : require
void main()
{
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: ShadowMap_FS
ID: 45925790
Type: 2

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: howToPlay_default
ID: 65084899
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: howToPlay_hover
ID: 58647112
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: howToPlay_pressed
ID: 55758383
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: mainMenu_default
ID: 65788519
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: mainMenu_hover
ID: 55999018
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: mainMenu_pressed
ID: 66382894
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: quit_default
ID: 66477839
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: quit_hover
ID: 65045286
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: quit_pressed
ID: 58607560
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: retry_default
ID: 55782622
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: retry_hover
ID: 58972174
Type: 3

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