From 64bbc4d67a284b8f81f993d0da76f1eebd5c65de Mon Sep 17 00:00:00 2001 From: Glence Date: Thu, 23 Mar 2023 16:49:41 +0800 Subject: [PATCH] scenes update, setActive message removed, expose Emitcount --- Assets/Scenes/Level1.shade | 65 ++++++++++++++++++- Assets/Scenes/Level3.shade | 65 ++++++++++++++++++- Assets/Scripts/Gameplay/Item/SC_Item.cs | 11 +++- .../Player/PlayerStates/UT_PlayerRunState.cs | 5 +- .../Player/PlayerStates/UT_PlayerWalkState.cs | 2 + .../Gameplay/Player/SC_PlayerController.cs | 16 +++-- SHADE_Engine/src/Scene/SHSceneGraph.cpp | 3 +- .../src/Components/ParticleEmitter.cxx | 10 +++ .../src/Components/ParticleEmitter.hxx | 6 ++ 9 files changed, 172 insertions(+), 11 deletions(-) diff --git a/Assets/Scenes/Level1.shade b/Assets/Scenes/Level1.shade index 57796679..dfd29855 100644 --- a/Assets/Scenes/Level1.shade +++ b/Assets/Scenes/Level1.shade @@ -7501,7 +7501,7 @@ - EID: 65775 Name: Player IsActive: true - NumberOfChildren: 6 + NumberOfChildren: 8 Components: Transform Component: Translate: {x: -8, y: 0.899999976, z: -4} @@ -7547,6 +7547,7 @@ Scripts: - Type: PlayerController Enabled: true + smokeCount: 4 respawnPoint: 65732 currentState: 0 walkMaxMoveVel: 2.5 @@ -7565,6 +7566,8 @@ heavyMultiper: 0.5 silhouettePlayer: 462 silhouetteBag: 465 + leftParticle: 573 + rightParticle: 574 - Type: PickAndThrow Enabled: true throwForce: [8, 4, 8] @@ -7723,6 +7726,66 @@ "Color Eval Rate ": 0.5 IsActive: true Scripts: ~ +- EID: 573 + Name: LeftSmoke + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 0.0899999142, y: 0.100000001, z: -6.25735765e-08} + Rotate: {x: -5.83341553e-08, y: -3.14159274, z: 1.10461471e-08} + Scale: {x: 1.00000012, y: 1, z: 1.00000012} + IsActive: true + classSHADE::SHParticleEmitterComponent: + Emission Count: 8 + Is Passive: false + Emission Interval: 0 + Min Life: 0.100000001 + Max Life: 2 + Minimum Speed: 1 + Maximum Speed: 1.5 + Minimum Size: 0.100000001 + Maximum Size: 0.100000001 + Size Decay: 0.907000005 + Angular Ranges And Offset: {x: 0.779999971, y: 0, z: -1.57070005, w: 0} + Rotation Speed: 0.805999994 + Rotation Decay: 0 + Texture Asset ID: 56224060 + Custom Update Shader Asset ID: 42141152 + Color Tint: {x: 1, y: 1, z: 1, w: 1} + Acceleration: {x: 0, y: 0.0500000007, z: 0} + IsActive: true + Scripts: ~ +- EID: 574 + Name: RightSmoke + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: -0.0900000036, y: 0.100000001, z: -1.03427794e-07} + Rotate: {x: -5.83341553e-08, y: -3.14159274, z: 1.10461471e-08} + Scale: {x: 1.00000012, y: 1, z: 1.00000012} + IsActive: true + classSHADE::SHParticleEmitterComponent: + Emission Count: 8 + Is Passive: false + Emission Interval: 0 + Min Life: 0.100000001 + Max Life: 2 + Minimum Speed: 1 + Maximum Speed: 1.5 + Minimum Size: 0.100000001 + Maximum Size: 0.100000001 + Size Decay: 0.907000005 + Angular Ranges And Offset: {x: 0.779999971, y: 0, z: -1.57070005, w: 0} + Rotation Speed: 0.805999994 + Rotation Decay: 0 + Texture Asset ID: 56224060 + Custom Update Shader Asset ID: 42141152 + Color Tint: {x: 1, y: 1, z: 1, w: 1} + Acceleration: {x: 0, y: 0.0500000007, z: 0} + IsActive: true + Scripts: ~ - EID: 65732 Name: RespawnPoint IsActive: true diff --git a/Assets/Scenes/Level3.shade b/Assets/Scenes/Level3.shade index 3d1bdbf3..70d69a38 100644 --- a/Assets/Scenes/Level3.shade +++ b/Assets/Scenes/Level3.shade @@ -11964,7 +11964,7 @@ - EID: 65775 Name: Player IsActive: true - NumberOfChildren: 6 + NumberOfChildren: 8 Components: Transform Component: Translate: {x: 5.5, y: 0.171148509, z: 10} @@ -12010,6 +12010,7 @@ Scripts: - Type: PlayerController Enabled: true + smokeCount: 4 respawnPoint: 66065 currentState: 0 walkMaxMoveVel: 2.5 @@ -12028,6 +12029,8 @@ heavyMultiper: 0.5 silhouettePlayer: 462 silhouetteBag: 465 + leftParticle: 66138 + rightParticle: 66137 - Type: PickAndThrow Enabled: true throwForce: [10, 4, 10] @@ -12182,6 +12185,66 @@ "Color Eval Rate ": 0.5 IsActive: true Scripts: ~ +- EID: 66138 + Name: LeftSmoke + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: 0.0899999142, y: 0.100000001, z: -6.25735765e-08} + Rotate: {x: -5.83341553e-08, y: -3.14159274, z: 1.10461471e-08} + Scale: {x: 1.00000012, y: 1, z: 1.00000012} + IsActive: true + classSHADE::SHParticleEmitterComponent: + Emission Count: 8 + Is Passive: false + Emission Interval: 0 + Min Life: 0.100000001 + Max Life: 2 + Minimum Speed: 1 + Maximum Speed: 1.5 + Minimum Size: 0.100000001 + Maximum Size: 0.100000001 + Size Decay: 0.907000005 + Angular Ranges And Offset: {x: 0.779999971, y: 0, z: -1.57070005, w: 0} + Rotation Speed: 0.805999994 + Rotation Decay: 0 + Texture Asset ID: 56224060 + Custom Update Shader Asset ID: 42141152 + Color Tint: {x: 1, y: 1, z: 1, w: 1} + Acceleration: {x: 0, y: 0.0500000007, z: 0} + IsActive: true + Scripts: ~ +- EID: 66137 + Name: RightSmoke + IsActive: true + NumberOfChildren: 0 + Components: + Transform Component: + Translate: {x: -0.0900000036, y: 0.100000001, z: -1.03427794e-07} + Rotate: {x: -5.83341553e-08, y: -3.14159274, z: 1.10461471e-08} + Scale: {x: 1.00000012, y: 1, z: 1.00000012} + IsActive: true + classSHADE::SHParticleEmitterComponent: + Emission Count: 8 + Is Passive: false + Emission Interval: 0 + Min Life: 0.100000001 + Max Life: 2 + Minimum Speed: 1 + Maximum Speed: 1.5 + Minimum Size: 0.100000001 + Maximum Size: 0.100000001 + Size Decay: 0.907000005 + Angular Ranges And Offset: {x: 0.779999971, y: 0, z: -1.57070005, w: 0} + Rotation Speed: 0.805999994 + Rotation Decay: 0 + Texture Asset ID: 56224060 + Custom Update Shader Asset ID: 42141152 + Color Tint: {x: 1, y: 1, z: 1, w: 1} + Acceleration: {x: 0, y: 0.0500000007, z: 0} + IsActive: true + Scripts: ~ - EID: 66065 Name: RespawnPoint IsActive: true diff --git a/Assets/Scripts/Gameplay/Item/SC_Item.cs b/Assets/Scripts/Gameplay/Item/SC_Item.cs index 3fdeee6e..185dbe83 100644 --- a/Assets/Scripts/Gameplay/Item/SC_Item.cs +++ b/Assets/Scripts/Gameplay/Item/SC_Item.cs @@ -25,6 +25,7 @@ public class Item : Script private bool checkSound = false; + private bool homeownerOnce = true; public float soundDistance = 10; private float highlightPos = 0.0f; @@ -98,8 +99,11 @@ public class Item : Script rb.ClearTorque(); } - if(transform) + if (transform) + { + transform.LocalEulerAngles = Vector3.Zero; transform.LocalPosition = firstPostion; + } returnBack = false; } @@ -143,11 +147,11 @@ public class Item : Script if(emitter) emitter.Emit(); - Debug.Log("EMIT"); } - if (info.GameObject.GetScript() && !returnBack) + if (info.GameObject.GetScript() && homeownerOnce) { + homeownerOnce = false; returnBack = true; } } @@ -156,6 +160,7 @@ public class Item : Script { playSound = true; checkSound = true; + homeownerOnce = true; } } \ No newline at end of file diff --git a/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerRunState.cs b/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerRunState.cs index 3aecd26a..b0d9286e 100644 --- a/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerRunState.cs +++ b/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerRunState.cs @@ -15,8 +15,11 @@ public class PlayerRunState : BaseState public override void OnEnter() { //Debug.Log("WALK ENTER"); - AudioHandler.audioClipHandlers["footsteps"].Play(); timer = delay; + machine.GetScript().playLandedAnimation = false; + machine.GetScript().Leftsmoke.EmissionCount = machine.GetScript().smokeCount * 4; + machine.GetScript().Rightsmoke.EmissionCount = machine.GetScript().smokeCount * 4; + if (PlayerAnimations.Instance) { PlayerAnimations.Instance.playerAnimator.Play(PlayerAnimations.Instance.playerRunClip); diff --git a/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerWalkState.cs b/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerWalkState.cs index 57b2fd1a..58b67867 100644 --- a/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerWalkState.cs +++ b/Assets/Scripts/Gameplay/Player/PlayerStates/UT_PlayerWalkState.cs @@ -15,6 +15,8 @@ public class PlayerWalkState : BaseState { //Debug.Log("WALK ENTER"); timer = delay; + machine.GetScript().Leftsmoke.EmissionCount = machine.GetScript().smokeCount; + machine.GetScript().Rightsmoke.EmissionCount = machine.GetScript().smokeCount; machine.GetScript().playLandedAnimation = false; diff --git a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs index 899903e1..25b3ac44 100644 --- a/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs +++ b/Assets/Scripts/Gameplay/Player/SC_PlayerController.cs @@ -26,6 +26,7 @@ public class PlayerController : Script public StateMachine stateMachine { get; set; } public ParticleEmitter Leftsmoke { get; set; } public ParticleEmitter Rightsmoke { get; set; } + public int smokeCount = 4; public bool holdItem { get; set; } public bool isAiming { get; set; } @@ -222,7 +223,6 @@ public class PlayerController : Script } } - GotCaught(); Rotation(); MoveKey(); @@ -305,11 +305,11 @@ public class PlayerController : Script private void Move() { - if (rb != null && currentState != RaccoonStates.CAUGHT) + if (rb && currentState != RaccoonStates.CAUGHT) { rb.LinearVelocity += new Vector3(axisMove.x * moveForce, 0.0f, axisMove.y * moveForce) * Time.DeltaTimeF; - if (isMoveKeyPress && rb) + if (isMoveKeyPress) { Vector3 velNor = rb.LinearVelocity; velNor.y = 0.0f; @@ -348,6 +348,13 @@ public class PlayerController : Script } } + if (Input.GetKey(Input.KeyCode.LeftShift) && !isMoveKeyPress && isGrounded) + { + currentState = RaccoonStates.IDLE; + if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) + stateMachine.SetState(typeof(PlayerIdleState)); + } + if (Input.GetKeyUp(Input.KeyCode.LeftShift)) { if (isMoveKeyPress && isGrounded) @@ -356,7 +363,7 @@ public class PlayerController : Script if (stateMachine && !stateMachine.IsState(typeof(PlayerWalkState))) stateMachine.SetState(typeof(PlayerWalkState)); } - else if(!isMoveKeyPress && isGrounded) + else if (!isMoveKeyPress && isGrounded) { currentState = RaccoonStates.IDLE; if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState))) @@ -496,6 +503,7 @@ public class PlayerController : Script if (holdItem) { holdItem = false; + Debug.Log("PLAYER RETURN"); pat.item.GetScript().returnBack = true; } if (isAiming) diff --git a/SHADE_Engine/src/Scene/SHSceneGraph.cpp b/SHADE_Engine/src/Scene/SHSceneGraph.cpp index b876f5b0..4a610087 100644 --- a/SHADE_Engine/src/Scene/SHSceneGraph.cpp +++ b/SHADE_Engine/src/Scene/SHSceneGraph.cpp @@ -316,7 +316,8 @@ namespace SHADE // Error handling if (!SHEntityManager::IsValidEID(entityID)) { - SHLOG_ERROR("Entity {} is invalid!", entityID) + //geting spamed called, need to look into it + SHLOG_ERROR_D("Entity {} is invalid!", entityID) return; } diff --git a/SHADE_Managed/src/Components/ParticleEmitter.cxx b/SHADE_Managed/src/Components/ParticleEmitter.cxx index a5bbf350..f1fd2fe4 100644 --- a/SHADE_Managed/src/Components/ParticleEmitter.cxx +++ b/SHADE_Managed/src/Components/ParticleEmitter.cxx @@ -17,6 +17,16 @@ namespace SHADE } + System::Int32 ParticleEmitter::EmissionCount::get() + { + return (GetNativeComponent()->GetEmissionCount()); + } + + void ParticleEmitter::EmissionCount::set(System::Int32 val) + { + GetNativeComponent()->SetEmissionCount(val); + } + float ParticleEmitter::EmissionInterval::get() { return (GetNativeComponent()->GetEmissionInterval()); diff --git a/SHADE_Managed/src/Components/ParticleEmitter.hxx b/SHADE_Managed/src/Components/ParticleEmitter.hxx index 686d0a83..37779086 100644 --- a/SHADE_Managed/src/Components/ParticleEmitter.hxx +++ b/SHADE_Managed/src/Components/ParticleEmitter.hxx @@ -24,6 +24,12 @@ namespace SHADE void set(bool val); } + property System::Int32 EmissionCount + { + System::Int32 get(); + void set(System::Int32 val); + } + property float EmissionInterval { float get();