Refactored Graphics #297

Merged
Xenosas1337 merged 13 commits from SP3-1-Rendering into main 2023-01-01 12:35:09 +08:00
313 changed files with 51599 additions and 2140 deletions
Showing only changes of commit dfa9facfe0 - Show all commits

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,3 @@
13 14
14 15
15 16
note:
All collision tags should follow the above format "index<space>tag name".
If it fails to follow this, the default tag names will be used.

View File

@ -0,0 +1,8 @@
- VertexShader: 39210065
FragmentShader: 46377769
SubPass: G-Buffer Write
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 61918518
data.alpha: 0
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: HouseMaterial
ID: 127069936
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 39210065
FragmentShader: 46377769
SubPass: G-Buffer Write
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 57342922
data.alpha: 0
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: MT_ColorPaletteDefault
ID: 131956078
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 39210065
FragmentShader: 46377769
SubPass: G-Buffer Write
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54797199
data.alpha: 0
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: MT_Homeowner
ID: 129495479
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 39210065
FragmentShader: 46377769
SubPass: G-Buffer Write
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 53438927
data.alpha: 0
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: MT_House_Palette4
ID: 132690168
Type: 7

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_HouseInterior_Palette3
ID: 61918518
Type: 3

View File

@ -3,6 +3,6 @@
SubPass: G-Buffer Write
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 0
data.textureIndex: 54429632
data.alpha: 0
data.beta: {x: 1, y: 1, z: 1}

View File

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

View File

@ -0,0 +1,3 @@
Name: UIMat_LoseScene
ID: 123313564
Type: 7

View File

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

View File

@ -0,0 +1,3 @@
Name: UIMat_MainMenu
ID: 121834459
Type: 7

View File

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

View File

@ -0,0 +1,3 @@
Name: UIMat_WinScene
ID: 129138332
Type: 7

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,28 @@
Name: ExteriorMeshs
ID: 80559352
Type: 4
Sub Assets:
Name: TreeVar1
ID: 150881323
Type: 8
Name: TreeVar2
ID: 140386412
Type: 8
Name: TreeVar3
ID: 146337876
Type: 8
Name: BushVar1
ID: 143461339
Type: 8
Name: BushVar2
ID: 136373407
Type: 8
Name: BushVar3
ID: 144928031
Type: 8
Name: FenceSinglePiece
ID: 140263745
Type: 8
Name: FenceFivePiece
ID: 145842965
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,22 @@
Name: KitchenAddOns1
ID: 79971916
Type: 4
Sub Assets:
Name: TallStool01
ID: 140539561
Type: 8
Name: Chair01
ID: 142860936
Type: 8
Name: Table01
ID: 140474147
Type: 8
Name: ServiceTray01
ID: 140279658
Type: 8
Name: RubbishBin01_Body
ID: 143026779
Type: 8
Name: RubbishBin01_Lid
ID: 142134724
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,7 @@
Name: KitchenCounterEmpty
ID: 78136063
Type: 4
Sub Assets:
Name: CupboardEmpty
ID: 144189529
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,55 @@
Name: KitchenCounterMeshs
ID: 82758363
Type: 4
Sub Assets:
Name: DrawerMid01
ID: 139881558
Type: 8
Name: DrawerSmall01
ID: 135779275
Type: 8
Name: DrawerSmall02
ID: 146001396
Type: 8
Name: DrawerSmall03
ID: 150413201
Type: 8
Name: DrawerLarge01
ID: 138305769
Type: 8
Name: DoorLeft
ID: 150547241
Type: 8
Name: DoorRight
ID: 146520338
Type: 8
Name: CupboardSolid
ID: 144974966
Type: 8
Name: DoorDoubleRight
ID: 146717179
Type: 8
Name: CupboardSinkPiece
ID: 141601355
Type: 8
Name: DoorDoubleLeft
ID: 146024338
Type: 8
Name: CupboardSolidBlock
ID: 142281760
Type: 8
Name: CupboardSolidHalf
ID: 137745540
Type: 8
Name: CupboardOven
ID: 136828790
Type: 8
Name: DoorOven
ID: 150740704
Type: 8
Name: DoorOvenGlass
ID: 135623020
Type: 8
Name: OvenTray
ID: 136078992
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,22 @@
Name: KitchenShelves1
ID: 82783113
Type: 4
Sub Assets:
Name: BottomLid
ID: 138181722
Type: 8
Name: TopLid
ID: 147761585
Type: 8
Name: Backcover
ID: 139576452
Type: 8
Name: InBetweenShelf
ID: 142336524
Type: 8
Name: FrameHigh
ID: 150586966
Type: 8
Name: FrameLow
ID: 140066298
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,46 @@
Name: MD_BreakableObjects1
ID: 68661596
Type: 4
Sub Assets:
Name: Plate01_Unshattered
ID: 140964851
Type: 8
Name: Plate01_Shattered.004
ID: 136742160
Type: 8
Name: Plate01_Shattered.001
ID: 146557542
Type: 8
Name: Plate01_Shattered.002
ID: 145439064
Type: 8
Name: Plate01_Shattered.003
ID: 139411134
Type: 8
Name: Bowl01_Unshattered
ID: 144894491
Type: 8
Name: Bowl01_Shattered.001
ID: 140591337
Type: 8
Name: Bowl01_Shattered.002
ID: 148464002
Type: 8
Name: Bowl01_Shattered.003
ID: 144132426
Type: 8
Name: Cup01_Unshattered
ID: 134951952
Type: 8
Name: Cup01_Shattered.001
ID: 140710075
Type: 8
Name: Cup01_Shattered.002
ID: 147241586
Type: 8
Name: Cup01_Shattered.003
ID: 141067850
Type: 8
Name: Cup01_Shattered.004
ID: 142028102
Type: 8

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,13 @@
Name: MD_FoodItems
ID: 79293496
Type: 4
Sub Assets:
Name: Cheese
ID: 141841143
Type: 8
Name: Apple
ID: 144128170
Type: 8
Name: Meat
ID: 136892700
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_Homeowner-NoRig
ID: 69970713
Type: 4
Sub Assets:
Name: BodyLow
ID: 140697366
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_SkyDome01
ID: 82516582
Type: 4
Sub Assets:
Name: Sphere
ID: 144340823
Type: 8

View File

@ -0,0 +1,276 @@
- EID: 0
Name: Main Camera
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0.472120881, z: 2.53064919}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0, y: 0.472120881, z: 2.53064919}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1920
Height: 1080
Near: 0.00999999978
Far: 10000
Perspective: true
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: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0
IsActive: true
Scripts: ~
- EID: 1
Name: Plate
IsActive: true
NumberOfChildren: 4
Components:
Transform Component:
Translate: {x: 0.00451920554, y: 0.829197884, z: 1.75}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 0.999979734, y: 1, z: 0.999979734}
IsActive: true
Renderable Component:
Mesh: 140964851
Material: 126974645
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 0.200000003, y: 0.100000001, z: 0.200000003}
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:
- Type: Breakable
Enabled: true
threshHold: 0
force: 1
- EID: 4
Name: Piece1
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 3.2922253e-07, y: 0, z: -0.0171992779}
Rotate: {x: -1.31316483e-07, y: 3.60887498e-09, z: 5.27542454e-11}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 146557542
Material: 124370424
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 0.100000001, y: 0.0500000007, z: 0.150000006}
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: Piece2
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.47731805e-07, y: 0, z: 0.0325666666}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 145439064
Material: 124370424
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 0.100000001, y: 0.0500000007, z: 0.200000003}
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: Piece3
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -0.0502781346, y: 1.18017197e-05, z: 6.97374344e-05}
Rotate: {x: 0.021297913, y: 0.00146768149, z: -5.48749846e-08}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 139411134
Material: 124370424
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 0.100000001, y: 0.0500000007, z: 0.150000006}
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: Piece4
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.0364143178, y: 7.39097595e-06, z: 6.61611557e-05}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 136742160
Material: 124370424
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 0.100000001, y: 0.0500000007, z: 0.150000006}
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: 3
Name: Ground
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -0.414889663, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 5, y: 1, z: 5}
IsActive: true
RigidBody Component:
Type: Static
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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

@ -0,0 +1,3 @@
Name: Breakables
ID: 85040588
Type: 5

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
Name: Environment
ID: 91553073
Type: 5

View File

@ -0,0 +1,71 @@
- EID: 0
Name: Light
IsActive: true
NumberOfChildren: 0
Components:
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Directional
Direction: {x: 0, y: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0
IsActive: true
Scripts: ~
- EID: 1
Name: Canvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
IsActive: true
Scripts: ~
- EID: 2
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 123313564
IsActive: true
Scripts: ~
- EID: 3
Name: Camera
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0, y: 0, z: 0}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1920
Height: 1080
Near: 0.00999999978
Far: 10000
Perspective: true
IsActive: true
Scripts: ~
- EID: 4
Name: Default
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: EndScene
Enabled: true
mainGameScene: 86098106
mainMainScene: 97158628

View File

@ -0,0 +1,3 @@
Name: LoseScene
ID: 91685359
Type: 5

View File

@ -4,7 +4,7 @@
NumberOfChildren: 0
Components:
Camera Component:
Position: {x: 0, y: 0, z: 8}
Position: {x: 0, y: 3, z: 8}
Pitch: 0
Yaw: 0
Roll: 0
@ -13,6 +13,7 @@
Near: 0.00999999978
Far: 10000
Perspective: true
IsActive: true
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Directional
@ -20,6 +21,7 @@
Color: {x: 0.951541841, y: 0.921719015, z: 0.553319454, w: 1}
Layer: 4294967295
Strength: 0
IsActive: true
Scripts: ~
- EID: 7
Name: BigBoi
@ -30,9 +32,11 @@
Translate: {x: 0, y: -16.8647861, z: -14.039052}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 28.1434975, y: 28.1434975, z: 28.1434975}
IsActive: true
Renderable Component:
Mesh: 149697411
Material: 126974645
IsActive: true
Scripts: ~
- EID: 8
Name: AmbientLight
@ -46,4 +50,327 @@
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0.25
IsActive: true
Scripts: ~
- EID: 65542
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.5, y: 0.5, z: -2.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 65538
Name: Movable
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 4.28833103, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 0, z: 1}
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 65537
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 5.25, y: 2.75, z: 2.5}
Rotate: {x: 0, y: 0, z: 1.57079637}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 9
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 5.25, y: 2.75, z: -2.5}
Rotate: {x: 0, y: 0, z: 1.57079637}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 10
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -5.25, y: 2.75, z: 2.5}
Rotate: {x: 0, y: 0, z: 1.57079637}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 11
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -5.25, y: 2.75, z: -2.5}
Rotate: {x: 0, y: 0, z: 1.57079637}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 12
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.5, y: 2.75, z: 5.25}
Rotate: {x: 7.15255737e-07, y: 1.57079566, z: 1.57079589}
Scale: {x: 4.99999809, y: 0.499999762, z: 4.99999809}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 65551
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -2.5, y: 2.75, z: 5.25}
Rotate: {x: 7.15255737e-07, y: 1.57079566, z: 1.57079589}
Scale: {x: 4.99999809, y: 0.499999762, z: 4.99999809}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 65550
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -2.5, y: 2.75, z: -5.25}
Rotate: {x: 7.15255737e-07, y: 1.57079566, z: 1.57079589}
Scale: {x: 4.99999809, y: 0.499999762, z: 4.99999809}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 65549
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.5, y: 2.75, z: -5.25}
Rotate: {x: 7.15255737e-07, y: 1.57079566, z: 1.57079589}
Scale: {x: 4.99999809, y: 0.499999762, z: 4.99999809}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 16
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 2.5, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 2.5, y: 0.5, z: 2.5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 5
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.5, y: 0.5, z: 2.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 4
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -2.5, y: 0.5, z: -2.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~
- EID: 3
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -2.5, y: 0.5, z: 2.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 5, y: 0.5, z: 5}
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
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: ~

9633
Assets/Scenes/MainGame.shade Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
Name: MainGame
ID: 86098106
Type: 5

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
Name: MainGameWithAI
ID: 96052853
Type: 5

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
Name: MainGameWithAIFixed
ID: 89830755
Type: 5

View File

@ -0,0 +1,69 @@
- EID: 0
Name: Canvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
IsActive: true
Scripts: ~
- EID: 1
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 121834459
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: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0
IsActive: true
Scripts: ~
- EID: 3
Name: Camera
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0, y: 0, z: 0}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1920
Height: 1080
Near: 0.00999999978
Far: 10000
Perspective: true
IsActive: true
Scripts: ~
- EID: 4
Name: Default
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: MainMenu
Enabled: true

View File

@ -0,0 +1,3 @@
Name: MainMenu
ID: 97158628
Type: 5

View File

@ -0,0 +1,74 @@
- EID: 0
Name: Mesh_Homeowner
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -1}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 140697366
Material: 129495479
IsActive: true
Scripts: ~
- EID: 1
Name: Light_Ambient
IsActive: true
NumberOfChildren: 0
Components:
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Ambient
Direction: {x: 0, y: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 1
IsActive: true
Scripts: ~
- EID: 2
Name: Mesh_Apple
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 144128170
Material: 131956078
IsActive: true
Scripts: ~
- EID: 3
Name: Mesh_Cheese
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.5, y: 0, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 141841143
Material: 131956078
IsActive: true
Scripts: ~
- EID: 4
Name: Mesh_Meat
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1, y: 0, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 136892700
Material: 131956078
IsActive: true
Scripts: ~

View File

@ -0,0 +1,3 @@
Name: MeshImport
ID: 95609584
Type: 5

View File

@ -39,11 +39,11 @@
IsActive: true
RigidBody Component:
Type: Static
Mass: 1
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
@ -60,6 +60,7 @@
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 2
@ -68,9 +69,9 @@
NumberOfChildren: 3
Components:
Transform Component:
Translate: {x: -18.9007454, y: -3.67369723, z: -5.23871422}
Rotate: {x: -0, y: 0, z: 0}
Scale: {x: 2, y: 2, z: 2}
Translate: {x: -0.0897406489, y: -4.07369709, z: 3.6087606}
Rotate: {x: 0, y: -0.19268477, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 149697411
@ -78,11 +79,11 @@
IsActive: true
RigidBody Component:
Type: Dynamic
Mass: 1
Drag: 2
Angular Drag: 0
Use Gravity: false
Interpolate: false
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
@ -94,19 +95,21 @@
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 1, y: 1, z: 1}
Half Extents: {x: 0.5, y: 0.699999988, z: 0.5}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
Position Offset: {x: 0, y: 0.300000012, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts:
- Type: PlayerController
Enabled: true
currentState: 0
maxMoveVel: 4
moveForce: 50
sprintMultiplier: 1.5
rotationFactorPerFrame: 1
rotationFactorPerFrame: 4
maxJumpHeight: 4
maxJumpTime: 0.75
fallMultipler: 2
@ -114,16 +117,22 @@
mediumMultiper: 0.5
heavyMultiper: 0.25
- Type: PickAndThrow
holdPosition: [0, 1.20000005, 0]
throwForce: [200, 300, 200]
Enabled: true
throwForce: [300, 300, 300]
delayTimer: 1
aimingLength: 1.5
- Type: StateMachine
Enabled: true
currentStateName: ""
currentAnimName: ""
- EID: 3
Name: Default
Name: HoldingPoint
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 1.20000005, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Translate: {x: 0, y: 1.20000005, z: 0.5}
Rotate: {x: 0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Scripts: ~
@ -134,13 +143,13 @@
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: -0.785401046, y: 1.65799224, z: 0}
Rotate: {x: -0.738241911, y: 0.48064509, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: -18.9007454, y: -3.67369723, z: -5.23871422}
Pitch: -45.000164
Yaw: 94.9959564
Position: {x: -0.0897406489, y: -4.07369709, z: 3.6087606}
Pitch: -42.2981453
Yaw: 16.4989109
Roll: 0
Width: 1920
Height: 1080
@ -150,6 +159,7 @@
IsActive: true
Scripts:
- Type: SHADE_Scripting.ThirdPersonCamera
Enabled: true
armLength: 2
turnSpeedPitch: 0.300000012
turnSpeedYaw: 0.5
@ -175,8 +185,8 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -8, y: -4.42369843, z: 2.5}
Rotate: {x: -0, y: 0, z: 0}
Translate: {x: -8, y: -4.42369699, z: 3.65323806}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
@ -185,11 +195,11 @@
IsActive: true
RigidBody Component:
Type: Dynamic
Mass: 1
Drag: 0
Angular Drag: 0
Use Gravity: true
Interpolate: false
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
@ -206,6 +216,7 @@
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
- EID: 7
@ -249,11 +260,11 @@
IsActive: true
RigidBody Component:
Type: Static
Mass: 1
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
@ -266,16 +277,17 @@
IsActive: true
Scripts:
- Type: GameManager
Enabled: true
itemPool: 12
zonePool: 51000
zonePool: 15
currGameState: 0
totalItemCount: -202
Score: 204
timer: 0
totalItemCount: 0
Score: 0
timer: 50
- EID: 12
Name: ItemPool
IsActive: true
NumberOfChildren: 2
NumberOfChildren: 3
Components: ~
Scripts: ~
- EID: 10
@ -284,8 +296,8 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 3.19870043, y: -3.67369723, z: -5}
Rotate: {x: -0, y: 0, z: 0}
Translate: {x: 3.19896913, y: -3.66431332, z: -4.99997139}
Rotate: {x: -1.57956983e-05, y: 2.20007223e-06, z: -0.000548519194}
Scale: {x: 2, y: 2, z: 2}
IsActive: true
Renderable Component:
@ -294,17 +306,17 @@
IsActive: true
RigidBody Component:
Type: Dynamic
Mass: 1
Drag: 0
Angular Drag: 0
Drag: 0.100000001
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: false
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: true
Freeze Rotation Y: true
Freeze Rotation Z: true
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
@ -315,6 +327,7 @@
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: true
Type: Box
Half Extents: {x: 2, y: 2, z: 2}
@ -322,9 +335,11 @@
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts:
- Type: Item
Enabled: true
Score: 1
currCategory: 0
- EID: 5
@ -333,49 +348,100 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -20.6163979, y: -0.0419634879, z: -5.08873653}
Rotate: {x: -0, y: 0, z: 0}
Scale: {x: 2, y: 2, z: 2}
IsActive: false
Translate: {x: -5.02078056, y: -4.17369747, z: -2.14891005}
Rotate: {x: -2.95397289e-08, y: 0.00065473502, z: -4.44611992e-08}
Scale: {x: 1.99998975, y: 2, z: 1.99998975}
IsActive: true
Renderable Component:
Mesh: 144838771
Material: 123745521
IsActive: false
IsActive: true
RigidBody Component:
Type: Dynamic
Mass: 1
Drag: 0
Angular Drag: 0
Drag: 0.100000001
Angular Drag: 0.100000001
Use Gravity: true
Interpolate: false
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: true
Freeze Rotation Y: true
Freeze Rotation Z: true
IsActive: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 0.5, y: 0.5, z: 0.5}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: true
Type: Box
Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
- Is Trigger: true
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts:
- Type: Item
Enabled: true
Score: 1
currCategory: 0
- EID: 16
Name: Mesh_Apple
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -2.57231402, y: -3.27855849, z: 0}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 144128170
Material: 131956078
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Type: Box
Half Extents: {x: 2, y: 2, z: 2}
Half Extents: {x: 0.100000001, y: 0.100000001, z: 0.100000001}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
IsActive: false
Scripts:
- Type: Item
Score: 1
currCategory: 0
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: true
Type: Box
Half Extents: {x: 0.300000012, y: 0.300000012, z: 0.300000012}
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: 15
Name: ScoreZonePool
IsActive: true
@ -388,17 +454,17 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -24.5947151, y: -3.15127993, z: -3.29243231}
Rotate: {x: 0, y: 0, z: 0}
Translate: {x: -24.4654179, y: -3.15127993, z: -3.29243231}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
RigidBody Component:
Type: Static
Mass: 1
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
@ -415,8 +481,11 @@
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
Scripts:
- Type: ScoringZone
Enabled: true
- EID: 14
Name: ScoreZone
IsActive: true
@ -429,11 +498,11 @@
IsActive: true
RigidBody Component:
Type: Static
Mass: 1
Drag: 0.00999999978
Angular Drag: 0.00999999978
Use Gravity: true
Interpolate: true
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
@ -450,5 +519,8 @@
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Scripts: ~
Scripts:
- Type: ScoringZone
Enabled: true

View File

@ -0,0 +1,84 @@
- EID: 0
Name: Canvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 10
Canvas Height: 10
IsActive: true
Scripts: ~
- EID: 6
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 0
Hovered Texture: 0
Clicked Texture: 0
IsActive: true
Scripts: ~
- EID: 1
Name: Camera
IsActive: true
NumberOfChildren: 0
Components:
Camera Component:
Position: {x: 0, y: 3, z: 8}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1920
Height: 1080
Near: 0.00999999978
Far: 10000
Perspective: true
IsActive: true
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Directional
Direction: {x: 1.79999995, y: 0, z: 1}
Color: {x: 0.951541841, y: 0.921719015, z: 0.553319454, w: 1}
Layer: 4294967295
Strength: 0
IsActive: true
Scripts: ~
- EID: 7
Name: BigBoi
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -16.8647861, z: -14.039052}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 28.1434975, y: 28.1434975, z: 28.1434975}
IsActive: true
Renderable Component:
Mesh: 149697411
Material: 126974645
IsActive: true
Scripts: ~
- EID: 8
Name: AmbientLight
IsActive: true
NumberOfChildren: 0
Components:
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Ambient
Direction: {x: 0, y: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0.25
IsActive: true
Scripts: ~

View File

@ -0,0 +1,3 @@
Name: UI_Test
ID: 87707373
Type: 5

View File

@ -0,0 +1,71 @@
- EID: 0
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Directional
Direction: {x: 0, y: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0
IsActive: true
Scripts: ~
- EID: 1
Name: Canvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
IsActive: true
Scripts: ~
- EID: 2
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129138332
IsActive: true
Scripts: ~
- EID: 3
Name: Camera
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0, y: 0, z: 0}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1920
Height: 1080
Near: 0.00999999978
Far: 10000
Perspective: true
IsActive: true
Scripts: ~
- EID: 4
Name: Default
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: EndScene
Enabled: true
mainGameScene: 86098106
mainMainScene: 97158628

View File

@ -0,0 +1,3 @@
Name: WinScene
ID: 92009475
Type: 5

View File

@ -1,183 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using SHADE;
public class AIPrototype : Script
{
//This object's relevant components
private Transform transform;
private RigidBody rb;
/*[SerializeField]
[Tooltip("The list of waypoints that the object will move around on")]
private Vector3[] waypoints;*/
private Vector3[] waypoints = { new Vector3(-8.0f, -2.0f, 3.5f), new Vector3(-8.0f, -2.0f, -13.0f), new Vector3(8.0f, -2.0f, -13.0f), new Vector3(8.0f, -2.0f, 3.5f) };
[SerializeField]
[Tooltip("How much force is applied in movement")]
private float movementForceMultiplier = 100.0f;
[SerializeField]
[Tooltip("How fast the object moves about waypoints")]
private float patrolSpeed = 0.4f;
[SerializeField]
[Tooltip("How fast the object moves while chasing")]
private float chaseSpeed = 0.8f;
[SerializeField]
[Tooltip("How near the player must be to the AI for capture")]
private float distanceToCapture = 1.2f;
[SerializeField]
[Tooltip("How near the player must be for the chase to begin. Should be less than distanceToEndChase")]
private float distanceToStartChase = 2.0f;
[SerializeField]
[Tooltip("How far the player must be for the chase to end. Should be greater than distanceToStartChase")]
private float distanceToEndChase = 2.5f;
//Whether the AI is chasing or not
private bool chaseMode;
//To cycle depending on the length of waypoints
private int currentTargetWaypointIndex;
private GameObject? player;
protected override void awake()
{
transform = GetComponent<Transform>();
if (transform == null)
{
Debug.LogError("Transform is NULL!");
}
rb = GetComponent<RigidBody>();
if (rb == null)
{
Debug.LogError("Rigidbody is NULL!");
}
currentTargetWaypointIndex = 0;
player = GameObject.Find("Player");
if (player == null)
{
Debug.LogError("Player is NULL!");
}
chaseMode = false;
}
protected override void fixedUpdate()
{
//Patrolling
if (!chaseMode)
{
//Head towards the next target
Vector3 normalisedDifference = waypoints[currentTargetWaypointIndex] - transform.GlobalPosition;
normalisedDifference /= normalisedDifference.GetMagnitude();
//transform.GlobalPosition += normalisedDifference * moveSpeed * (float)Time.DeltaTime;
//rb.LinearVelocity = normalisedDifference * patrolSpeed;
//ORIGINAL INTENDED CODE
/*rb.AddForce(new Vector3(normalisedDifference.x, 0.0f, normalisedDifference.z) * movementForceMultiplier);
float currentSpeed = MathF.Sqrt(rb.LinearVelocity.x * rb.LinearVelocity.x + rb.LinearVelocity.z * rb.LinearVelocity.z);
if (currentSpeed > patrolSpeed)
{
float adjustmentFactor = patrolSpeed / currentSpeed;
Vector3 adjustedVelocity = rb.LinearVelocity;
//adjustedVelocity *= adjustmentFactor;
adjustedVelocity.x = patrolSpeed;
adjustedVelocity.z = patrolSpeed;
rb.LinearVelocity = adjustedVelocity;
}*/
//TODO delete this when original intended code above works with velocity being limited correctly
rb.LinearVelocity = normalisedDifference * patrolSpeed;
//transform.GlobalRotation.SetLookRotation(waypoints[currentTargetWaypointIndex], Vector3.Up);
//Cycle to next waypoint if near enough current waypoint
if ((waypoints[currentTargetWaypointIndex] - transform.GlobalPosition).GetSqrMagnitude() <= 0.5f)
{
++currentTargetWaypointIndex;
if (currentTargetWaypointIndex >= waypoints.Length)
{
currentTargetWaypointIndex = 0; //Recycle
}
}
//Go chase if near enough to player
if (player != null)
{
Transform pTransform = player.GetValueOrDefault().GetComponent<Transform>();
if ((pTransform.GlobalPosition - transform.GlobalPosition).GetMagnitude() <= distanceToStartChase)
{
//Start the chase
chaseMode = true;
}
}
}
else //Chasing
{
if (player != null)
{
Transform pTransform = player.GetValueOrDefault().GetComponent<Transform>();
//Chase the player
Vector3 normalisedDifference = pTransform.GlobalPosition - transform.GlobalPosition;
normalisedDifference /= normalisedDifference.GetMagnitude();
//transform.GlobalPosition += normalisedDifference * moveSpeed * (float)Time.DeltaTime;
//ORIGINAL INTENDED CODE
/*rb.AddForce(new Vector3(normalisedDifference.x, 0.0f, normalisedDifference.z) * movementForceMultiplier);
float currentSpeed = MathF.Sqrt(rb.LinearVelocity.x * rb.LinearVelocity.x + rb.LinearVelocity.z * rb.LinearVelocity.z);
if (currentSpeed > chaseSpeed)
{
float adjustmentFactor = chaseSpeed / currentSpeed;
Vector3 adjustedVelocity = rb.LinearVelocity;
adjustedVelocity *= adjustmentFactor;
rb.LinearVelocity = adjustedVelocity;
}*/
//TODO delete this when original intended code above works with velocity being limited correctly
rb.LinearVelocity = normalisedDifference * chaseSpeed;
//Capture player if near enough
if ((pTransform.GlobalPosition - transform.GlobalPosition).GetMagnitude() <= distanceToCapture)
{
player.GetValueOrDefault().GetScript<PlayerController>().currentState = PlayerController.RaccoonStates.CAUGHT;
}
//End chase if too far
if ((pTransform.GlobalPosition - transform.GlobalPosition).GetMagnitude() >= distanceToEndChase)
{
//Stop the chase
chaseMode = false;
//Find the nearest waypoint to go instead
float nearestWaypointDistance = 99999999999999.9f;
for (int i = 0; i < waypoints.Length; ++i)
{
if ((waypoints[i] - transform.GlobalPosition).GetSqrMagnitude() < nearestWaypointDistance)
{
nearestWaypointDistance = waypoints[i].GetSqrMagnitude();
currentTargetWaypointIndex = i;
}
}
}
}
}
}
}

View File

@ -1,3 +0,0 @@
Name: AIPrototype
ID: 163215061
Type: 9

View File

@ -1,23 +0,0 @@
using SHADE;
using System;
public class CameraFix : Script
{
private Transform tranform;
public Vector3 pos = Vector3.Zero;
public Vector3 rot = Vector3.Zero;
protected override void awake()
{
tranform = GetComponent<Transform>();
if (tranform == null)
Debug.LogError("tranform is NULL!");
else
{
tranform.LocalPosition = pos;
tranform.LocalEulerAngles = rot;
}
}
}

View File

@ -1,3 +0,0 @@
Name: CameraFix
ID: 162231964
Type: 9

View File

@ -0,0 +1,96 @@
/*********************************************************************
* \file BehaviourTree.cs
* \author Ryan Wang Nian Jing
* \brief Based off Kheng Ian's SC_BTTree.cs
* Abstract class to be inherited as the "core" of any entity's AI
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using SHADE;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.AIBehaviour.BehaviourTree
{
public abstract partial class BehaviourTree : Script
{
//The root of the tree, it should not have any parent
private BehaviourTreeNode _root = null;
protected BehaviourTreeNode root { get => _root; set => _root = value; }
//Events of the behaviour tree
public abstract BehaviourTreeEvents events { get; }
//Dictionary containing every single node in the tree
//Key is the node's unique name
public Dictionary<string, BehaviourTreeNode> nodeDictionary = new Dictionary<string, BehaviourTreeNode>();
//When inheriting from the class, this is where you would define your tree structure
//Very important
//Override this to construct the behaviour tree of any AI
protected abstract BehaviourTreeNode CreateTree();
//awake and update functions
//the only segment in the entire AI that is dependent on the engine
protected override void awake()
{
_root = CreateTree();
_root.InitialiseNode(this);
Initialise();
}
protected override void update()
{
_root?.Evaluate();
Tick();
}
protected abstract void Initialise();
protected abstract void Tick();
}
//BLACKBOARD SYSTEM///////////////////////////////////////////////////////////
//Shared data within the tree, implemented as a dictionary of objects
public abstract partial class BehaviourTree : Script
{
//Data to be shared among nodes
public Dictionary<string, object> blackboard = new Dictionary<string, object>();
//Getters and setters for the blackboard
public object GetData(string key)
{
//Debug.Log("Getting Data " + key);
object outData = null;
if (blackboard.TryGetValue(key, out outData))
{
return outData;
}
else
{
//Debug.LogError("Cannot retrieve data " + key);
return outData;
}
}
public void SetData(string key, object data)
{
blackboard[key] = data;
}
public bool ClearData(string key)
{
if (blackboard.ContainsKey(key))
{
blackboard.Remove(key);
return true;
}
else
return false;
}
}
}

View File

@ -0,0 +1,3 @@
Name: BehaviourTree
ID: 156799455
Type: 9

View File

@ -0,0 +1,59 @@
/*********************************************************************
* \file BehaviourTreeEvents.cs
* \author Ryan Wang Nian Jing
* \brief Based off Kheng Ian's SC_BTEvents.cs
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace SHADE_Scripting.AIBehaviour.BehaviourTree
{
public abstract class BehaviourTreeEvents
{
public BehaviourTree tree;
public BehaviourTreeEvents(BehaviourTree tree)
{
this.tree = tree;
}
//Called at the start
public abstract void Initialise();
//Called at every tick
public abstract void Tick();
public void OnEnterAddListener(string name, Delegate action)
{
BehaviourTreeNode targetNode;
tree.nodeDictionary.TryGetValue(name, out targetNode);
targetNode.onEnterEvent += (EventHandler)action;
}
public void OnExitAddListener(string name, Delegate action)
{
BehaviourTreeNode targetNode;
tree.nodeDictionary.TryGetValue(name, out targetNode);
targetNode.onExitEvent += (EventHandler)action;
}
public void OnEnterRemoveListener(string name, Delegate action)
{
BehaviourTreeNode targetNode;
tree.nodeDictionary.TryGetValue(name, out targetNode);
targetNode.onEnterEvent -= (EventHandler)action;
}
public void OnExitRemoveListener(string name, Delegate action)
{
BehaviourTreeNode targetNode;
tree.nodeDictionary.TryGetValue(name, out targetNode);
targetNode.onExitEvent -= (EventHandler)action;
}
}
}

View File

@ -0,0 +1,3 @@
Name: BehaviourTreeEvents
ID: 157306586
Type: 9

View File

@ -0,0 +1,143 @@
/*********************************************************************
* \file BehaviourTreeNode.cs
* \author Ryan Wang Nian Jing
* \brief Based off Kheng Ian's SC_BTNode.cs
* Abstract implementation of individual nodes of a behaviour tree
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.AIBehaviour.BehaviourTree
{
//ENUMERATIONS FOR NODE STATUS////////////////////////////////////////////////
public enum BehaviourTreeNodeStatus
{
RUNNING, //Node has not finished evaluating, to be re-evaluated
SUCCESS, //Node has been evaluated to be a success
FAILURE //Node has been evaluated to be a failure
}
//CORE TRAVERSAL SYSTEM OF BEHAVIOUR TREE/////////////////////////////////////
public partial class BehaviourTreeNode
{
//The main tree structure that the node is in
//This needs to be specified by the root node so that it can permutate to its children
public BehaviourTree tree;
//This portion functions similar to a doubly-linked list,
//only having a list of children instead of a single reference
public BehaviourTreeNode parent;
protected List<BehaviourTreeNode> children = new List<BehaviourTreeNode>();
//Current status of the node
//Technically redundant as nodes already return their status via the
//Evaluate() function
protected BehaviourTreeNodeStatus status;
//Constructors, to be overriden by its children as needed
public BehaviourTreeNode(string name)
{
this.name = name;
parent = null;
}
public BehaviourTreeNode(string name, List<BehaviourTreeNode> children)
{
this.name = name;
foreach (BehaviourTreeNode child in children)
Attach(child);
}
//Attach a child node to a BT node
private void Attach(BehaviourTreeNode child)
{
child.parent = this;
children.Add(child);
}
//Very important
//Must be overriden by its derived classes (control flow / leaf / decorators)
//Defines the traversal method of the node
//Called every frame via the root from the BT
public virtual BehaviourTreeNodeStatus Evaluate()
{
throw new NotImplementedException("Missing implementation of Evaluate() function!");
}
//To attach the tree, called in the Start() tick AFTER creation of the tree
public void InitialiseNode(BehaviourTree tree)
{
this.tree = tree;
//Add itself to the tree's node dictionary
if (tree.nodeDictionary.ContainsKey(name))
throw new Exception("Node name: " + name + " is not unique! Please assign a unique name to each node!");
else
tree.nodeDictionary.Add(name, this);
//TODO initialise its events
//onEnterEvent = new
//onExitEvent = new
//Recurse InitialiseNode() in children
foreach (BehaviourTreeNode child in children)
child.InitialiseNode(tree);
}
}
//BLACKBOARD SYSTEM///////////////////////////////////////////////////////////
//To be able to access tree's data from any node in the tree
public partial class BehaviourTreeNode
{
//Getter and setter functions for blackboard data
public object GetNodeData(string key)
{
return tree.GetData(key);
}
public void SetNodeData(string key, object data)
{
tree.SetData(key, data);
}
//Removes blackboard data of name key
public bool ClearNodeData(string key)
{
return tree.ClearData(key);
}
}
//EVENT/CALLBACK SYSTEM///////////////////////////////////////////////////////
public class BehaviourTreeEventArgs : System.EventArgs
{
public BehaviourTreeNodeStatus returnStatus { get; set; }
public BehaviourTreeEventArgs(BehaviourTreeNodeStatus status) { returnStatus = status; }
}
public partial class BehaviourTreeNode
{
//Mainly used for the callback system
//"name" must be unique to each node instance
//Events must be replaced by custom engine counterpart
public string name;
public System.EventHandler onEnterEvent;
public System.EventHandler onExitEvent;
public void onEnter(BehaviourTreeNodeStatus status)
{
onEnterEvent?.Invoke(this, new BehaviourTreeEventArgs(status));
}
public void onExit(BehaviourTreeNodeStatus status)
{
onExitEvent?.Invoke(this, new BehaviourTreeEventArgs(status));
}
}
}

View File

@ -0,0 +1,3 @@
Name: BehaviourTreeNode
ID: 159032454
Type: 9

View File

@ -0,0 +1,52 @@
/*********************************************************************
* \file BehaviourTreeSelector.cs
* \author Ryan Wang Nian Jing
* \brief Based off Kheng Ian's SC_BTSelector.cs
* Selectors function like "OR" nodes, returning success on the
* first successful child and stopping operation
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.AIBehaviour.BehaviourTree
{
public class BehaviourTreeSelector : BehaviourTreeNode
{
public BehaviourTreeSelector(string name) : base(name) { }
public BehaviourTreeSelector(string name, List<BehaviourTreeNode> children) :
base(name, children)
{ }
public override BehaviourTreeNodeStatus Evaluate()
{
onEnter(BehaviourTreeNodeStatus.RUNNING);
for (int i = 0; i < children.Count; ++i)
{
switch (children[i].Evaluate())
{
case BehaviourTreeNodeStatus.RUNNING:
status = BehaviourTreeNodeStatus.RUNNING;
onExit(BehaviourTreeNodeStatus.RUNNING);
return status;
case BehaviourTreeNodeStatus.SUCCESS:
status = BehaviourTreeNodeStatus.SUCCESS;
onExit(BehaviourTreeNodeStatus.SUCCESS);
return status;
case BehaviourTreeNodeStatus.FAILURE:
continue;
}
}
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
}
}

View File

@ -0,0 +1,3 @@
Name: BehaviourTreeSelector
ID: 167568513
Type: 9

View File

@ -0,0 +1,56 @@
/*********************************************************************
* \file BehaviourTreeSequence.cs
* \author Ryan Wang Nian Jing
* \brief Based off Kheng Ian's SC_BTSelector.cs
* Sequences function like "AND" nodes, having to process every child
* successfully to return a success. Returns a failure on the first
* child that fails
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.AIBehaviour.BehaviourTree
{
public class BehaviourTreeSequence : BehaviourTreeNode
{
public BehaviourTreeSequence(string name) : base(name) { }
public BehaviourTreeSequence(string name, List<BehaviourTreeNode> children) :
base(name, children) { }
public override BehaviourTreeNodeStatus Evaluate()
{
{
onEnter(BehaviourTreeNodeStatus.RUNNING);
for (int i = 0; i < children.Count; ++i)
{
switch (children[i].Evaluate())
{
case BehaviourTreeNodeStatus.SUCCESS:
continue;
case BehaviourTreeNodeStatus.RUNNING:
status = BehaviourTreeNodeStatus.RUNNING;
onExit(BehaviourTreeNodeStatus.RUNNING);
return status;
case BehaviourTreeNodeStatus.FAILURE:
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
}
status = BehaviourTreeNodeStatus.SUCCESS;
onExit(BehaviourTreeNodeStatus.SUCCESS);
return status;
}
}
}
}

View File

@ -0,0 +1,3 @@
Name: BehaviourTreeSequence
ID: 154302585
Type: 9

View File

@ -0,0 +1,173 @@
/*********************************************************************
* \file Homeowner1.cs
* \author Ryan Wang Nian Jing
* \brief The implemented behaviour tree for the homeowner
* A prototype to prove that behaviour trees can be worked and expanded
* on in the custom engine for GAM300 Milestone 3 and expanded over
* GAM350
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
//Variables required for the AI to function
//To be attached to the game object via the inspector
public partial class Homeowner1 : BehaviourTree
{
private BehaviourTreeEvents _events { get; set; }
public override BehaviourTreeEvents events { get => _events; }
//PATROL FIELDS///////////////////////////////////////////////////////////////
[SerializeField]
[Tooltip("The list of waypoints for the AI to cycle around")]
private GameObject waypointsPool;
private List<GameObject> waypoints;
[SerializeField]
[Tooltip("The AI will patrol at this speed")]
private float patrolSpeed;
[SerializeField]
[Tooltip("The speed at which the AI will chase the player if sighted")]
private float chaseSpeed;
[SerializeField]
[Tooltip("Turning speed multiplier of the AI. 10 is good")]
private float turningSpeed;
//FIELD OF VISION/////////////////////////////////////////////////////////////
[SerializeField]
[Tooltip("How far the AI can see up to")]
private float sightDistance;
[SerializeField]
[Tooltip("How far the eyes are offset from the AI's actual position")]
private Vector3 eyeOffset;
//ATTACKING///////////////////////////////////////////////////////////////////
[SerializeField]
[Tooltip("How near the player mut be to the AI for capture")]
private float distanceToCapture;
[SerializeField]
[Tooltip("How long the player should be in the attack range for successful capture")]
private float captureTime;
//There's definitely a better way to do this
[SerializeField]
[Tooltip("TO BE REMOVED IN 350. Interval multiplier between footsteps")]
private float footstepSFXIntervalMultiplier;
private float footstepTimeRemaining;
}
//AI tree
public partial class Homeowner1 : BehaviourTree
{
//Called at the start
protected override void Initialise()
{
_events = new Homeowner1Events(this);
events.Initialise();
//(25 Nov) DO NOT Initialise the data here
/*if (waypointsPool)
{
waypoints = (List<GameObject>)waypointsPool.GetChildren();
SetData("waypoints", waypoints);
}
SetData("transform", GetComponent<Transform>());
SetData("rigidBody", GetComponent<RigidBody>());
SetData("eyeOffset", eyeOffset);
SetData("sightDistance", sightDistance);
SetData("patrolSpeed", patrolSpeed);
SetData("chaseSpeed", chaseSpeed);
SetData("turningSpeed", turningSpeed);
SetData("distanceToCapture", distanceToCapture);
SetData("baseCaptureTime", captureTime);*/
}
//Called every tick
protected override void Tick()
{
//Debug.Log("Ticking");
//Update data
if (GetData("waypoints") == null)
{
if (waypointsPool != GameObject.Null)
SetData("waypoints", (List<GameObject>)waypointsPool.GetChildren());
else
Debug.LogError("No waypoints, no AI");
}
if (GetData("transform") == null)
SetData("transform", GetComponent<Transform>());
if (GetData("rigidBody") == null)
SetData("rigidBody", GetComponent<RigidBody>());
if (GetData("eyeOffset") == null || (Vector3)GetData("eyeOffset") != eyeOffset)
SetData("eyeOffset", eyeOffset);
if (GetData("sightDistance") == null || (float)GetData("sightDistance") != sightDistance)
SetData("sightDistance", sightDistance);
if (GetData("patrolSpeed") == null || (float)GetData("patrolSpeed") != patrolSpeed)
SetData("patrolSpeed", patrolSpeed);
if (GetData("chaseSpeed") == null || (float)GetData("chaseSpeed") != chaseSpeed)
SetData("chaseSpeed", chaseSpeed);
if (GetData("turningSpeed") == null || (float)GetData("turningSpeed") != turningSpeed)
SetData("turningSpeed", turningSpeed);
if (GetData("distanceToCapture") == null || (float)GetData("distanceToCapture") != distanceToCapture)
SetData("distanceToCapture", distanceToCapture);
if (GetData("baseCaptureTime") == null || (float)GetData("baseCaptureTime") != captureTime)
SetData("baseCaptureTime", captureTime);
events.Tick();
//Footsteps SFX, move them somewhere else soon
float velocity = GetComponent<RigidBody>().LinearVelocity.GetMagnitude();
footstepTimeRemaining -= velocity * Time.DeltaTimeF;
if (footstepTimeRemaining < 0.0f)
{
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_footsteps");
footstepTimeRemaining = footstepSFXIntervalMultiplier;
}
//Debug.Log("Ticked");
}
//Define the behaviour tree here
//Order of which nodes are created affects order of execution
//The tree is called from the root every tick
protected override BehaviourTreeNode CreateTree()
{
//Debug.Log("Creating Tree");
//Start from the root, structure it like this to make it look like a tree
BehaviourTreeNode root = new BehaviourTreeSelector("Root", new List<BehaviourTreeNode>
{
new BehaviourTreeSequence("Alerted", new List<BehaviourTreeNode>
{
new LeafSearch("SearchFOV"),
new BehaviourTreeSequence("CatchPlayer", new List<BehaviourTreeNode>
{
new LeafChase("Chasing"),
new LeafAttack("Attacking")
})
}),
new LeafPatrol("Patrol")
});
//Debug.Log("Tree Created");
return root;
}
}

View File

@ -0,0 +1,3 @@
Name: Homeowner1
ID: 159563628
Type: 9

View File

@ -0,0 +1,36 @@
/*********************************************************************
* \file Homeowner1Events.cs
* \author Ryan Wang Nian Jing
* \brief The implemented events for the homeowner
* Presently unused for GAM300
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using SHADE_Scripting.AIBehaviour.BehaviourTree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
public partial class Homeowner1Events : BehaviourTreeEvents
{
public Homeowner1Events(BehaviourTree tree) : base(tree) { }
//Called at the start
public override void Initialise()
{
//Tree.GetNode("Search FOV").onExitEvent += (s, e) => { PlayScreamSFX(s, e); };
}
//Called at every tick
public override void Tick()
{
}
}

View File

@ -0,0 +1,3 @@
Name: Homeowner1Events
ID: 156914017
Type: 9

View File

@ -0,0 +1,109 @@
/*********************************************************************
* \file LeafAttack.cs
* \author Ryan Wang Nian Jing
* \brief Leaf node implementation for AI attacking the player
* when the AI is close enough after chasing
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//VARIABLES
public partial class LeafAttack : BehaviourTreeNode
{
//Holds the player game object that is to be targeted
private GameObject player;
}
//FUNCTIONS
public partial class LeafAttack : BehaviourTreeNode
{
public LeafAttack(string name) : base (name)
{
//Debug.Log("LeafAttack ctor");
}
//Helper, find the nearest unobstructed waypoint to return to when chase is over
public void reevaluateWaypoint()
{
List<GameObject> waypoints = (List<GameObject>)GetNodeData("waypoints");
Transform transform = (Transform)GetNodeData("transform");
if (waypoints == null || transform == null)
{
SetNodeData("currentWaypointIndex", 0);
return;
}
int nearestWaypointIndex = 0;
for (int i = 0; i < waypoints.Count; ++i)
{
if ((transform.GlobalPosition - waypoints[i].GetComponent<Transform>().GlobalPosition).GetSqrMagnitude() <
(transform.GlobalPosition - waypoints[nearestWaypointIndex].GetComponent<Transform>().GlobalPosition).GetSqrMagnitude())
{
nearestWaypointIndex = i;
}
}
SetNodeData("currentWaypointIndex", nearestWaypointIndex);
}
public override BehaviourTreeNodeStatus Evaluate()
{
//Debug.LogWarning("LeafAttack");
//Fail if no target in blackboard?
onEnter(BehaviourTreeNodeStatus.RUNNING);
//Get Data
float? captureTime;
if (GetNodeData("captureTimeLeft") == null)
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else
captureTime = (float)GetNodeData("captureTimeLeft");
if (GameObject.Find("Player") == null)
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else
player = GameObject.Find("Player").GetValueOrDefault();
//Succeed when stand in hurt box for long enough
//Debug.Log("Attempting to get blackboard data");
//Debug.Log("Got blackboard data");
captureTime -= Time.DeltaTimeF;
SetNodeData("captureTimeLeft", captureTime);
//Debug.Log(captureTime.ToString());
if (captureTime <= 0.0f)
{
//Catch player when in range for long enough
//Debug.Log("Success: Caught");
player.GetScript<PlayerController>().currentState = PlayerController.RaccoonStates.CAUGHT;
status = BehaviourTreeNodeStatus.SUCCESS;
onExit(BehaviourTreeNodeStatus.SUCCESS);
return status;
}
//Return running if not success
//Debug.Log("Running: About to capture in " + captureTimeLeft);
status = BehaviourTreeNodeStatus.RUNNING;
onExit(BehaviourTreeNodeStatus.RUNNING);
return status;
}
}

View File

@ -0,0 +1,3 @@
Name: LeafAttack
ID: 162827155
Type: 9

View File

@ -0,0 +1,194 @@
/*********************************************************************
* \file LeafChase.cs
* \author Ryan Wang Nian Jing
* \brief Leaf node implementation for AI chasing the player
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//VARIABLES
public partial class LeafChase : BehaviourTreeNode
{
//Used to move entity around
private Transform transform;
private RigidBody rb;
private float chaseSpeed;
private float turningSpeed;
private float captureDistance;
private float baseCaptureTime;
}
//FUNCTIONS
public partial class LeafChase : BehaviourTreeNode
{
//Despite inheriting from BehaviourTreeNode, we don't have children to this node,
//and hence we don't need to inherit its constructors
public LeafChase(string name) : base (name)
{
//Debug.Log("LeafChase ctor");
}
//Helper, find which waypoint player is closest to
private void determinePlayerWaypoint()
{
List<GameObject> waypoints = (List<GameObject>)GetNodeData("waypoints");
Transform target = (Transform)GetNodeData("target");
if (waypoints == null || target == null)
{
return;
}
int nearestWaypointIndex = 0;
for (int i = 0; i < waypoints.Count; ++i)
{
if ((target.GlobalPosition - waypoints[i].GetComponent<Transform>().GlobalPosition).GetSqrMagnitude() <
(target.GlobalPosition - waypoints[nearestWaypointIndex].GetComponent<Transform>().GlobalPosition).GetSqrMagnitude())
{
nearestWaypointIndex = i;
}
}
//Debug.Log("Player is nearest " + nearestWaypointIndex);
//Debug.Log("I'm at " + (int)GetNodeData("currentWaypointIndex"));
SetNodeData("playerLastSightedWaypointIndex", nearestWaypointIndex);
}
public override BehaviourTreeNodeStatus Evaluate()
{
//Debug.LogWarning("LeafChase");
onEnter(BehaviourTreeNodeStatus.RUNNING);
//Get Data
if (GetNodeData("transform") == null ||
GetNodeData("rigidBody") == null ||
GetNodeData("turningSpeed") == null ||
GetNodeData("chaseSpeed") == null ||
GetNodeData("distanceToCapture") == null ||
GetNodeData("baseCaptureTime") == null)
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else
{
transform = (Transform)GetNodeData("transform");
rb = (RigidBody)GetNodeData("rigidBody");
chaseSpeed = (float)GetNodeData("chaseSpeed");
turningSpeed = (float)GetNodeData("turningSpeed");
captureDistance = (float)GetNodeData("distanceToCapture");
baseCaptureTime = (float)GetNodeData("baseCaptureTime");
}
//Fail if no target in blackboard
if (GetNodeData("target") == null)
{
//Debug.Log("Failure: No target in blackboard");
return BehaviourTreeNodeStatus.FAILURE;
}
Transform target = (Transform)GetNodeData("target");
Vector3 normalisedDifference = target.GlobalPosition - transform.GlobalPosition;
normalisedDifference.y = 0.0f; //Do not consider Y
normalisedDifference /= normalisedDifference.GetMagnitude();
//Over maximum distance, stop chase
if ((transform.GlobalPosition - target.GlobalPosition).GetMagnitude() > 1000.0f)
{
//Debug.Log("Failure: Over maximum distance");
ClearNodeData("target");
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{
Audio.PlaySFXOnce2D("event:/Homeowner/humming");
}
SetNodeData("isAlert", false);
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else if (false) //TODO If collided against a wall
{
//Debug.Log("Running: Collided against wall");
SetNodeData("isPathfinding", true);
status = BehaviourTreeNodeStatus.RUNNING;
onExit(BehaviourTreeNodeStatus.RUNNING);
return BehaviourTreeNodeStatus.RUNNING;
}
//Keep chasing
else if ((transform.GlobalPosition - target.GlobalPosition).GetMagnitude() > captureDistance)
{
//Debug.Log("Running: Chasing");
Quaternion targetRotation = Quaternion.LookRotation(normalisedDifference, new Vector3(0.0f, 1.0f, 0.0f));
transform.LocalRotation = Quaternion.Slerp(transform.LocalRotation, targetRotation, turningSpeed * Time.DeltaTimeF);
//Determine the player's nearest waypoint as long as the AI can see the player
//Head towards that waypoint in an attempt to chase the player
determinePlayerWaypoint();
//TODO delete this when original intendd code above works with velocity being limited correctly
//Only chase the player directly if the player's waypoint matches the AI's own
if (GetNodeData("currentWaypointIndex") != null && GetNodeData("playerLastSightedWaypointIndex") != null)
{
if ((int)GetNodeData("currentWaypointIndex") == (int)GetNodeData("playerLastSightedWaypointIndex"))
{
//Debug.Log("Waypoint indicees matching. Chasing directly");
rb.LinearVelocity = normalisedDifference * chaseSpeed;
}
else
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return BehaviourTreeNodeStatus.FAILURE;
}
}
//Reset capture timing to base
SetNodeData("captureTimeLeft", baseCaptureTime);
//Not capturing, don't play SFX
SetNodeData("isCapturing", false);
status = BehaviourTreeNodeStatus.RUNNING;
onExit(BehaviourTreeNodeStatus.RUNNING);
return BehaviourTreeNodeStatus.RUNNING;
}
//Once player is close enough, perform attack
else
{
//Debug.Log("Success: Near enough. Begin attack");
//Look at the correct direction
Quaternion targetRotation = Quaternion.LookRotation(normalisedDifference, new Vector3(0.0f, 1.0f, 0.0f));
transform.LocalRotation = Quaternion.Slerp(transform.LocalRotation, targetRotation, turningSpeed * Time.DeltaTimeF);
//Play SFX
if (GetNodeData("isCapturing") != null && (bool)GetNodeData("isCapturing") == false)
{
//Debug.Log("AI Play capturing SFX");
}
SetNodeData("isCapturing", true);
//TODO resetting the capture time once it's less than 0 doesn't work as
//there is quite some time (about .1 seconds) after the timer falls below 0
//that the capture actually happens
status = BehaviourTreeNodeStatus.SUCCESS;
onExit(BehaviourTreeNodeStatus.SUCCESS);
return status;
}
}
}

View File

@ -0,0 +1,3 @@
Name: LeafChase
ID: 151301333
Type: 9

View File

@ -0,0 +1,268 @@
/*********************************************************************
* \file LeafPatrol.cs
* \author Ryan Wang Nian Jing
* \brief Leaf node implementation for patrolling AI
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//VARIABLES HERE
public partial class LeafPatrol : BehaviourTreeNode
{
//Waypoints and movement
private Transform transform;
private List<GameObject>? waypoints;
private RigidBody rb;
private float patrolSpeed;
private float chaseSpeed;
private float turningSpeed;
private float retreatTimer = 0.0f;
private int currentWaypointIndex = 0;
private bool retreatState = false;
private bool goingForwards = true;
//Small delays between waypoints
private bool isWaiting = false;
private const float waitDuration = 2.0f;
private float waitCounter = 0.0f;
}
//FUNCTIONS HERE
public partial class LeafPatrol : BehaviourTreeNode
{
//Constructor, establish values here
//Despite inheriting from BehaviourTreeNode, we don't have children to this
//node, and hence we do not need to inherit its constructors
public LeafPatrol(string name) : base(name)
{
currentWaypointIndex = 0;
}
//When it comes to evaluating,
//le this node keep returning RUNNING as it is the last fallback node on tree
public override BehaviourTreeNodeStatus Evaluate()
{
//Debug.LogWarning("LeafPatrol");
onEnter(BehaviourTreeNodeStatus.RUNNING);
//Get data
if (GetNodeData("transform") == null ||
GetNodeData("patrolSpeed") == null ||
GetNodeData("chaseSpeed") == null ||
GetNodeData("turningSpeed") == null ||
GetNodeData("rigidBody") == null)
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else
{
transform = (Transform)GetNodeData("transform");
patrolSpeed = (float)GetNodeData("patrolSpeed");
chaseSpeed = (float)GetNodeData("chaseSpeed");
turningSpeed = (float)GetNodeData("turningSpeed");
rb = (RigidBody)GetNodeData("rigidBody");
}
if (GetNodeData("currentWaypointIndex") == null)
{
SetNodeData("currentWaypointIndex", 0);
}
if (isWaiting) DelayAtWaypoint();
else MoveToWaypoint();
status = BehaviourTreeNodeStatus.RUNNING;
onExit(BehaviourTreeNodeStatus.RUNNING);
return status;
}
//Move and cycle between waypoints
private void MoveToWaypoint()
{
//Debug.Log("MoveToWaypoint");
//Waiting, do not move
if (GetNodeData("isWaiting") != null)
{
//Only wait to change waypoints if not alert
if (GetNodeData("isAlert") != null && !(bool)GetNodeData("isAlert"))
waitCounter = 0.0f;
isWaiting = true;
ClearNodeData("isWaiting");
return;
}
waypoints = (List<GameObject>)GetNodeData("waypoints");
if (waypoints == null)
{
return;
}
Vector3 targetPosition = waypoints[currentWaypointIndex].GetComponent<Transform>().GlobalPosition;
//Reach waypoint by X and Z being near enough
//Do not consider Y of waypoints yet
Vector3 remainingDistance = targetPosition - transform.GlobalPosition;
remainingDistance.y = 0.0f;
//Reached waypoint, cycle
if (remainingDistance.GetSqrMagnitude() < 0.1f)
{
//If alert, may reverse
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert"))
{
//If alert, may reverse if it's closer to the player
if (GetNodeData("playerLastSightedWaypointIndex") != null)
{
int playerWaypoint = (int)GetNodeData("playerLastSightedWaypointIndex");
int forwardDistance = 0;
int backDistance = 0;
if (playerWaypoint < currentWaypointIndex)
{
//Player waypoint is behind current waypoint
forwardDistance = playerWaypoint + waypoints.Count() - currentWaypointIndex;
backDistance = currentWaypointIndex - playerWaypoint;
}
else
{
//Player waypoint is ahead of current waypoint (or same)
forwardDistance = playerWaypoint - currentWaypointIndex;
backDistance = currentWaypointIndex + waypoints.Count() - playerWaypoint;
}
if (backDistance < forwardDistance)
{
//Go backwards
goingForwards = false;
}
else
{
//Go forward
goingForwards = true;
}
}
else
{
//Fallback if no player waypoint data, go forward
goingForwards = true;
}
}
//Cycle waypoints
if (goingForwards)
{
++currentWaypointIndex;
if (currentWaypointIndex >= waypoints.Count())
currentWaypointIndex = 0;
}
else
{
--currentWaypointIndex;
if (currentWaypointIndex < 0)
currentWaypointIndex = waypoints.Count() - 1;
}
//Write to blackboard
SetNodeData("currentWaypointIndex", currentWaypointIndex);
//Only wait to change waypoints if not alert
if (GetNodeData("isAlert") != null && !(bool)GetNodeData("isAlert"))
waitCounter = 0.0f;
isWaiting = true;
}
else if (false /*Physics.OverlapSphere(_selfTransform.position, 0.3f, 1 << 8).Length > 0 && retreatState == false*/)
{
//TODO
//This main segment is to check if the NPC is walking into a solid wall
//If they are, do a raycast to find the nearest unobstructed waypoint and head there instead
}
else //Proceed to waypoint as usual
{
//Get the difference vector to the waypoint
//Debug.Log("Current Waypoint " + waypoints[currentWaypointIndex].x.ToString() + " " + waypoints[currentWaypointIndex].y.ToString() + " " + waypoints[currentWaypointIndex].z.ToString());
//Debug.Log("AI is at " + transform.GlobalPosition.x.ToString() + " " + transform.GlobalPosition.y.ToString() + " " + transform.GlobalPosition.z.ToString());
Vector3 normalisedDifference = targetPosition - transform.GlobalPosition;
normalisedDifference.y = 0.0f; //Do not move vertically
normalisedDifference /= normalisedDifference.GetMagnitude();
//Debug.Log("Normalised Difference x " + normalisedDifference.x.ToString() + " z " + normalisedDifference.z.ToString());
//Look at the correct direction
Quaternion targetRotation = Quaternion.LookRotation(normalisedDifference, new Vector3(0.0f, 1.0f, 0.0f));
transform.LocalRotation = Quaternion.Slerp(transform.LocalRotation, targetRotation, turningSpeed * Time.DeltaTimeF);
//transform.GlobalPosition += normalisedDifference * moveSpeed * (float)Time.DeltaTime;
//rb.LinearVelocity = normalisedDifference * patrolSpeed;
//ORIGINAL INTENDED CODE
/*rb.AddForce(new Vector3(normalisedDifference.x, 0.0f, normalisedDifference.z) * movementForceMultiplier);
float currentSpeed = MathF.Sqrt(rb.LinearVelocity.x * rb.LinearVelocity.x + rb.LinearVelocity.z * rb.LinearVelocity.z);
if (currentSpeed > patrolSpeed)
{
float adjustmentFactor = patrolSpeed / currentSpeed;
Vector3 adjustedVelocity = rb.LinearVelocity;
//adjustedVelocity *= adjustmentFactor;
adjustedVelocity.x = patrolSpeed;
adjustedVelocity.z = patrolSpeed;
rb.LinearVelocity = adjustedVelocity;
}*/
//TODO delete this when original intended code above works with velocity being limited correctly
if (rb != null)
{
//Move quickly if alert
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert"))
{
//Debug.Log("Fast Patrol");
rb.LinearVelocity = normalisedDifference * chaseSpeed;
}
else
{
rb.LinearVelocity = normalisedDifference * patrolSpeed;
}
//Unalert if AI reaches player nearest
if (GetNodeData("currentWaypointIndex") != null && GetNodeData("playerLastSightedWaypointIndex") != null)
{
if ((int)GetNodeData("currentWaypointIndex") == (int)GetNodeData("playerLastSightedWaypointIndex"))
{
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert"))
{
//Debug.Log("Unalert");
Audio.PlaySFXOnce2D("event:/Homeowner/humming");
Audio.StopAllSounds();
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
}
SetNodeData("isAlert", false);
}
}
}
if (retreatState)
{
if (retreatTimer < 1.0f) retreatTimer += Time.DeltaTimeF;
else
{
retreatState = false;
retreatTimer = 1.0f;
}
}
}
}
private void DelayAtWaypoint()
{
waitCounter += Time.DeltaTimeF;
if (waitCounter >= waitDuration)
isWaiting = false;
}
}

View File

@ -0,0 +1,3 @@
Name: LeafPatrol
ID: 160826340
Type: 9

View File

@ -0,0 +1,210 @@
/*********************************************************************
* \file LeafSearch.cs
* \author Ryan Wang Nian Jing
* \brief Leaf node implementation for AI searching for player
*
*
* \copyright Copyright (c) 2022 DigiPen Institute of Technology. Reproduction
or disclosure of this file or its contents without the prior written
consent of DigiPen Institute of Technology is prohibited.
*********************************************************************/
using SHADE;
using SHADE_Scripting.AIBehaviour.BehaviourTree;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
//VARIABLES HERE
public partial class LeafSearch : BehaviourTreeNode
{
private Transform transform;
private Vector3 eyeOffset;
private float sightDistance;
private GameObject? player; //To be searched for and marked
}
//FUNCTIONS HERE
public partial class LeafSearch : BehaviourTreeNode
{
public LeafSearch(string name) : base(name)
{
//Debug.Log("LeafSearch ctor");
}
//Helper, find the nearest unobstructed waypoint to return to when chase is over
public void reevaluateWaypoint()
{
List<GameObject> waypoints = (List<GameObject>)GetNodeData("waypoints");
if (waypoints == null)
{
SetNodeData("currentWaypointIndex", 0);
return;
}
int nearestWaypointIndex = 0;
for (int i = 0; i < waypoints.Count; ++i)
{
if ((transform.GlobalPosition - waypoints[i].GetComponent<Transform>().GlobalPosition).GetSqrMagnitude() <
(transform.GlobalPosition - waypoints[nearestWaypointIndex].GetComponent<Transform>().GlobalPosition).GetSqrMagnitude())
{
nearestWaypointIndex = i;
}
}
SetNodeData("currentWaypointIndex", nearestWaypointIndex);
}
//Helper for handling being alert
//Helper for handling stopping of chases
private void handleChaseStop()
{
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == true)
{
Audio.PlaySFXOnce2D("event:/Homeowner/humming");
reevaluateWaypoint();
}
SetNodeData("isAlert", false);
}
public override BehaviourTreeNodeStatus Evaluate()
{
//Debug.LogWarning("LeafSearch");
onEnter(BehaviourTreeNodeStatus.RUNNING);
//Get data
if (GetNodeData("transform") == null ||
GetNodeData("eyeOffset") == null ||
GetNodeData("sightDistance") == null)
{
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else
{
transform = (Transform)GetNodeData("transform");
eyeOffset = (Vector3)GetNodeData("eyeOffset");
sightDistance = (float)GetNodeData("sightDistance");
}
//Search for player
player = GameObject.Find("Player");
//Automatically fail if no player is found
if (player == null)
{
SetNodeData("isAlert", false);
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else
{
//Fail if unable to find a player
//Get player's transform
Transform plrT = player.GetValueOrDefault().GetComponent<Transform>();
//DELETE THIS
//Debug.Log("X " + MathF.Sin(transform.LocalEulerAngles.y).ToString() + " Z " + MathF.Cos(transform.LocalEulerAngles.y).ToString());
//Debug.Log("Looking at: " + transform.LocalRotation.y.ToString() + " To player is: " + temporary.ToString());
//Debug.Log("Look difference is: " + (transform.LocalRotation.y - differenceDirection.y).ToString());
//Debug.Log("Dot: " + Quaternion.Dot(differenceDirection, transform.GlobalRotation));
//Fail if too far from vision range
if ((plrT.GlobalPosition - transform.GlobalPosition).GetMagnitude() > sightDistance)
{
//Debug.Log("Failure: Too far");
//handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
//Fail if player is out of FOV
//TODO currently a simple dot product against negative is done, this makes it essentially be a semicircle in front at which AI can see
Vector3 difference = plrT.GlobalPosition - transform.GlobalPosition;
difference.y = 0.0f; //Disregard Y axis
Vector3 lookDirection = new Vector3(MathF.Sin(transform.LocalEulerAngles.y), 0.0f, MathF.Cos(transform.LocalEulerAngles.y));
//Debug.Log("Dot: " + Vector3.Dot(difference, lookDirection));
if (Vector3.Dot(difference, lookDirection) < 0.0f)
{
//Debug.Log("Failure: Out of FOV");
//handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
//LocalRotation is between -1 and 1, which are essentially the same.
//0 and -1/1 are 180 deg apart
//Quaternion differenceDirection = Quaternion.FromToRotation(Vector3.Forward, plrT.GlobalPosition - transform.GlobalPosition);
//Debug.Log("Looking at: " + transform.LocalRotation.y.ToString() + " To player is: " + differenceDirection.y.ToString());
//Draw a ray, succeed if ray is unobstructed
Vector3 eyePosition = transform.GlobalPosition + eyeOffset;
BoxCollider playerCollider = player.GetValueOrDefault().GetComponent<Collider>().GetCollisionShape<BoxCollider>(0);
if (playerCollider == null)
{
//Debug.Log("Failure: Player has no collider");
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
//Ray destination to target the centre of the player's collider instead of transform position
//Since transform position is often the raccoon's base and the ray needs to hit somewhere higher to be more reliable
Vector3 rayDestination = plrT.GlobalPosition + plrT.GlobalScale * playerCollider.PositionOffset;
Ray sightRay = new Ray(eyePosition, rayDestination - eyePosition);
RaycastHit sightRayHit = Physics.Raycast(sightRay);
//As of November 2022, RaycastHit contains only the FIRST object hit by
//the ray in the Other GameObject data member
//Diren may likely add ALL objects hit by the ray over December
if (sightRayHit.Hit && sightRayHit.Other != player)
{
//TODO sometimes the ray doesn't hit the player even if he's in plain sight because the ray hits the floor the player is on instead???
//Debug.Log("Failure: Ray hit obstacle named " + sightRayHit.Other.GetValueOrDefault().Name + " ID" + sightRayHit.Other.GetValueOrDefault().EntityId);
//handleChaseStop();
status = BehaviourTreeNodeStatus.FAILURE;
onExit(BehaviourTreeNodeStatus.FAILURE);
return status;
}
else if (sightRayHit.Hit && sightRayHit.Other == player)
{
//Debug.Log("Ray hit player");
}
//All checks for now succeeded
//Debug.Log("Success: Homeowner has sighted player");
//Write player's transform into the blackboard
SetNodeData("target", plrT);
if (GetNodeData("isAlert") == null)
{
SetNodeData("isAlert", true);
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon");
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected");
Audio.StopAllSounds();
Audio.PlayBGMOnce2D("event:/Music/player_detected");
}
else
{
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false)
{
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon");
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected");
Audio.StopAllSounds();
Audio.PlayBGMOnce2D("event:/Music/player_detected");
}
SetNodeData("isAlert", true);
}
status = BehaviourTreeNodeStatus.SUCCESS;
onExit(BehaviourTreeNodeStatus.SUCCESS);
return status;
}
}
}

View File

@ -0,0 +1,3 @@
Name: LeafSearch
ID: 166109634
Type: 9

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