From f0c7b8f86303365ba0894f9bf47db39a71db7dfd Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 10 Sep 2025 19:02:56 -0400 Subject: [PATCH] change: adding stats to combat movement --- .../Animations/Attacks/AttackCombo1.asset | 12 ++++++++++-- Assets/Scripts/Items/Interfaces/IEquipable.cs | 9 +++++---- Assets/Scripts/Player/Inventory.cs | 16 ++++++++++++++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Assets/Player/Models/MaruTestModel/Animations/Attacks/AttackCombo1.asset b/Assets/Player/Models/MaruTestModel/Animations/Attacks/AttackCombo1.asset index e785e23..541a3d8 100644 --- a/Assets/Player/Models/MaruTestModel/Animations/Attacks/AttackCombo1.asset +++ b/Assets/Player/Models/MaruTestModel/Animations/Attacks/AttackCombo1.asset @@ -12,13 +12,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3} m_Name: AttackCombo1 m_EditorClassIdentifier: NodeCanvas::NodeCanvas.BehaviourTrees.BehaviourTree - _serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"policy":1,"_position":{"x":381.0,"y":180.0},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"0"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":232.0,"y":320.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"1"},{"_action":{"field":{"_baseInfo":"Reset.Units.UnitMovementHandler|outputMoveDirection"},"setValue":{"_type":"UnityEngine.Vector3","_value":{"z":0.57,"$type":"UnityEngine.Vector3"}},"$type":"NodeCanvas.Tasks.Actions.SetField","$version":1},"_position":{"x":101.0,"y":426.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"2"},{"_position":{"x":506.0,"y":339.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"3"},{"_action":{"actions":[{"parameter":{"_value":"Melee"},"parameterHashID":{},"overrideAgent":{"_type":"UnityEngine.Animator","_name":"myAnimator","_targetVariableID":"2b9f09c0-47f9-42d4-8832-3ba15765ced5"},"$type":"NodeCanvas.Tasks.Actions.MecanimSetTrigger"},{"waitTime":{"_value":0.35},"$type":"NodeCanvas.Tasks.Actions.Wait"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":477.0,"y":445.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"4"},{"_action":{"actions":[{"parameter":{"_value":"Melee"},"parameterHashID":{},"overrideAgent":{"_type":"UnityEngine.Animator","_name":"myAnimator","_targetVariableID":"2b9f09c0-47f9-42d4-8832-3ba15765ced5"},"$type":"NodeCanvas.Tasks.Actions.MecanimSetTrigger"},{"waitTime":{"_value":0.2},"$type":"NodeCanvas.Tasks.Actions.Wait"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":675.0,"y":445.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"},{"_action":{"actions":[{"parameter":{"_value":"Melee"},"parameterHashID":{},"overrideAgent":{"_type":"UnityEngine.Animator","_name":"myAnimator","_targetVariableID":"2b9f09c0-47f9-42d4-8832-3ba15765ced5"},"$type":"NodeCanvas.Tasks.Actions.MecanimSetTrigger"},{"waitTime":{"_value":0.5},"$type":"NodeCanvas.Tasks.Actions.Wait"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":874.0,"y":442.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"6"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}' + _serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"policy":1,"_position":{"x":358.7176,"y":177.9743},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"0"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":208.7047,"y":317.9743},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"1"},{"_action":{"actions":[{"method":{"_baseInfo":"Reset.Units.UnitMovementHandler|SmoothToSpeed|System.Void","_paramsInfo":"System.Single|System.Single"},"parameters":[{"_type":"System.Single","_value":{"$content":10.0,"$type":"System.Single"}},{"_type":"System.Single","_value":{"$content":0.1,"$type":"System.Single"}}],"returnValue":{},"$type":"NodeCanvas.Tasks.Actions.ExecuteFunction_Multiplatform"},{"method":{"_baseInfo":"Reset.Units.UnitMovementHandler|SetNewDirection|System.Void","_paramsInfo":"UnityEngine.Vector3"},"parameters":[{"_type":"UnityEngine.Vector3","_value":{"z":0.1,"$type":"UnityEngine.Vector3"}}],"returnValue":{},"$type":"NodeCanvas.Tasks.Actions.ExecuteFunction_Multiplatform"},{"moveSpeed":{"label":"Move + Speed","value":{}},"moveSpeedSoothing":{"label":"Move Speed Smoothing","value":{}},"airDirectionDecay":{"label":"Air + Direction Decay","value":{}},"accelerationSmoothing":{"label":"Acceleration Smoothing","value":{}},"deaccelerationSmoothing":{"label":"Deacceleration + Smoothing","value":{}},"addDirectionFromInput":{"x":5.0,"y":4.0},"addInputStrength":0.69,"jumpPower":{"label":"Jump + Power","value":{}},"jumpPowerDecay":{"label":"Jump Decay Speed","value":{}},"gravityPower":{"label":"Gravity + Power","value":{}},"gravityMax":{"label":"Gravity Max","value":{}},"gravityAcceleration":{"label":"Gravity + Acceleration Speed","value":{}},"gravityScale":{"label":"Gravity Scale","value":{}},"settingsChangeSmoothing":{"label":"Settings + Change Smoothing","value":{}},"rotationSpeed":{"label":"Rotation Speed","value":{}},"rotationSmoothing":{"label":"Rotation + Smoothing","value":{}},"rotationInputBlending":{"label":"Rotation Input Blending","value":{}},"feedNewRotation":{},"feedRelativeTo":{},"$type":"Reset.Core.ChangeMovementSettings"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":83.7561,"y":445.308},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"2"},{"_position":{"x":506.0,"y":339.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"3"},{"_action":{"actions":[{"parameter":{"_value":"Melee"},"parameterHashID":{},"overrideAgent":{"_type":"UnityEngine.Animator","_name":"myAnimator","_targetVariableID":"2b9f09c0-47f9-42d4-8832-3ba15765ced5"},"$type":"NodeCanvas.Tasks.Actions.MecanimSetTrigger"},{"waitTime":{"_value":0.35},"$type":"NodeCanvas.Tasks.Actions.Wait"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":477.0,"y":445.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"4"},{"_action":{"actions":[{"parameter":{"_value":"Melee"},"parameterHashID":{},"overrideAgent":{"_type":"UnityEngine.Animator","_name":"myAnimator","_targetVariableID":"2b9f09c0-47f9-42d4-8832-3ba15765ced5"},"$type":"NodeCanvas.Tasks.Actions.MecanimSetTrigger"},{"waitTime":{"_value":0.2},"$type":"NodeCanvas.Tasks.Actions.Wait"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":675.0,"y":445.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"},{"_action":{"actions":[{"parameter":{"_value":"Melee"},"parameterHashID":{},"overrideAgent":{"_type":"UnityEngine.Animator","_name":"myAnimator","_targetVariableID":"2b9f09c0-47f9-42d4-8832-3ba15765ced5"},"$type":"NodeCanvas.Tasks.Actions.MecanimSetTrigger"},{"waitTime":{"_value":0.5},"$type":"NodeCanvas.Tasks.Actions.Wait"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":874.0,"y":444.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"6"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}' _objectReferences: [] _graphSource: _version: 3.31 _category: _comments: - _translation: {x: 97, y: -95} + _translation: {x: 483, y: 63} _zoomFactor: 1 _haltSerialization: 0 _externalSerializationFile: {fileID: 0} diff --git a/Assets/Scripts/Items/Interfaces/IEquipable.cs b/Assets/Scripts/Items/Interfaces/IEquipable.cs index dfcfd5d..1816622 100644 --- a/Assets/Scripts/Items/Interfaces/IEquipable.cs +++ b/Assets/Scripts/Items/Interfaces/IEquipable.cs @@ -1,6 +1,7 @@ using UnityEngine; -public interface IEquipable -{ - -} +namespace Reset.Items{ + public interface IEquipable{ + + } +} \ No newline at end of file diff --git a/Assets/Scripts/Player/Inventory.cs b/Assets/Scripts/Player/Inventory.cs index 044cffe..2d79b78 100644 --- a/Assets/Scripts/Player/Inventory.cs +++ b/Assets/Scripts/Player/Inventory.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using NodeCanvas.Tasks.Actions; using Reset.Items; using UnityEngine; @@ -23,6 +24,21 @@ namespace Reset.Units{ storedItems.Add(newItem); } + public void Equip(Item item){ + if (item is not IEquipable) { + Debug.LogError("This item is not equippable.", item); + return; + } + + if (item is Weapon thisWeapon) { + if (meleeWeapon != null) { + storedItems.Add(meleeWeapon); + } + + meleeWeapon = thisWeapon; + } + } + // Update is called once per frame void Update(){