Added C# Assets System and Serialization of Script Enabled State #247

Merged
Pycorax merged 11 commits from SP3-6-c-scripting into main 2022-11-22 18:59:32 +08:00
105 changed files with 24119 additions and 518 deletions
Showing only changes of commit 1bd19b90a8 - Show all commits

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: 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 SubPass: G-Buffer Write
Properties: Properties:
data.color: {x: 1, y: 1, z: 1, w: 1} data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 0 data.textureIndex: 54429632
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,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,7 @@
Name: MD_SkyDome01
ID: 82516582
Type: 4
Sub Assets:
Name: Sphere
ID: 144340823
Type: 8

File diff suppressed because it is too large Load Diff

View File

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

8606
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

View File

@ -0,0 +1,57 @@
- EID: 0
Name: Default
IsActive: true
NumberOfChildren: 1
Components: ~
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: 129340704
IsActive: true
Scripts: ~
- EID: 2
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: 3
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
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: ~

View File

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

View File

@ -39,11 +39,11 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Static
Mass: 1
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -60,6 +60,7 @@
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 2 - EID: 2
@ -68,9 +69,9 @@
NumberOfChildren: 3 NumberOfChildren: 3
Components: Components:
Transform Component: Transform Component:
Translate: {x: -18.9007454, y: -3.67369723, z: -5.23871422} Translate: {x: -0.0897406489, y: -4.07369709, z: 3.6087606}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: 0, y: -0.19268477, z: 0}
Scale: {x: 2, y: 2, z: 2} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 149697411 Mesh: 149697411
@ -78,11 +79,11 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Mass: 1
Drag: 2 Drag: 2
Angular Drag: 0 Angular Drag: 0
Use Gravity: false Use Gravity: false
Interpolate: false Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -94,11 +95,12 @@
Colliders: Colliders:
- Is Trigger: false - Is Trigger: false
Type: Box Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 0.5, y: 0.699999988, z: 0.5}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 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 IsActive: true
Scripts: Scripts:
- Type: PlayerController - Type: PlayerController
@ -106,7 +108,7 @@
maxMoveVel: 4 maxMoveVel: 4
moveForce: 50 moveForce: 50
sprintMultiplier: 1.5 sprintMultiplier: 1.5
rotationFactorPerFrame: 1 rotationFactorPerFrame: 4
maxJumpHeight: 4 maxJumpHeight: 4
maxJumpTime: 0.75 maxJumpTime: 0.75
fallMultipler: 2 fallMultipler: 2
@ -114,16 +116,20 @@
mediumMultiper: 0.5 mediumMultiper: 0.5
heavyMultiper: 0.25 heavyMultiper: 0.25
- Type: PickAndThrow - Type: PickAndThrow
holdPosition: [0, 1.20000005, 0] throwForce: [300, 300, 300]
throwForce: [200, 300, 200] delayTimer: 1
aimingLength: 1.5
- Type: StateMachine
currentStateName: Idle State
currentAnimName: ""
- EID: 3 - EID: 3
Name: Default Name: HoldingPoint
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 1.20000005, z: 0} Translate: {x: 0, y: 1.20000005, z: 0.5}
Rotate: {x: -0, y: 0, z: -0} Rotate: {x: 0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
@ -134,13 +140,13 @@
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} Translate: {x: 0, y: 0, z: 0}
Rotate: {x: -0.785401046, y: 1.65799224, z: 0} Rotate: {x: -0.361278683, y: 4.97423792, z: 0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Camera Component: Camera Component:
Position: {x: -18.9007454, y: -3.67369723, z: -5.23871422} Position: {x: 0.330392599, y: -2.72767258, z: 5.02710676}
Pitch: -45.000164 Pitch: -42.2981491
Yaw: 94.9959564 Yaw: 16.4989166
Roll: 0 Roll: 0
Width: 1920 Width: 1920
Height: 1080 Height: 1080
@ -175,8 +181,8 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -8, y: -4.42369843, z: 2.5} Translate: {x: -8, y: -4.42369699, z: 3.65323806}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
@ -185,11 +191,11 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Mass: 1
Drag: 0 Drag: 0
Angular Drag: 0 Angular Drag: 0
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: false
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -206,6 +212,7 @@
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0.5, z: 0} Position Offset: {x: 0, y: 0.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 7 - EID: 7
@ -249,11 +256,11 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Static
Mass: 1
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -267,11 +274,11 @@
Scripts: Scripts:
- Type: GameManager - Type: GameManager
itemPool: 12 itemPool: 12
zonePool: 51000 zonePool: 15
currGameState: 0 currGameState: 3
totalItemCount: -202 totalItemCount: 2
Score: 204 Score: 0
timer: 0 timer: 4.00741768
- EID: 12 - EID: 12
Name: ItemPool Name: ItemPool
IsActive: true IsActive: true
@ -284,8 +291,8 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 3.19870043, y: -3.67369723, z: -5} Translate: {x: 3.19896913, y: -3.66431332, z: -4.99997139}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: -1.57956983e-05, y: 2.20007223e-06, z: -0.000548519194}
Scale: {x: 2, y: 2, z: 2} Scale: {x: 2, y: 2, z: 2}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
@ -294,17 +301,17 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Mass: 1 Drag: 0.100000001
Drag: 0 Angular Drag: 0.100000001
Angular Drag: 0
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
Freeze Rotation X: true Freeze Rotation X: false
Freeze Rotation Y: true Freeze Rotation Y: false
Freeze Rotation Z: true Freeze Rotation Z: false
IsActive: true IsActive: true
Collider Component: Collider Component:
Colliders: Colliders:
@ -315,6 +322,7 @@
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0.5, z: 0} Position Offset: {x: 0, y: 0.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
- Is Trigger: true - Is Trigger: true
Type: Box Type: Box
Half Extents: {x: 2, y: 2, z: 2} Half Extents: {x: 2, y: 2, z: 2}
@ -322,6 +330,7 @@
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0.5, z: 0} Position Offset: {x: 0, y: 0.5, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: Scripts:
- Type: Item - Type: Item
@ -333,45 +342,47 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -20.6163979, y: -0.0419634879, z: -5.08873653} Translate: {x: -5.02078056, y: -4.17369747, z: -2.14891005}
Rotate: {x: -0, y: 0, z: 0} Rotate: {x: -2.95397289e-08, y: 0.00065473502, z: -4.44611992e-08}
Scale: {x: 2, y: 2, z: 2} Scale: {x: 1.99998975, y: 2, z: 1.99998975}
IsActive: false IsActive: true
Renderable Component: Renderable Component:
Mesh: 144838771 Mesh: 144838771
Material: 123745521 Material: 123745521
IsActive: false IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
Mass: 1 Drag: 0.100000001
Drag: 0 Angular Drag: 0.100000001
Angular Drag: 0
Use Gravity: true Use Gravity: true
Interpolate: false Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
Freeze Rotation X: true Freeze Rotation X: false
Freeze Rotation Y: true Freeze Rotation Y: false
Freeze Rotation Z: true Freeze Rotation Z: false
IsActive: false IsActive: true
Collider Component: Collider Component:
Colliders: Colliders:
- Is Trigger: false - 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 Type: Box
Half Extents: {x: 1, y: 1, z: 1} Half Extents: {x: 1, y: 1, z: 1}
Friction: 0.400000006 Friction: 0.400000006
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0.5, z: 0} Position Offset: {x: 0, y: 0.5, z: 0}
- Is Trigger: true Rotation Offset: {x: 0, y: 0, z: 0}
Type: Box IsActive: true
Half Extents: {x: 2, y: 2, z: 2}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0.5, z: 0}
IsActive: false
Scripts: Scripts:
- Type: Item - Type: Item
Score: 1 Score: 1
@ -388,17 +399,17 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: -24.5947151, y: -3.15127993, z: -3.29243231} Translate: {x: -24.4654179, y: -3.15127993, z: -3.29243231}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1} Scale: {x: 1, y: 1, z: 1}
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Static
Mass: 1
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -415,8 +426,10 @@
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts:
- Type: ScoringZone
- EID: 14 - EID: 14
Name: ScoreZone Name: ScoreZone
IsActive: true IsActive: true
@ -429,11 +442,11 @@
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Static Type: Static
Mass: 1
Drag: 0.00999999978 Drag: 0.00999999978
Angular Drag: 0.00999999978 Angular Drag: 0.00999999978
Use Gravity: true Use Gravity: true
Interpolate: true Interpolate: true
Sleeping Enabled: true
Freeze Position X: false Freeze Position X: false
Freeze Position Y: false Freeze Position Y: false
Freeze Position Z: false Freeze Position Z: false
@ -450,5 +463,7 @@
Bounciness: 0 Bounciness: 0
Density: 1 Density: 1
Position Offset: {x: 0, y: 0, z: 0} Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true IsActive: true
Scripts: ~ Scripts:
- Type: ScoringZone

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,180 @@
using SHADE;
using SHADE_Scripting;
using System;
using static PlayerController;
public class PickAndThrow : Script
{
public Vector3 throwForce = new Vector3(100.0f, 200.0f, 100.0f);
public GameObject item { get; set; }
public float delayTimer = 1.0f;
public float aimingLength = 1.5f;
private float timer;
private PlayerController pc;
private Camera cam;
private Transform itemTransform;
private RigidBody itemRidibody;
private Transform raccoonHoldLocation;
private Transform playerTran;
private ThirdPersonCamera tpc;
private float lastXDir;
private float lastZDir;
private bool inRange = false;
protected override void awake()
{
playerTran = GetComponent<Transform>();
if (!playerTran)
Debug.Log("PLAYERTRANSFORM EMPTY"); ;
pc = GetScript<PlayerController>();
if(!pc)
Debug.Log("PLAYER CONTROLLER EMPTY");
raccoonHoldLocation = GetComponentInChildren<Transform>();
if (!raccoonHoldLocation)
Debug.Log("CHILD EMPTY");
tpc = GetScriptInChildren<ThirdPersonCamera>();
if(!tpc)
Debug.Log("TPC EMPTY");
timer = delayTimer;
}
protected override void update()
{
if(timer <= delayTimer)
timer += Time.DeltaTimeF;
CalculateDir();
if (pc && itemRidibody && itemTransform)
{
if (pc.holdItem)
{
itemTransform.LocalPosition = raccoonHoldLocation.GlobalPosition;
itemTransform.LocalRotation = playerTran.LocalRotation;
if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{
Debug.Log("AIMING");
pc.isAiming = true;
pc.camArm.ArmLength = aimingLength;
}
if (Input.GetMouseButtonUp(Input.MouseCode.LeftButton) && pc.isAiming)
{
Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_throw");
pc.isAiming = false;
if(tpc)
pc.camArm.ArmLength = tpc.armLength;
pc.holdItem = false;
inRange = false;
itemRidibody.IsGravityEnabled = true;
itemRidibody.AddForce(new Vector3(throwForce.x * lastXDir, throwForce.y, throwForce.z * lastZDir));
itemRidibody.LinearVelocity += pc.rb.LinearVelocity;
ResetItemObject();
timer = 0.0f;
}
if (Input.GetMouseButtonDown(Input.MouseCode.RightButton))
{
pc.holdItem = false;
inRange = false;
itemRidibody.IsGravityEnabled = true;
ResetItemObject();
}
}
else if (!pc.holdItem)
itemRidibody.IsGravityEnabled = true;
}
if (timer > delayTimer && pc && !pc.holdItem && inRange && Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{
if (pc.currentState == RaccoonStates.WALKING || pc.currentState == RaccoonStates.IDLE)
{
pc.holdItem = true;
RetrieveItemComponets();
}
}
}
private void ResetItemObject()
{
itemRidibody = null;
itemTransform = null;
item = new GameObject();
}
private void RetrieveItemComponets()
{
//get the transform of the given item
if (item.GetScript<Item>() && itemTransform == null && itemRidibody == null)
{
itemRidibody = item.GetComponent<RigidBody>();
if (itemRidibody == null)
Debug.Log("Item rb EMPTY");
else
{
itemRidibody.IsGravityEnabled = false;
itemRidibody.LinearVelocity = Vector3.Zero;
itemRidibody.AngularVelocity = Vector3.Zero;
}
itemTransform = item.GetComponent<Transform>();
if (itemTransform == null)
Debug.Log("Item transform EMPTY");
else
{
itemTransform.LocalEulerAngles = Vector3.Zero;
}
}
}
private void CalculateDir()
{
if (cam == null)
cam = GetComponentInChildren<Camera>();
else if (cam)
{
Vector3 camerAixs = cam.GetForward();
camerAixs.y = 0;
camerAixs.Normalise();
lastXDir = camerAixs.x;
lastZDir = camerAixs.z;
}
}
private void DelayCheck()
{
timer += Time.DeltaTimeF;
}
protected override void onCollisionEnter(CollisionInfo info)
{
}
protected override void onTriggerEnter(CollisionInfo info)
{
if (info.GameObject.GetScript<Item>() && !pc.holdItem)
{
item = info.GameObject;
inRange = true;
}
}
protected override void onTriggerStay(CollisionInfo info)
{
//Debug.Log("STAY");
}
protected override void onTriggerExit(CollisionInfo info)
{
//Debug.Log("EXIT");
if (info.GameObject.GetScript<Item>() != null && !pc.holdItem)
{
inRange = false;
}
}
}

View File

@ -29,10 +29,12 @@ public class PlayerController : Script
public RigidBody rb { get; set; } public RigidBody rb { get; set; }
private Transform tranform; private Transform tranform;
private Camera cam; private Camera cam;
public CameraArm camArm { get; set; }
private PickAndThrow pat; private PickAndThrow pat;
private StateMachine stateMachine; private StateMachine stateMachine;
public bool holdItem { get; set; } public bool holdItem { get; set; }
public bool isAiming { get; set; }
[Tooltip("The current state fo the raccoon")] [Tooltip("The current state fo the raccoon")]
public RaccoonStates currentState = RaccoonStates.IDLE; public RaccoonStates currentState = RaccoonStates.IDLE;
@ -48,25 +50,19 @@ public class PlayerController : Script
private float oldForce; private float oldForce;
private float maxOldVel; private float maxOldVel;
private bool sprintIncreaseOnce = false; private bool sprintIncreaseOnce = false;
public float xAxisMove { get; set; }
public float zAxisMove { get; set; }
public Vector2 axisMove { get; set; } public Vector2 axisMove { get; set; }
public bool isMoveKeyPress { get; set; } public bool isMoveKeyPress { get; set; }
[Tooltip("curr not working")] [Tooltip("How fast player will turn")]
public float rotationFactorPerFrame = 1.0f; public float rotationFactorPerFrame = 1.0f;
//Jumping vars================================================================== //Jumping vars==================================================================
[SerializeField]
[Tooltip("max height of the jump")] [Tooltip("max height of the jump")]
public float maxJumpHeight = 4.0f; public float maxJumpHeight = 4.0f;
[SerializeField]
[Tooltip("max amt of time it will take for the jump")] [Tooltip("max amt of time it will take for the jump")]
public float maxJumpTime = 0.75f; public float maxJumpTime = 0.75f;
[SerializeField]
[Tooltip("increase gravity when falling")] [Tooltip("increase gravity when falling")]
public float fallMultipler = 2.0f; public float fallMultipler = 2.0f;
private float initialJumpVel; private float initialJumpVel;
@ -75,16 +71,19 @@ public class PlayerController : Script
private float groundGravity = -0.5f; private float groundGravity = -0.5f;
//ItemMultipler================================================================== //ItemMultipler==================================================================
[Tooltip("How light item will affect player jump")]
public float lightMultiper = 0.75f; public float lightMultiper = 0.75f;
[Tooltip("How medium item will affect player jump")]
public float mediumMultiper = 0.5f; public float mediumMultiper = 0.5f;
[Tooltip("How heavy item will affect player jump")]
public float heavyMultiper = 0.25f; public float heavyMultiper = 0.25f;
protected override void awake() protected override void awake()
{ {
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
//default setup //default setup
isMoveKeyPress = false; isMoveKeyPress = false;
holdItem = false; holdItem = false;
isAiming = false;
//Jump setup //Jump setup
float timeToApex = maxJumpTime / 2; float timeToApex = maxJumpTime / 2;
@ -95,11 +94,6 @@ public class PlayerController : Script
rb = GetComponent<RigidBody>(); rb = GetComponent<RigidBody>();
if (rb == null) if (rb == null)
Debug.LogError("RigidBody is NULL!"); Debug.LogError("RigidBody is NULL!");
else
{
rb.IsGravityEnabled = false;
rb.Interpolating = false;
}
//Transform check //Transform check
tranform = GetComponent<Transform>(); tranform = GetComponent<Transform>();
@ -113,18 +107,25 @@ public class PlayerController : Script
stateMachine = AddScript<StateMachine>(); stateMachine = AddScript<StateMachine>();
Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>(); Dictionary<Type, BaseState> dictionary = new Dictionary<Type, BaseState>();
dictionary.Add(typeof(IdleState), new IdleState(stateMachine)); dictionary.Add(typeof(PlayerIdleState), new PlayerIdleState(stateMachine));
dictionary.Add(typeof(WalkState), new WalkState(stateMachine)); dictionary.Add(typeof(PlayerWalkState), new PlayerWalkState(stateMachine));
dictionary.Add(typeof(RunState), new RunState(stateMachine)); dictionary.Add(typeof(PlayerRunState), new PlayerRunState(stateMachine));
dictionary.Add(typeof(PlayerJumpState), new PlayerJumpState(stateMachine));
dictionary.Add(typeof(PlayerFallState), new PlayerFallState(stateMachine));
dictionary.Add(typeof(PlayerLandState), new PlayerLandState(stateMachine));
dictionary.Add(typeof(PlayerCaughtState), new PlayerCaughtState(stateMachine));
stateMachine.InitStateMachine(dictionary); stateMachine.InitStateMachine(dictionary);
} }
protected override void update() protected override void update()
{ {
if (cam == null) if (!cam)
cam = GetComponentInChildren<Camera>(); cam = GetComponentInChildren<Camera>();
if(!camArm)
camArm = GetComponentInChildren<CameraArm>();
Rotation();
GotCaught(); GotCaught();
//Debug.Log($"{currentState}"); //Debug.Log($"{currentState}");
//Debug.Log($" axisX: {axisMove.x} axisY:{axisMove.y}"); //Debug.Log($" axisX: {axisMove.x} axisY:{axisMove.y}");
@ -134,9 +135,6 @@ public class PlayerController : Script
protected override void fixedUpdate() protected override void fixedUpdate()
{ {
//Rotation();
MoveKey(); MoveKey();
Move(); Move();
Sprint(); Sprint();
@ -188,16 +186,16 @@ public class PlayerController : Script
{ {
currentState = RaccoonStates.WALKING; currentState = RaccoonStates.WALKING;
if(stateMachine && !stateMachine.IsState(typeof(WalkState))) if(stateMachine && !stateMachine.IsState(typeof(PlayerWalkState)))
stateMachine.SetState(typeof(WalkState)); stateMachine.SetState(typeof(PlayerWalkState));
} }
if (!isMoveKeyPress && isGrounded) if (!isMoveKeyPress && isGrounded)
{ {
currentState = RaccoonStates.IDLE; currentState = RaccoonStates.IDLE;
if(stateMachine && !stateMachine.IsState(typeof(IdleState))) if(stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(IdleState)); stateMachine.SetState(typeof(PlayerIdleState));
} }
} }
@ -207,20 +205,16 @@ public class PlayerController : Script
{ {
rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF; rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF;
if (isMoveKeyPress) if (isMoveKeyPress && rb)
{ {
if (rb) Vector3 velNor = rb.LinearVelocity;
velNor.y = 0.0f;
if (velNor.GetMagnitude() > maxMoveVel)
{ {
Vector3 velNor = rb.LinearVelocity; velNor.Normalise();
velNor.y = 0.0f; velNor *= maxMoveVel;
if (velNor.GetMagnitude() > maxMoveVel) rb.LinearVelocity = new Vector3(velNor.x, rb.LinearVelocity.y, velNor.z);
{
velNor.Normalise();
velNor *= maxMoveVel;
rb.LinearVelocity = new Vector3(velNor.x, rb.LinearVelocity.y, velNor.z);
}
} }
} }
} }
} }
@ -230,8 +224,8 @@ public class PlayerController : Script
if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded) if (Input.GetKey(Input.KeyCode.LeftShift) && isMoveKeyPress && isGrounded)
{ {
currentState = RaccoonStates.RUNNING; currentState = RaccoonStates.RUNNING;
if (stateMachine && !stateMachine.IsState(typeof(RunState))) if (stateMachine && !stateMachine.IsState(typeof(PlayerRunState)))
stateMachine.SetState(typeof(RunState)); stateMachine.SetState(typeof(PlayerRunState));
holdItem = false; holdItem = false;
if (!sprintIncreaseOnce) if (!sprintIncreaseOnce)
@ -250,8 +244,8 @@ public class PlayerController : Script
if (isMoveKeyPress) if (isMoveKeyPress)
{ {
currentState = RaccoonStates.WALKING; currentState = RaccoonStates.WALKING;
if(stateMachine && !stateMachine.IsState(typeof(WalkState))) if(stateMachine && !stateMachine.IsState(typeof(PlayerWalkState)))
stateMachine.SetState(typeof(WalkState)); stateMachine.SetState(typeof(PlayerWalkState));
} }
sprintIncreaseOnce = false; sprintIncreaseOnce = false;
moveForce = oldForce; moveForce = oldForce;
@ -290,19 +284,17 @@ public class PlayerController : Script
private void Rotation() private void Rotation()
{ {
Vector3 poitionToLookAt; if (isMoveKeyPress && tranform && !isAiming)
poitionToLookAt.x = axisMove.x;
poitionToLookAt.y = 0.0f;
poitionToLookAt.z = axisMove.y;
if (tranform != null)
{ {
Quaternion currentRotation = tranform.LocalRotation; Quaternion currentRotation = tranform.LocalRotation;
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING) Quaternion targetRotation = Quaternion.LookRotation(new Vector3(axisMove.x, 0.0f, axisMove.y), new Vector3(0.0f, 1.0f, 0.0f));
{ tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.DeltaTime);
Quaternion targetRotation = Quaternion.LookRotation(poitionToLookAt, new Vector3(0.0f, 1.0f, 0.0f)); }
tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.DeltaTime); else if (camArm && tranform && isAiming)
} {
Quaternion currentRotation = tranform.LocalRotation;
Quaternion targetRotation = Quaternion.Euler(0.0f, SHADE.Math.DegreesToRadians(camArm.Yaw + 180.0f), 0.0f);
tranform.LocalRotation = Quaternion.Slerp(currentRotation, targetRotation, rotationFactorPerFrame * (float)Time.DeltaTime);
} }
} }
@ -349,8 +341,8 @@ public class PlayerController : Script
if (currentState == RaccoonStates.CAUGHT && tranform != null) if (currentState == RaccoonStates.CAUGHT && tranform != null)
{ {
currentState = RaccoonStates.IDLE; currentState = RaccoonStates.IDLE;
if (stateMachine && !stateMachine.IsState(typeof(IdleState))) if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
stateMachine.SetState(typeof(IdleState)); stateMachine.SetState(typeof(PlayerIdleState));
tranform.LocalPosition = new Vector3(-3.0f, -2.0f, -5.0f); tranform.LocalPosition = new Vector3(-3.0f, -2.0f, -5.0f);
} }
} }
@ -361,80 +353,3 @@ public class PlayerController : Script
} }
public class WalkState : BaseState
{
public WalkState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Walk State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}
public class RunState : BaseState
{
public RunState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Run State";
}
public override void OnEnter()
{
//Debug.Log("Run ENTER");
}
public override void update()
{
//Debug.Log("RUNING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED RUNNING");
}
public override void OnExit()
{
//Debug.Log("Run EXIT");
}
}
public class IdleState : BaseState
{
public IdleState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Idle State";
}
public override void OnEnter()
{
//Debug.Log("IDLE ENTER");
}
public override void update()
{
//Debug.Log("IDLING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED IDLING");
}
public override void OnExit()
{
//Debug.Log("IDLE EXIT");
}
}

View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SHADE;
namespace SHADE_Scripting
{
public class ThirdPersonCamera : Script
{
public float armLength = 2.0f;
public float turnSpeedPitch = 0.3f;
public float turnSpeedYaw = 0.5f;
public float pitchClamp = 45.0f;
protected override void awake()
{
AddComponent<Transform>();
if (!GetComponent<Camera>())
{
AddComponent<Camera>();
}
GetComponent<Camera>().SetMainCamera();
if (!GetComponent<CameraArm>())
{
AddComponent<CameraArm>();
}
GetComponent<CameraArm>().ArmLength = armLength;
}
protected override void update()
{
CameraArm arm = GetComponent<CameraArm>();
if (arm)
{
Vector2 vel = Input.GetMouseVelocity();
arm.Pitch -= vel.y * turnSpeedPitch * Time.DeltaTimeF;
arm.Yaw += vel.x * turnSpeedYaw * Time.DeltaTimeF;
if (arm.Pitch > pitchClamp)
{
arm.Pitch = pitchClamp;
}
else if (arm.Pitch < 0)
{
arm.Pitch = 0;
}
}
}
}
}

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerCaughtState : BaseState
{
public PlayerCaughtState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Caught State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerCaughtState
ID: 162030736
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerFallState : BaseState
{
public PlayerFallState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Fall State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerFallState
ID: 155635109
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerIdleState : BaseState
{
public PlayerIdleState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Idle State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerIdleState
ID: 167587808
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerJumpState : BaseState
{
public PlayerJumpState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Jump State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerJumpState
ID: 158874227
Type: 9

View File

@ -0,0 +1,31 @@
using SHADE;
using System;
public class PlayerLandState : BaseState
{
public PlayerLandState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Land State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerLandState
ID: 151865541
Type: 9

View File

@ -0,0 +1,41 @@
using SHADE;
using System;
public class PlayerRunState : BaseState
{
private float timer;
private float delay = 0.25f;
public PlayerRunState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Run State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
}
public override void update()
{
//Debug.Log("WALKING");
timer += Time.DeltaTimeF;
if (timer > delay)
{
Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_footsteps");
timer = 0;
}
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerRunState
ID: 153407272
Type: 9

View File

@ -0,0 +1,41 @@
using SHADE;
using System;
public class PlayerWalkState : BaseState
{
private float timer;
private float delay = 0.5f;
public PlayerWalkState(StateMachine stateMachine) : base(stateMachine)
{
stateName = "Walk State";
}
public override void OnEnter()
{
//Debug.Log("WALK ENTER");
timer = delay;
}
public override void update()
{
//Debug.Log("WALKING");
timer += Time.DeltaTimeF;
if (timer > delay)
{
Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_footsteps");
timer = 0;
}
}
public override void fixedUpdate()
{
//Debug.Log("FIXED WALKING");
}
public override void OnExit()
{
//Debug.Log("WALK EXIT");
}
public override void onTriggerEnter(CollisionInfo info)
{
//Debug.Log("TRIGGER");
}
}

View File

@ -0,0 +1,3 @@
Name: UT_PlayerWalkState
ID: 166650679
Type: 9

View File

@ -7,6 +7,7 @@ public class GameManager : Script
public enum GameState public enum GameState
{ {
MAINMENU, MAINMENU,
START,
WIN, WIN,
LOSE, LOSE,
TOTAL TOTAL
@ -35,28 +36,32 @@ public class GameManager : Script
if (itemPool) if (itemPool)
{ {
listOfItems = itemPool.GetScriptsInChildren<Item>(); listOfItems = itemPool.GetScriptsInChildren<Item>();
foreach (Item i in listOfItems) if (listOfItems != null)
totalItemCount += 1; foreach (Item i in listOfItems)
totalItemCount += 1;
} }
if (zonePool) if (zonePool)
{ {
listOfZone = itemPool.GetScriptsInChildren<ScoringZone>(); listOfZone = zonePool.GetScriptsInChildren<ScoringZone>();
foreach (ScoringZone i in listOfZone) if (listOfZone != null)
i.gameManger = Owner.GetScript<GameManager>(); foreach (ScoringZone sz in listOfZone)
sz.gameManger = Owner.GetScript<GameManager>();
} }
} }
protected override void update() protected override void update()
{ {
if (timer > 0) if (timer > 0 && currGameState == GameState.START)
{
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
if (totalItemCount <= 0)
{
currGameState = GameState.WIN;
}
}
else else
currGameState = GameState.LOSE; currGameState = GameState.LOSE;
} }
protected override void onTriggerEnter(CollisionInfo info)
{
}
} }

View File

@ -0,0 +1,52 @@
using SHADE;
using System;
public class Item : Script
{
public enum ItemCategory
{
LIGHT,
MEDIUM,
HEAVY
}
public int Score = 10;
public ItemCategory currCategory;
private RigidBody rb;
private Collider collider;
private bool once = false;
protected override void awake()
{
collider = GetComponent<Collider>();
if (collider)
{
collider.GetCollisionShape(0).Density = 1;
}
rb = GetComponent<RigidBody>();
if (rb)
{
rb.FreezeRotationX = false;
rb.FreezeRotationY = false;
rb.FreezeRotationZ = false;
}
}
protected override void onCollisionEnter(CollisionInfo info)
{
if (once)
{
if(currCategory == ItemCategory.LIGHT)
Audio.PlayBGMOnce2D("event:/Props/impact_elastic");
else if (currCategory == ItemCategory.MEDIUM || currCategory == ItemCategory.HEAVY)
Audio.PlayBGMOnce2D("event:/Props/impact_hard");
once = false;
}
}
protected override void onCollisionExit(CollisionInfo info)
{
once = true;
}
}

View File

@ -12,6 +12,7 @@ public class ScoringZone : Script
{ {
if (gameManger && info.GameObject.GetScript<Item>()) if (gameManger && info.GameObject.GetScript<Item>())
{ {
Audio.PlayBGMOnce2D("event:/Music/stingers/item_scored");
gameManger.Score += info.GameObject.GetScript<Item>().Score; gameManger.Score += info.GameObject.GetScript<Item>().Score;
gameManger.totalItemCount -= 1; gameManger.totalItemCount -= 1;
info.GameObject.SetActive(false); info.GameObject.SetActive(false);

View File

@ -1,3 +0,0 @@
Name: Item
ID: 163145289
Type: 9

View File

@ -1,71 +0,0 @@
using SHADE;
using System;
public class PhysicsTest : Script
{
[SerializeField]
[Tooltip("Force to apply when pressing Space.")]
private Vector3 Force = new Vector3(0.0f, 200.0f, 0.0f);
private Transform Transform;
private RigidBody RigidBody;
private Collider Collider;
protected override void awake()
{
Transform = GetComponent<Transform>();
if (Transform == null)
{
Debug.LogError("Transform is NULL!");
}
RigidBody = GetComponent<RigidBody>();
if (RigidBody == null)
{
Debug.LogError("RigidBody is NULL!");
}
Collider = GetComponent<Collider>();
if (Collider == null)
{
Debug.LogError("Collider is NULL!");
}
var subColider = Collider.CollisionShapeCount;
Debug.Log($"There are {subColider} colliders.");
}
protected override void update()
{
if (Input.GetKeyUp(Input.KeyCode.Space))
{
RigidBody.AddForce(Force);
Debug.Log($"Jump!");
}
}
protected override void fixedUpdate()
{
Debug.Log("Fixed Update");
}
protected override void onCollisionEnter(CollisionInfo info)
{
Debug.Log($"Collision Enter: {info.GameObject.Name}");
}
protected override void onCollisionStay(CollisionInfo info)
{
Debug.Log($"Collision Stay: {info.GameObject.Name}");
}
protected override void onCollisionExit(CollisionInfo info)
{
Debug.Log($"Collision Exit: {info.GameObject.Name}");
}
protected override void onTriggerEnter(CollisionInfo info)
{
Debug.Log($"Trigger Enter: {info.GameObject.Name}");
}
protected override void onTriggerStay(CollisionInfo info)
{
Debug.Log($"Trigger Stay: {info.GameObject.Name}");
}
protected override void onTriggerExit(CollisionInfo info)
{
Debug.Log($"Trigger Exit: {info.GameObject.Name}");
}
}

View File

@ -1,3 +0,0 @@
Name: PickAndThrow
ID: 165331952
Type: 9

View File

@ -1,3 +0,0 @@
Name: PlayerController
ID: 164563088
Type: 9

View File

@ -1,24 +0,0 @@
using SHADE;
using System;
public class Item : Script
{
public enum ItemCategory
{
LIGHT,
MEDIUM,
HEAVY
}
public int Score = 10;
public ItemCategory currCategory;
protected override void awake()
{
}
protected override void onTriggerEnter(CollisionInfo info)
{
}
}

View File

@ -0,0 +1,13 @@
using System;
using SHADE;
public class SC_MainMenu : Script
{
protected override void awake()
{
}
protected override void update()
{
}
}

View File

@ -0,0 +1,3 @@
Name: SC_MainMenu
ID: 158552402
Type: 9

View File

@ -1,119 +0,0 @@
using SHADE;
using System;
using static PlayerController;
public class PickAndThrow : Script
{
public Vector3 holdPosition = new Vector3(0.0f, 1.0f, 0.0f);
public Vector3 throwForce = new Vector3(100.0f, 200.0f, 100.0f);
public GameObject item { get; set; }
private PlayerController pc;
private Camera cam;
private Transform itemTransform;
private RigidBody itemRidibody;
private Transform raccoonHoldLocation;
private float lastXDir;
private float lastZDir;
private bool inRange = false;
protected override void awake()
{
pc = GetScript<PlayerController>();
raccoonHoldLocation = GetComponentInChildren<Transform>();
if (raccoonHoldLocation == null)
Debug.Log("CHILD EMPTY");
else
raccoonHoldLocation.LocalPosition = holdPosition;
}
protected override void update()
{
CalculateDir();
if (pc != null && pc.holdItem && itemRidibody != null && itemTransform != null)
{
itemTransform.LocalPosition = raccoonHoldLocation.GlobalPosition;
itemRidibody.IsGravityEnabled = false;
itemRidibody.LinearVelocity = Vector3.Zero;
itemRidibody.AngularVelocity = Vector3.Zero;
if (Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{
pc.holdItem = false;
inRange = false;
itemRidibody.IsGravityEnabled = true;
itemRidibody.AddForce(new Vector3(throwForce.x * lastXDir, throwForce.y, throwForce.z * lastZDir));
itemRidibody.LinearVelocity += pc.rb.LinearVelocity;
ResetItemObject();
}
}
else if(!pc.holdItem && itemRidibody != null)
itemRidibody.IsGravityEnabled = true;
if (pc != null && !pc.holdItem && inRange && Input.GetMouseButtonDown(Input.MouseCode.LeftButton))
{
pc.holdItem = true;
RetrieveItemComponets();
}
}
private void ResetItemObject()
{
itemRidibody = null;
itemTransform = null;
item = new GameObject();
}
private void RetrieveItemComponets()
{
//get the transform of the given item
if (item.GetScript<Item>() != null && itemTransform == null && itemRidibody == null)
{
itemTransform = item.GetComponent<Transform>();
if (itemTransform == null)
Debug.Log("Item transform EMPTY");
itemRidibody = item.GetComponent<RigidBody>();
if (itemRidibody == null)
Debug.Log("Item rb EMPTY");
}
}
private void CalculateDir()
{
if (cam == null)
cam = GetComponentInChildren<Camera>();
else if (cam != null)
{
Vector3 camerAixs = cam.GetForward();
camerAixs.y = 0;
camerAixs.Normalise();
lastXDir = camerAixs.x;
lastZDir = camerAixs.z;
}
}
protected override void onCollisionEnter(CollisionInfo info)
{
}
protected override void onTriggerEnter(CollisionInfo info)
{
if (info.GameObject.GetScript<Item>() != null && !pc.holdItem)
{
item = info.GameObject;
inRange = true;
}
}
protected override void onTriggerStay(CollisionInfo info)
{
//Debug.Log("STAY");
}
protected override void onTriggerExit(CollisionInfo info)
{
//Debug.Log("EXIT");
if (info.GameObject.GetScript<Item>() != null && !pc.holdItem)
{
inRange = false;
}
}
}

View File

@ -0,0 +1,74 @@
using SHADE;
using System;
public class SoundsBoard : Script
{
protected override void awake()
{
/*
* event:/UI/failure
event:/UI/mouse_down_element
event:/UI/mouse_down_empty
event:/UI/mouse_enter_element
event:/UI/mouse_exit_element
event:/UI/success
event:/Raccoon/raccoon_footsteps
event:/Raccoon/raccoon_throw
event:/Props/impact_hard
event:/Props/impact_elastic
event:/Music/player_undetected
event:/Music/player_detected
event:/Music/stingers/player_detected
event:/Music/stingers/item_scored
event:/Homeowner/homeowner_humming
event:/Homeowner/homeowner_footsteps
event:/Homeowner/homeowner_detect_raccoon
*/
}
protected override void update()
{
if (Input.GetKeyDown(Input.KeyCode.Q))
Audio.PlayBGMOnce2D("event:/UI/mouse_down_element");
if (Input.GetKeyDown(Input.KeyCode.W))
Audio.PlayBGMOnce2D("event:/UI/mouse_down_empty");
if (Input.GetKeyDown(Input.KeyCode.E))
Audio.PlayBGMOnce2D("event:/UI/mouse_enter_element");
if (Input.GetKeyDown(Input.KeyCode.R))
Audio.PlayBGMOnce2D("event:/UI/mouse_exit_element");
if (Input.GetKeyDown(Input.KeyCode.T))
Audio.PlayBGMOnce2D("event:/UI/success");
if (Input.GetKeyDown(Input.KeyCode.Y))
Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_throw");
if (Input.GetKeyDown(Input.KeyCode.U))
Audio.PlayBGMOnce2D("event:/Props/impact_hard");
if (Input.GetKeyDown(Input.KeyCode.I))
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
if (Input.GetKeyDown(Input.KeyCode.O))
Audio.PlayBGMOnce2D("event:/Music/player_detected");
if (Input.GetKeyDown(Input.KeyCode.P))
Audio.PlayBGMOnce2D("event:/Music/stingers/player_detected");
if (Input.GetKeyDown(Input.KeyCode.A))
Audio.PlayBGMOnce2D("event:/Music/stingers/item_scored");
if (Input.GetKeyDown(Input.KeyCode.S))
Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_humming");
if (Input.GetKeyDown(Input.KeyCode.D))
Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_footsteps");
if (Input.GetKeyDown(Input.KeyCode.F))
Audio.PlayBGMOnce2D("event:/Homeowner/homeowner_detect_raccoon");
if (Input.GetKeyDown(Input.KeyCode.G))
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
if (Input.GetKeyDown(Input.KeyCode.H))
Audio.PlayBGMOnce2D("event:/Raccoon/raccoon_footsteps");
if (Input.GetKeyDown(Input.KeyCode.J))
Audio.PlayBGMOnce2D("event:/Props/impact_elastic");
}
}

View File

@ -0,0 +1,3 @@
Name: SC_SoundsBoard
ID: 156397807
Type: 9

View File

@ -1,60 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SHADE;
namespace SHADE_Scripting
{
public class ThirdPersonCamera: Script
{
public float armLength = 2.0f;
public float turnSpeedPitch = 0.3f;
public float turnSpeedYaw = 0.5f;
public float pitchClamp = 45.0f;
protected override void awake()
{
AddComponent<Transform>();
if(!GetComponent<Camera>())
{
AddComponent<Camera>();
}
GetComponent<Camera>().SetMainCamera();
if (!GetComponent<CameraArm>())
{
AddComponent<CameraArm>();
}
GetComponent<CameraArm>().ArmLength = armLength;
}
protected override void update()
{
if (Input.GetMouseButton(Input.MouseCode.RightButton))
{
CameraArm arm = GetComponent<CameraArm>();
if (arm)
{
Vector2 vel = Input.GetMouseVelocity();
arm.Pitch -= vel.y * turnSpeedPitch * Time.DeltaTimeF;
arm.Yaw += vel.x * turnSpeedYaw * Time.DeltaTimeF;
if (arm.Pitch > pitchClamp)
{
arm.Pitch = pitchClamp;
}
else if (arm.Pitch < 0)
{
arm.Pitch = 0;
}
}
}
}
}
}

View File

@ -6,8 +6,8 @@ const int ROTATION_KERNEL_W = 4;
const int ROTATION_KERNEL_H = 4; const int ROTATION_KERNEL_H = 4;
// can perhaps pass in as push constant. // can perhaps pass in as push constant.
const float RADIUS = 0.5f; const float RADIUS = 0.2f;
const float BIAS = 0.025f; const float BIAS = 0.0025f;
layout(local_size_x = 16, local_size_y = 16) in; layout(local_size_x = 16, local_size_y = 16) in;
layout(set = 4, binding = 0, rgba32f) uniform image2D positions; layout(set = 4, binding = 0, rgba32f) uniform image2D positions;

Binary file not shown.

View File

@ -43,7 +43,7 @@ void main()
{ {
position = In.vertPos; position = In.vertPos;
normals = In.normal; normals = In.normal;
albedo = vec4(1.0f); albedo = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
outEntityID = In2.eid; outEntityID = In2.eid;
lightLayerIndices = In2.lightLayerIndex; lightLayerIndices = In2.lightLayerIndex;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_EndScreen
ID: 52936944
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_HouseInterior_Palette4
ID: 53438927
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: TX_MainMenu
ID: 54429632
Type: 3

Binary file not shown.

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