Merge pull request #285 from SHADE-DP/PlayerController

Updated Audio and Scene along with bug fixes
This commit is contained in:
Sri Sham Haran 2022-11-25 23:11:01 +08:00 committed by GitHub
commit 128f07030b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 383 additions and 117 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8201,105 +8201,17 @@
- EID: 240 - EID: 240
Name: ====ItemPool==== Name: ====ItemPool====
IsActive: true IsActive: true
NumberOfChildren: 3 NumberOfChildren: 9
Components: ~ Components: ~
Scripts: ~ Scripts: ~
- EID: 16
Name: Mesh_Apple
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1.20656121, y: 0.124672964, z: 5.97578335}
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: 0.200000003, y: 0.200000003, 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: Item
Enabled: true
Score: 10
currCategory: 0
- EID: 242
Name: Mesh_Cheese
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 1.89451575, y: 0.156862095, z: 6.01846552}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 141841143
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: 0.5, y: 0.150000006, z: 0.5}
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: Item
Enabled: true
Score: 100
currCategory: 2
- EID: 241 - EID: 241
Name: Mesh_Meat Name: Mesh_Meat
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 2.83309579, y: 0.209537908, z: 5.95318222} Translate: {x: 4.2743969, y: 0.209537908, z: 4.31536102}
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:
@ -8336,6 +8248,358 @@
Enabled: true Enabled: true
Score: 50 Score: 50
currCategory: 1 currCategory: 1
- EID: 157
Name: Mesh_Meat
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 4.0829463, y: 1.37235689, z: -4.4815464}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 136892700
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: 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:
- Type: Item
Enabled: true
Score: 50
currCategory: 1
- EID: 156
Name: Mesh_Meat
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -1.74228501, y: 0.927017033, z: -1.76112592}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 136892700
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: 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:
- Type: Item
Enabled: true
Score: 50
currCategory: 1
- EID: 155
Name: Mesh_Cheese
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -2.89926314, y: 1.15123272, z: 4.36190414}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 141841143
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: 0.5, y: 0.150000006, z: 0.5}
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: Item
Enabled: true
Score: 100
currCategory: 2
- EID: 154
Name: Mesh_Cheese
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -0.26750499, y: 1.28282726, z: 0.749736428}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 141841143
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: 0.5, y: 0.150000006, z: 0.5}
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: Item
Enabled: true
Score: 100
currCategory: 2
- EID: 153
Name: Mesh_Cheese
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -4.28802347, y: 0.990184903, z: 3.08095932}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 141841143
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: 0.5, y: 0.150000006, z: 0.5}
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: Item
Enabled: true
Score: 100
currCategory: 2
- EID: 65778
Name: Mesh_Apple
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -0.667112291, y: 1.25251341, z: -4.2965107}
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: 0.200000003, y: 0.200000003, 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: Item
Enabled: true
Score: 10
currCategory: 0
- EID: 152
Name: Mesh_Apple
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 4.5356307, y: 0.850251734, z: 4.42769098}
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: 0.200000003, y: 0.200000003, 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: Item
Enabled: true
Score: 10
currCategory: 0
- EID: 151
Name: Mesh_Apple
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 2.47664404, y: 0.904378593, z: -4.45292473}
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: 0.200000003, y: 0.200000003, 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: Item
Enabled: true
Score: 10
currCategory: 0
- EID: 15 - EID: 15
Name: ====ScoreZonePool==== Name: ====ScoreZonePool====
IsActive: true IsActive: true
@ -8433,7 +8697,7 @@
currGameState: 0 currGameState: 0
totalItemCount: 0 totalItemCount: 0
Score: 0 Score: 0
timer: 100 timer: 200
scoreText: 237 scoreText: 237
timeText: 206 timeText: 206
- EID: 199 - EID: 199
@ -8526,8 +8790,8 @@
moveForce: 50 moveForce: 50
sprintMultiplier: 1.5 sprintMultiplier: 1.5
rotationFactorPerFrame: 5 rotationFactorPerFrame: 5
maxJumpHeight: 1 maxJumpHeight: 2
maxJumpTime: 0.5 maxJumpTime: 0.75
fallMultipler: 3 fallMultipler: 3
lightMultiper: 0.75 lightMultiper: 0.75
mediumMultiper: 0.5 mediumMultiper: 0.5
@ -8627,13 +8891,13 @@
NumberOfChildren: 4 NumberOfChildren: 4
Components: Components:
Transform Component: Transform Component:
Translate: {x: 1.10128331, y: 0.1594823, z: 7.20125246} Translate: {x: 4.39069891, y: 1.33369851, z: -2.95690465}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 0.999979734, y: 1, z: 0.999979734} Scale: {x: 0.999979734, y: 1, z: 0.999979734}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 140964851 Mesh: 140964851
Material: 126974645 Material: 124370424
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
@ -8831,13 +9095,13 @@
NumberOfChildren: 4 NumberOfChildren: 4
Components: Components:
Transform Component: Transform Component:
Translate: {x: 2.97949171, y: 0.1594823, z: 7.20125246} Translate: {x: -1.62782168, y: 1.24122202, z: 0.321960568}
Rotate: {x: -0, y: 0, z: -0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 0.999979734, y: 1, z: 0.999979734} Scale: {x: 0.999979734, y: 1, z: 0.999979734}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 140964851 Mesh: 140964851
Material: 126974645 Material: 124370424
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic
@ -8955,8 +9219,8 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0.0431699753, y: 1.18017197e-05, z: -0.0288243294} Translate: {x: 0.0431697369, y: 1.18017197e-05, z: -0.0288243294}
Rotate: {x: -0, y: 0, z: 0.174533099} Rotate: {x: 0, y: 0, z: 0.174533099}
Scale: {x: 0.999999881, y: 0.999999583, z: 1} Scale: {x: 0.999999881, y: 0.999999583, z: 1}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
@ -9035,13 +9299,13 @@
NumberOfChildren: 4 NumberOfChildren: 4
Components: Components:
Transform Component: Transform Component:
Translate: {x: 3.0075531, y: 0.1594823, z: 8.19898987} Translate: {x: 2.44600534, y: 0.118150897, z: 5.19178057}
Rotate: {x: -0, y: 0, z: -0} Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 0.999979734, y: 1, z: 0.999979734} Scale: {x: 0.999979734, y: 1, z: 0.999979734}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 140964851 Mesh: 140964851
Material: 126974645 Material: 124370424
IsActive: true IsActive: true
RigidBody Component: RigidBody Component:
Type: Dynamic Type: Dynamic

View File

@ -240,6 +240,8 @@ public partial class LeafPatrol : BehaviourTreeNode
{ {
//Debug.Log("Unalert"); //Debug.Log("Unalert");
Audio.PlaySFXOnce2D("event:/Homeowner/humming"); Audio.PlaySFXOnce2D("event:/Homeowner/humming");
Audio.StopAllSounds();
Audio.PlayBGMOnce2D("event:/Music/player_undetected");
} }
SetNodeData("isAlert", false); SetNodeData("isAlert", false);
} }

View File

@ -186,12 +186,18 @@ public partial class LeafSearch : BehaviourTreeNode
{ {
SetNodeData("isAlert", true); SetNodeData("isAlert", true);
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon"); Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon");
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected");
Audio.StopAllSounds();
Audio.PlayBGMOnce2D("event:/Music/player_detected");
} }
else else
{ {
if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false) if (GetNodeData("isAlert") != null && (bool)GetNodeData("isAlert") == false)
{ {
Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon"); Audio.PlaySFXOnce2D("event:/Homeowner/homeowner_detect_raccoon");
Audio.PlaySFXOnce2D("event:/Music/stingers/player_detected");
Audio.StopAllSounds();
Audio.PlayBGMOnce2D("event:/Music/player_detected");
} }
SetNodeData("isAlert", true); SetNodeData("isAlert", true);
} }

View File

@ -59,6 +59,7 @@ public class Breakable : Script
} }
isBreak = false; isBreak = false;
Audio.PlaySFXOnce2D("event:/Props/impact_break");
Owner.SetActive(false); Owner.SetActive(false);
} }
} }

View File

@ -119,7 +119,6 @@ public class PlayerController : Script
protected override void lateUpdate() protected override void lateUpdate()
{ {
//rb.FreezePositionY = false;
} }
protected override void update() protected override void update()
{ {
@ -152,6 +151,7 @@ public class PlayerController : Script
camArm = GetComponentInChildren<CameraArm>(); camArm = GetComponentInChildren<CameraArm>();
Rotation(); Rotation();
Jump();
GotCaught(); GotCaught();
//Debug.Log($"{currentState}"); //Debug.Log($"{currentState}");
//Debug.Log($" axisX: {axisMove.x} axisY:{axisMove.y}"); //Debug.Log($" axisX: {axisMove.x} axisY:{axisMove.y}");
@ -165,7 +165,6 @@ public class PlayerController : Script
MoveKey(); MoveKey();
Move(); Move();
Sprint(); Sprint();
Jump();
Gravity(); Gravity();
//Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}"); //Debug.Log($"X: {rb.LinearVelocity.x}" + $" Z: {rb.LinearVelocity.z}");
} }

View File

@ -76,33 +76,25 @@ public class GameManager : Script
if(timeText) if(timeText)
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}"; timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}";
if (timer > 0 && totalItemCount <= 0) if ((timer > 0 && totalItemCount <= 0) || Input.GetKeyDown(Input.KeyCode.F1))
{ {
currGameState = GameState.WIN; currGameState = GameState.WIN;
Audio.StopAllSounds(); Audio.StopAllSounds();
SceneManager.ChangeScene(winScene); SceneManager.ChangeScene(winScene);
Audio.PlaySFXOnce2D("event:/Music/stingers/game_win");
} }
else if(timer < 0) else if(timer < 0 || Input.GetKeyDown(Input.KeyCode.F2))
{ {
currGameState = GameState.LOSE; currGameState = GameState.LOSE;
Audio.StopAllSounds(); Audio.StopAllSounds();
SceneManager.ChangeScene(loseScene); SceneManager.ChangeScene(loseScene);
Audio.PlaySFXOnce2D("event:/Music/stingers/game_lose");
} }
} }
} }
private void Cheats() private void Cheats()
{ {
if (Input.GetKeyDown(Input.KeyCode.F1))
{
Audio.StopAllSounds();
SceneManager.ChangeScene(loseScene);
}
if (Input.GetKeyDown(Input.KeyCode.F2))
{
Audio.StopAllSounds();
SceneManager.ChangeScene(winScene);
}
if (Input.GetKeyDown(Input.KeyCode.Escape)) if (Input.GetKeyDown(Input.KeyCode.Escape))
{ {
Audio.StopAllSounds(); Audio.StopAllSounds();

View File

@ -14,12 +14,14 @@ public class EndScene : Script
if (Input.GetKey(Input.KeyCode.R)) if (Input.GetKey(Input.KeyCode.R))
{ {
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element"); Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
Audio.StopAllSounds();
SceneManager.ChangeScene(mainGameScene); SceneManager.ChangeScene(mainGameScene);
} }
if (Input.GetKey(Input.KeyCode.M)) if (Input.GetKey(Input.KeyCode.M))
{ {
Audio.PlaySFXOnce2D("event:/UI/mouse_down_element"); Audio.PlaySFXOnce2D("event:/UI/mouse_down_element");
Audio.StopAllSounds();
SceneManager.ChangeScene(mainMainScene); SceneManager.ChangeScene(mainMainScene);
} }