From 79d0326d4b0d4ed0df1ecb46405525baa57e48a7 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 14 Aug 2025 21:58:58 -0400 Subject: [PATCH] maint: deleted old and now unused movement tasks/graphs --- .../Player/Graphs/PlayerLocomotionFSM.asset | 33 ----- .../Graphs/PlayerLocomotionFSM.asset.meta | 8 -- Assets/Scripts/Core/Graph Tasks/AddJump.cs | 121 ------------------ .../Scripts/Core/Graph Tasks/AddJump.cs.meta | 2 - .../Core/Graph Tasks/CalculateAirMovement.cs | 56 -------- .../Graph Tasks/CalculateAirMovement.cs.meta | 2 - .../CalculateGroundedLocomotion.cs | 78 ----------- .../CalculateGroundedLocomotion.cs.meta | 2 - .../Core/Graph Tasks/ChangeAgentTransform.cs | 121 ------------------ .../Graph Tasks/ChangeAgentTransform.cs.meta | 2 - .../Core/Graph Tasks/FinalizeMovement.cs | 48 ------- .../Core/Graph Tasks/FinalizeMovement.cs.meta | 2 - .../Core/Graph Tasks/SetAirMovement.cs | 56 -------- .../Core/Graph Tasks/SetAirMovement.cs.meta | 2 - .../Core/Graph Tasks/UpdateRotation.cs | 88 ------------- .../Core/Graph Tasks/UpdateRotation.cs.meta | 2 - 16 files changed, 623 deletions(-) delete mode 100644 Assets/Player/Graphs/PlayerLocomotionFSM.asset delete mode 100644 Assets/Player/Graphs/PlayerLocomotionFSM.asset.meta delete mode 100644 Assets/Scripts/Core/Graph Tasks/AddJump.cs delete mode 100644 Assets/Scripts/Core/Graph Tasks/AddJump.cs.meta delete mode 100644 Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs delete mode 100644 Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs.meta delete mode 100644 Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs delete mode 100644 Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs.meta delete mode 100644 Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs delete mode 100644 Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs.meta delete mode 100644 Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs delete mode 100644 Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs.meta delete mode 100644 Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs delete mode 100644 Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs.meta delete mode 100644 Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs delete mode 100644 Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs.meta diff --git a/Assets/Player/Graphs/PlayerLocomotionFSM.asset b/Assets/Player/Graphs/PlayerLocomotionFSM.asset deleted file mode 100644 index 4f0081d..0000000 --- a/Assets/Player/Graphs/PlayerLocomotionFSM.asset +++ /dev/null @@ -1,33 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f945e777233a59f4aba40aeca29093a6, type: 3} - m_Name: PlayerLocomotionFSM - m_EditorClassIdentifier: - _serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[]},"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":327.7592,"y":812.7609},"$type":"NodeCanvas.StateMachines.ActionState"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":12.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":10.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"},{"valueA":{"_name":"facingDirection","_targetVariableID":"c713d622-aafb-43e7-ae0e-ac0b86a85a37"},"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[PlayerFacingDirection, - Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":389.9924,"y":1029.762},"$type":"NodeCanvas.StateMachines.ActionState"},{"_position":{"x":218.6569,"y":475.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"2"},{"_position":{"x":253.0,"y":606.9789},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"3"},{"_onEnterList":{"executionMode":1,"actions":[{"valueA":{"_name":"facingDirection","_targetVariableID":"c713d622-aafb-43e7-ae0e-ac0b86a85a37"},"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[PlayerFacingDirection, - Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_onUpdateList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":12.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":10.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":535.0,"y":768.0},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"4"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":30.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":1.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"},{"valueA":{"_name":"facingDirection","_targetVariableID":"c713d622-aafb-43e7-ae0e-ac0b86a85a37"},"valueB":{"_value":2},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[PlayerFacingDirection, - Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":917.0839,"y":852.7302},"$type":"NodeCanvas.StateMachines.ActionState","$id":"5"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":20.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":2.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":1161.288,"y":522.152},"$type":"NodeCanvas.StateMachines.ActionState","$id":"6"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":5.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":602.0,"y":269.0},"$type":"NodeCanvas.StateMachines.ActionState","$id":"7"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":402.0,"y":177.0},"$type":"NodeCanvas.StateMachines.ActionState","$id":"8"}],"connections":[{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"_isDisabled":true,"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"eventName":{"_value":"Grapple - Aimed"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"7"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"eventName":{"_value":"Grapple - Confirmed"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"8"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Sprint"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"timeout":{"_value":0.1},"$type":"NodeCanvas.Tasks.Conditions.Timeout"},"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"checkAgainst":2,"checkAgainstValue":{"_value":{"z":1.0}},"desiredValue":{"_value":1.0},"tolerance":{"_value":0.32},"considerCameraRotation":{},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"321e55c7-f93e-4667-a0dc-559eb61c6898","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean, - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3, - UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"rotationSpeed":{"_name":"rotationSpeed","_id":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[System.Single, - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"facingDirection":{"_name":"facingDirection","_id":"c713d622-aafb-43e7-ae0e-ac0b86a85a37","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[PlayerFacingDirection, - Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}}}' - _objectReferences: [] - _graphSource: - _version: 3.31 - _category: - _comments: - _translation: {x: 467, y: -132} - _zoomFactor: 0.9793777 - _haltSerialization: 0 - _externalSerializationFile: {fileID: 0} diff --git a/Assets/Player/Graphs/PlayerLocomotionFSM.asset.meta b/Assets/Player/Graphs/PlayerLocomotionFSM.asset.meta deleted file mode 100644 index 53657fe..0000000 --- a/Assets/Player/Graphs/PlayerLocomotionFSM.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b307c218c1a404548afe65e66737fa80 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Core/Graph Tasks/AddJump.cs b/Assets/Scripts/Core/Graph Tasks/AddJump.cs deleted file mode 100644 index 2ac3476..0000000 --- a/Assets/Scripts/Core/Graph Tasks/AddJump.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Linq; -using NodeCanvas.Framework; -using ParadoxNotion; -using ParadoxNotion.Design; -using UnityEngine; -using UnityEngine.InputSystem; -using Reset.Player.Movement; - -namespace NodeCanvas.Tasks.Actions { - [Category("Reset/Movement")] - public class AddJump : ActionTask { - public BBParameter airMoveDirection; - public BBParameter jumpPower; - - [Space(5)] - public BBParameter jumpStrength; - - [SliderField(0, 1)] - public BBParameter standStillJumpStrength; - - [Tooltip("Determines how much current movement vectors into jump direction")] - [SliderField(0, 1)] - public BBParameter currentVelocityInheritence; - public BBParameter directionalForce; - - [SliderField(0, 1)] - public BBParameter directionalForceStrength; - - protected override string info { - get{ - string dirStrength = ""; - - if (directionalForce.value != Vector3.zero && directionalForceStrength.value > 0f) { - dirStrength = $", towards {directionalForce.value} * {directionalForceStrength.value}"; - } - - return string.Format($"Start Jump, {jumpStrength.value} strength" + dirStrength); - } - } - - //Use for initialization. This is called only once in the lifetime of the task. - //Return null if init was successfull. Return an error string otherwise - protected override string OnInit(){ - return null; - } - - //This is called once each time the task is enabled. - //Call EndAction() to mark the action as finished, either in success or failure. - //EndAction can be called from anywhere. - protected override void OnExecute(){ - // Set jump power - jumpPower.value = jumpStrength.value; - - // Save current velocity and get current input direction - Vector3 currentVelocityVector3 = new Vector3(agent.velocity.x, 0f, agent.velocity.z); - Vector2 currentInput = agent.GetComponent().rawMoveInput; - Vector3 currentInputVector3 = new Vector3(currentInput.x, 0f, currentInput.y); - - // Ignore rotation for the current velocity - Vector3 currentVelocityWorld = agent.transform.InverseTransformDirection(currentVelocityVector3.normalized); - - // Get the dot product between current velocity's direction and current input (UNUSED FOR NOW) - float velocityInputDot = Vector3.Dot(currentVelocityWorld, currentInputVector3); - - // Set air move direction - if (agent.isGrounded) { - airMoveDirection.value = currentVelocityVector3; - } else { - // Hold new desired air direction and Dot against the existing air moving directioin - Vector3 desiredAirMoveDirection = currentInputVector3; - float airMoveDirectionDot = Vector3.Dot(desiredAirMoveDirection.normalized, airMoveDirection.value.normalized); - - // Check threshold of current XZ velocity- if it's too close to zero, use the jumpStrength for jumping velocity. If it's not, use the current velocity - float velocityThreshold = 4f; - float magnitudeZeroDifference = Mathf.Clamp(currentVelocityVector3.magnitude - velocityThreshold, 0f, Mathf.Infinity) / velocityThreshold; // Divided by maximum to return a 0-1 value. Clamping not required. - float outputHoritontalVelocity = Mathf.Lerp(jumpStrength.value, currentVelocityVector3.magnitude, Math.Clamp(magnitudeZeroDifference, 0f, 1f)); - - outputHoritontalVelocity = Mathf.Min(outputHoritontalVelocity, Mathf.Lerp(standStillJumpStrength.value * jumpStrength.value, jumpStrength.value * .4f, magnitudeZeroDifference)); - - // Do the same for directional jump strength - outputHoritontalVelocity = Mathf.Lerp(outputHoritontalVelocity, jumpStrength.value, directionalForceStrength.value); - - // Remap the dot to set -1 (opposing direction) to -.5f, and 1 (same direciton) to 1.2f - // This is done to allow some sideways jumping direction change, but none backwards, and all forwards - float remappedAirDirectionDot = Mathf.Lerp(.1f, 1.2f, airMoveDirectionDot); - remappedAirDirectionDot = Mathf.Clamp(remappedAirDirectionDot, 0f, 1f); - - // Lerp between the current direction and the inputted direction based on the previous dot product - Vector3 outputDirection = Vector3.Lerp(currentInputVector3.normalized, currentVelocityVector3.normalized, remappedAirDirectionDot); - - // If there is a directional force (such as the Wall Climb jump going straight upward) supplied in the task, lean into that based on it's strength - outputDirection = Vector3.Lerp(outputDirection, directionalForce.value.normalized, directionalForceStrength.value).normalized; - - // Extra math to degrade current air move direction by velocity inheritence, before applying new air direction - airMoveDirection.value *= currentVelocityInheritence.value; - - // Account for the camera's rotation before setting it as the air move direction - outputDirection = Camera.main.transform.rotation.Flatten(0, null, 0) * outputDirection; - - // Set air move direction - airMoveDirection.value += outputDirection * outputHoritontalVelocity; - } - EndAction(true); - } - - //Called once per frame while the action is active. - protected override void OnUpdate(){ - } - - //Called when the task is disabled. - protected override void OnStop() { - - } - - //Called when the task is paused. - protected override void OnPause() { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/AddJump.cs.meta b/Assets/Scripts/Core/Graph Tasks/AddJump.cs.meta deleted file mode 100644 index 455695b..0000000 --- a/Assets/Scripts/Core/Graph Tasks/AddJump.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 86e5b037e41d5bb4b8805890ee72ad29 \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs b/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs deleted file mode 100644 index 120c30c..0000000 --- a/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs +++ /dev/null @@ -1,56 +0,0 @@ -using NodeCanvas.Framework; -using ParadoxNotion.Design; -using UnityEngine; -using Reset.Player.Movement; - -namespace NodeCanvas.Tasks.Actions { - - [Category("Reset/Movement")] - public class CalculateAirMovement : ActionTask{ - public BBParameter airMoveDirection; - public BBParameter groundMoveDirection; // Unused on 7/29/25, delete if still unusued later - - private float airControlPower = 1f; - - //Use for initialization. This is called only once in the lifetime of the task. - //Return null if init was successfull. Return an error string otherwise - protected override string OnInit() { - return null; - } - - //This is called once each time the task is enabled. - //Call EndAction() to mark the action as finished, either in success or failure. - //EndAction can be called from anywhere. - protected override void OnExecute(){ - airControlPower = 1f; - } - - //Called once per frame while the action is active. - protected override void OnUpdate() { - // Decay Current Air Movement - airMoveDirection.value = Vector3.Lerp(airMoveDirection.value, Vector3.zero, .7f * Time.deltaTime); - - // Decay Air Control power - airControlPower = Mathf.Lerp(airControlPower, 0f, 2f * Time.deltaTime); - - // Add air control - Vector3 inputVector3 = new(agent.GetComponent().rawMoveInput.x, 0f, agent.GetComponent().rawMoveInput.y); - float originalMagnitude = airMoveDirection.value.magnitude; - airMoveDirection.value += Camera.main.transform.rotation.Flatten(0, null, 0) * - inputVector3 * airControlPower; - - airMoveDirection.value = Vector3.ClampMagnitude(airMoveDirection.value, originalMagnitude); - } - - //Called when the task is disabled. - protected override void OnStop() { - // groundMoveDirection.value = agent.GetComponent().velocity; - EndAction(true); - } - - //Called when the task is paused. - protected override void OnPause() { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs.meta b/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs.meta deleted file mode 100644 index 9985c5e..0000000 --- a/Assets/Scripts/Core/Graph Tasks/CalculateAirMovement.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 38d61a72cc7757448b3db6c04395cf91 \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs b/Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs deleted file mode 100644 index 38f2161..0000000 --- a/Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs +++ /dev/null @@ -1,78 +0,0 @@ -using NodeCanvas.Framework; -using ParadoxNotion.Design; -using UnityEngine; - - -namespace NodeCanvas.Tasks.Actions { - - [Category("Reset/Movement")] - [Description("Unit flat ground movement")] - public class CalculateGroundedLocomotion : ActionTask{ - public BBParameter moveSpeed; - - - public BBParameter moveDirection; - - protected override string info { - get{ - return string.Format($"Set ground movement, {moveSpeed.value} speed"); - } - } - - private float sprintPower; - private bool sprinting; - - //Use for initialization. This is called only once in the lifetime of the task. - //Return null if init was successfull. Return an error string otherwise - protected override string OnInit() { - return null; - } - - //This is called once each time the task is enabled. - //Call EndAction() to mark the action as finished, either in success or failure. - //EndAction can be called from anywhere. - protected override void OnExecute() { - - } - - //Called once per frame while the action is active. - protected override void OnUpdate() { - // Get current input direction - Vector3 flatSurfaceDirection = Vector3.zero; - - if (agent.isGrounded) { - Vector2 rawInput = agent.transform.GetComponent().rawMoveInput; - flatSurfaceDirection = new(rawInput.x, 0, rawInput.y); - } - - float CalculateSpeed(){ - // Calculate sprinting speed - float outputSpeed = 0f; - - // Add base speed - outputSpeed += moveSpeed.value; - - return outputSpeed; - } - - // Rotate input to forward direction for flat surface - // flatSurfaceDirection = agent.transform.rotation * flatSurfaceDirection; - - // Finalize flat surface direction by adding speed - flatSurfaceDirection *= CalculateSpeed(); - - moveDirection.value = flatSurfaceDirection; - EndAction(true); - } - - //Called when the task is disabled. - protected override void OnStop() { - - } - - //Called when the task is paused. - protected override void OnPause() { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs.meta b/Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs.meta deleted file mode 100644 index 67edc7c..0000000 --- a/Assets/Scripts/Core/Graph Tasks/CalculateGroundedLocomotion.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 808dc54c4ce75e846890125a4f87e516 \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs b/Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs deleted file mode 100644 index 1700572..0000000 --- a/Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using NodeCanvas.Framework; -using ParadoxNotion.Design; -using ParadoxNotion.Serialization.FullSerializer; -using Sirenix.OdinInspector; -using UnityEngine; - -namespace NodeCanvas.Tasks.Actions { - - [Category("Reset")] - [Description("Update the agent's position and rotation (scale too, sure whynot) either instantly or over time.")] - public class ChangeAgentTransform : ActionTask{ - public enum TransformProperty{ - Position, - Rotation, - Scale - } - - protected override string info { - get{ - string basicText = string.Format($"Player {targetProperty.ToString()} to {(targetValue.isPresumedDynamic ? targetValue.name : targetValue.value)}"); - basicText += relativeToSelf.value ? ", relative to Self" : ""; - - return basicText; - } - } - - public TransformProperty targetProperty; - - [ParadoxNotion.Design.ShowIf("targetProperty", 1), Space(5)] - public BBParameter forcePositionChange; - - public BBParameter targetValue; - - public BBParameter relativeToSelf; - - [Tooltip("Set this to the current position if you're trying to rotate by 'this much'. Keep it zero for world space values.")] - public BBParameter relativeValue; - - public BBParameter changeInstantly; - public BBParameter smoothing; - - private Vector3 currentVel; - - - //Use for initialization. This is called only once in the lifetime of the task. - //Return null if init was successfull. Return an error string otherwise - protected override string OnInit() { - return null; - } - - //This is called once each time the task is enabled. - //Call EndAction() to mark the action as finished, either in success or failure. - //EndAction can be called from anywhere. - protected override void OnExecute() { - switch (targetProperty) { - case TransformProperty.Position: - Vector3 relativeUseValue = relativeValue.value; - if (relativeToSelf.value) { - relativeUseValue = agent.transform.position; - } - - if (changeInstantly.value) { - agent.Move(agent.transform.position.DirectionTo(relativeUseValue + targetValue.value)); - } - - break; - case TransformProperty.Rotation: - agent.transform.rotation = Quaternion.LookRotation(relativeValue.value) * Quaternion.Euler(targetValue.value); - break; - case TransformProperty.Scale: - break; - default: - throw new ArgumentOutOfRangeException(); - } - - if (changeInstantly.value) { - EndAction(true); - } - } - - //Called once per frame while the action is active. - protected override void OnUpdate() { - switch (targetProperty) { - case TransformProperty.Position: - Vector3 relativeUseValue = relativeValue.value; - if (relativeToSelf.value) { - relativeUseValue = agent.transform.position; - } - - if (!changeInstantly.value) { - Vector3 targetPosition = relativeUseValue + targetValue.value; - // agent.transform.position = Vector3.SmoothDamp(agent.transform.position, targetPosition, - // ref currentVel, smoothing.value * Time.deltaTime); - - agent.Move((agent.transform.position.DirectionTo(targetPosition)).normalized * .5f * Mathf.Lerp(0, 1, Vector3.Distance(agent.transform.position, targetPosition)) * smoothing.value * Time.deltaTime); - EndAction(); - } - - break; - case TransformProperty.Rotation: - agent.transform.rotation = Quaternion.Euler(relativeValue.value) * Quaternion.Euler(targetValue.value); - break; - case TransformProperty.Scale: - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - - //Called when the task is disabled. - protected override void OnStop() { - - } - - //Called when the task is paused. - protected override void OnPause() { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs.meta b/Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs.meta deleted file mode 100644 index 5bdbb3d..0000000 --- a/Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: b77e2b9ac9aad644480508d5a86f4006 \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs b/Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs deleted file mode 100644 index 10734ea..0000000 --- a/Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs +++ /dev/null @@ -1,48 +0,0 @@ -using NodeCanvas.Framework; -using ParadoxNotion.Design; -using UnityEngine; - -namespace Reset.Movement { - - [Category("Reset/Movement")] - [Description("Finalize the move direction to the agent's CharacterController")] - public class FinalizeMovement : ActionTask{ - public BBParameter moveDirection; - public BBParameter currentSpeed; - - //Use for initialization. This is called only once in the lifetime of the task. - //Return null if init was successfull. Return an error string otherwise - protected override string OnInit() { - if (currentSpeed == null || !currentSpeed.useBlackboard) { - Debug.LogError("This Finalize Movement does not have it's current value attached to a Blackboard variable. Nothing will happen.", agent.gameObject); - } - return null; - } - - //This is called once each time the task is enabled. - //Call EndAction() to mark the action as finished, either in success or failure. - //EndAction can be called from anywhere. - protected override void OnExecute(){ - - } - - //Called once per frame while the action is active. - protected override void OnUpdate(){ - Vector3 usableVector3 = new Vector3(moveDirection.value.x * currentSpeed.value, moveDirection.value.y, moveDirection.value.z * currentSpeed.value); - agent.Move(Camera.main.transform.rotation * usableVector3 * Time.deltaTime); - - Debug.Log("Finalize Done"); - // EndAction(true); - } - - //Called when the task is disabled. - protected override void OnStop() { - - } - - //Called when the task is paused. - protected override void OnPause() { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs.meta b/Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs.meta deleted file mode 100644 index c2256de..0000000 --- a/Assets/Scripts/Core/Graph Tasks/FinalizeMovement.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: fea4d34f26d30b24e8cb99acf1766b6f \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs b/Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs deleted file mode 100644 index 796a5fc..0000000 --- a/Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs +++ /dev/null @@ -1,56 +0,0 @@ -using NodeCanvas.Framework; -using ParadoxNotion.Design; -using UnityEngine; - - -namespace NodeCanvas.Tasks.Actions { - - [Category("Reset")] - [Description("Hard set the air direction to a certain direction")] - public class SetAirMovement : ActionTask{ - public BBParameter airMoveDirection; - - public BBParameter inputVector3; - public Space fromSpace; - public Space toSpace; - - //Use for initialization. This is called only once in the lifetime of the task. - //Return null if init was successfull. Return an error string otherwise - protected override string OnInit() { - return null; - } - - //This is called once each time the task is enabled. - //Call EndAction() to mark the action as finished, either in success or failure. - //EndAction can be called from anywhere. - protected override void OnExecute(){ - - } - - //Called once per frame while the action is active. - protected override void OnUpdate() { - if (fromSpace == toSpace) { - airMoveDirection.value = inputVector3.value; - } - - // NOTE: I swear to God these absolutely do not work and nobody could convince me otherwise - if (fromSpace == Space.World){ - airMoveDirection.value = Camera.main.transform.rotation.Flatten(0, null, 0) * inputVector3.value; - } else { - airMoveDirection.value = Camera.main.transform.rotation.Flatten(0, null, 0) * agent.InverseTransformVector(inputVector3.value); - } - - EndAction(true); - } - - //Called when the task is disabled. - protected override void OnStop() { - - } - - //Called when the task is paused. - protected override void OnPause() { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs.meta b/Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs.meta deleted file mode 100644 index 71d42c5..0000000 --- a/Assets/Scripts/Core/Graph Tasks/SetAirMovement.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: f1db555b92ed94543beab7a2106bc2a3 \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs b/Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs deleted file mode 100644 index e96ee01..0000000 --- a/Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs +++ /dev/null @@ -1,88 +0,0 @@ -using NodeCanvas.Framework; -using ParadoxNotion.Design; -using Reset.Movement; -using UnityEngine; -using UnityEngine.TextCore.Text; - - -namespace Reset.Player.Movement { - [Category("Reset/Movement")] - [Description("Finalizes the character rotation and commits it to the Transform")] - // TODO: Rename to UpdateRotation - public class UpdateRotation : ActionTask { - // Rotation - public BBParameter moveDirection; - - public BBParameter playerFacingDirection; - public BBParameter rotationSpeed = 5f; - public BBParameter rotationSmoothing; - - private Vector3 currentMoveDir; - private PlayerControls controls; - - private Quaternion targetRotation; - private float currentRotSpeed; - - [ShowIf("playerFacingDirection", 0)] - public Vector3 rotationTargetPosition; - - //Use for initialization. This is called only once in the lifetime of the task. - //Return null if init was successfull. Return an error string otherwise - protected override string OnInit() { - controls = agent.GetComponent(); - return null; - } - - //Called once per frame while the action is active. - protected override void OnUpdate() { - // Calculate rotation speed - currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime); - - // Set ingitial rotation power - currentRotSpeed = rotationSpeed.value; - - // Get input value - Vector3 inputMovement = new Vector3(controls.rawMoveInput.x, 0f, controls.rawMoveInput.y); - - switch (playerFacingDirection.value) { - case PlayerFacingDirection.TowardsTarget: - // Set rotation to just the direction of the target - targetRotation = Quaternion.LookRotation((agent.transform.position.DirectionTo(rotationTargetPosition)).Flatten(null, 0)); - - break; - case PlayerFacingDirection.MatchForward: - if (controls.rawMoveInput.magnitude < 0.01f) { break; } - - targetRotation = Quaternion.LookRotation(inputMovement) * - Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f)); - - break; - case PlayerFacingDirection.MatchCamera: - // Craft a new rotation that flattens the camera's rotation to the ground - // Needed to keep the character from inheriting the camera's height-rotation - targetRotation = Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0, null, 0)); - break; - case PlayerFacingDirection.Static: - targetRotation = agent.transform.rotation; - break; - - } - - // Set final rotation - agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime).Flatten(0, null, 0); - - Debug.Log("Rotation Done"); - EndAction(true); - } - - //Called when the task is disabled. - protected override void OnStop() { - - } - - //Called when the task is paused. - protected override void OnPause() { - - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs.meta b/Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs.meta deleted file mode 100644 index bb189a1..0000000 --- a/Assets/Scripts/Core/Graph Tasks/UpdateRotation.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 7a0fd0ebfb8888b4e8ab4c81fb3aa6c0 \ No newline at end of file