diff --git a/Assets/Player/Graphs/GrappleAimBT.asset b/Assets/Player/Graphs/GrappleAimBT.asset new file mode 100644 index 0000000..acdf0c9 --- /dev/null +++ b/Assets/Player/Graphs/GrappleAimBT.asset @@ -0,0 +1,26 @@ +%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: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3} + m_Name: GrappleAimBT + m_EditorClassIdentifier: + _serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"_position":{"x":730.5245,"y":284.5939},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"0"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":498.9515,"y":429.918},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"1"},{"_action":{"fieldOfView":{"label":"FOV","value":60.0,"changeValue":1},"orbitFollowTop":{"label":"Top","changeHeight":1,"height":2.0,"changeRadius":1,"radius":2.0},"orbitFollowCenter":{"label":"Center","changeHeight":1,"height":1.5,"changeRadius":1,"radius":2.4},"orbitFollowBottom":{"label":"Bottom","changeHeight":1,"height":0.7,"changeRadius":1,"radius":2.0},"cameraOffset":{"label":"Screen + Position","newValue":{"x":2.0,"z":-1.0},"changeX":1,"changeZ":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":527.6321,"y":581.3029},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"2"},{"_action":{"waitTime":{"_value":0.3},"$type":"NodeCanvas.Tasks.Actions.Wait"},"_position":{"x":682.4366,"y":430.895},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"3"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":826.7462,"y":427.8908},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"4"},{"_action":{"fieldOfView":{"label":"FOV","changeValue":2},"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"label":"Center","changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"label":"Bottom","changeHeight":2,"changeRadius":2},"screenPosition":{"label":"Screen + Position","changeX":2,"changeY":2},"cameraOffset":{"label":"Screen Position","changeX":2,"changeY":2,"changeZ":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":880.8403,"y":568.1857},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}' + _objectReferences: [] + _graphSource: + _version: 3.31 + _category: + _comments: + _translation: {x: -21.80302, y: 59.90968} + _zoomFactor: 1 + _haltSerialization: 0 + _externalSerializationFile: {fileID: 0} diff --git a/Assets/Player/Graphs/GrappleAimBT.asset.meta b/Assets/Player/Graphs/GrappleAimBT.asset.meta new file mode 100644 index 0000000..f41ab03 --- /dev/null +++ b/Assets/Player/Graphs/GrappleAimBT.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2ae6811bd56a6245a6ab9ec1b0503ae +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Player/Input/PlayerInputs.inputactions b/Assets/Player/Input/PlayerInputs.inputactions index 6962ce8..683f295 100644 --- a/Assets/Player/Input/PlayerInputs.inputactions +++ b/Assets/Player/Input/PlayerInputs.inputactions @@ -58,6 +58,15 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "Grapple", + "type": "Button", + "id": "e0a48394-3128-4596-9b75-5dd3e82d3315", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false } ], "bindings": [ @@ -160,17 +169,6 @@ "isComposite": false, "isPartOfComposite": false }, - { - "name": "", - "id": "0aec47c4-b519-4001-9408-a49abe218bd8", - "path": "", - "interactions": "", - "processors": "", - "groups": "", - "action": "Lock-On", - "isComposite": false, - "isPartOfComposite": false - }, { "name": "", "id": "c9d67b81-b640-4a64-9b31-f92c927c8345", @@ -182,50 +180,6 @@ "isComposite": false, "isPartOfComposite": false }, - { - "name": "", - "id": "89e90b8f-c830-4d10-9046-c1db1ef970d0", - "path": "", - "interactions": "", - "processors": "", - "groups": "", - "action": "Cancel Lock-On", - "isComposite": false, - "isPartOfComposite": false - }, - { - "name": "One Modifier", - "id": "cd93e290-6f16-49c1-af36-9d3eaedeb8a2", - "path": "OneModifier", - "interactions": "", - "processors": "", - "groups": "", - "action": "Cancel Lock-On", - "isComposite": true, - "isPartOfComposite": false - }, - { - "name": "modifier", - "id": "8713a052-f2c4-439a-acae-f845a5654819", - "path": "", - "interactions": "", - "processors": "", - "groups": "", - "action": "Cancel Lock-On", - "isComposite": false, - "isPartOfComposite": true - }, - { - "name": "binding", - "id": "013863ac-050d-4d7f-a36c-bce06827ad17", - "path": "", - "interactions": "", - "processors": "", - "groups": "", - "action": "Cancel Lock-On", - "isComposite": false, - "isPartOfComposite": true - }, { "name": "", "id": "84c3f849-8d7f-40ea-8c6c-4b5af0d9addd", @@ -236,6 +190,28 @@ "action": "Cancel Lock-On", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "88d7eb5e-771c-4c79-a692-521032759ba7", + "path": "", + "interactions": "", + "processors": "", + "groups": "", + "action": "Grapple", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "0c543052-3c80-432e-a34b-8fcb9267028a", + "path": "/rightTrigger", + "interactions": "", + "processors": "", + "groups": ";Controller", + "action": "Grapple", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/Plugins/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/PropertyDrawerFactory.cs b/Assets/Plugins/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/PropertyDrawerFactory.cs index 15b1ec6..0b79e06 100644 --- a/Assets/Plugins/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/PropertyDrawerFactory.cs +++ b/Assets/Plugins/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/PropertyDrawerFactory.cs @@ -152,7 +152,7 @@ namespace ParadoxNotion.Design } ///Override to implement GUI. Return the modified instance at the end. - abstract public T OnGUI(GUIContent content, T instance); + abstract public T OnGUI(GUIContent content, T _instance); } ///The default object drawer implementation able to inspect most types @@ -165,8 +165,8 @@ namespace ParadoxNotion.Design this.objectType = objectType; } - public override object OnGUI(GUIContent content, object instance) { - return EditorUtils.DrawEditorFieldDirect(content, instance, objectType, info); + public override object OnGUI(GUIContent content, object _instance) { + return EditorUtils.DrawEditorFieldDirect(content, _instance, objectType, info); } } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 4068df8..85a1905 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -2644,7 +2644,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 330585543} serializedVersion: 2 - m_LocalRotation: {x: 0.11558351, y: 0.00000003563248, z: -0.000000004146316, w: 0.99329776} + m_LocalRotation: {x: 0.039987642, y: -0.0000000031281908, z: 1.251891e-10, w: 0.99920017} m_LocalPosition: {x: 1.503913, y: 2.0657892, z: -6.8609486} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -2840,6 +2840,8 @@ GameObject: - component: {fileID: 402424911} - component: {fileID: 402424910} - component: {fileID: 402424908} + - component: {fileID: 402424912} + - component: {fileID: 402424913} m_Layer: 0 m_Name: Cinemachine m_TagString: Untagged @@ -2898,7 +2900,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 402424904} serializedVersion: 2 - m_LocalRotation: {x: 0.115583494, y: 0.000000035632475, z: -0.000000004146315, w: 0.99329776} + m_LocalRotation: {x: 0.039987642, y: -0.0000000031281908, z: 1.2518941e-10, w: 0.99920017} m_LocalPosition: {x: 1.503913, y: 2.0657892, z: -6.8609486} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -2920,7 +2922,7 @@ MonoBehaviour: TargetOffset: {x: 0, y: 0, z: 0} TrackerSettings: BindingMode: 5 - PositionDamping: {x: 1, y: 1, z: 1} + PositionDamping: {x: 0.5, y: 1, z: 0.2} AngularDampingMode: 0 RotationDamping: {x: 0, y: 0, z: 0} QuaternionDamping: 1 @@ -3068,14 +3070,41 @@ MonoBehaviour: Enabled: 0 Size: {x: 0.8, y: 0.8} Offset: {x: 0, y: 0} - CenterOnActivate: 1 - TargetOffset: {x: 0, y: 0, z: 0} + CenterOnActivate: 0 + TargetOffset: {x: 0, y: 1, z: 0} Damping: {x: 0.5, y: 0.5} Lookahead: Enabled: 0 Time: 0 Smoothing: 0 IgnoreY: 0 +--- !u!114 &402424912 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 402424904} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c032a18b0b0c1da4092bfc365c6e4aad, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &402424913 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 402424904} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 44d70cc20219cd84593f67d248eafe36, type: 3} + m_Name: + m_EditorClassIdentifier: + Offset: {x: 0, y: 0, z: 0} + ApplyAfter: 1 + PreserveComposition: 0 --- !u!1 &410087039 GameObject: m_ObjectHideFlags: 0 @@ -6711,13 +6740,15 @@ MonoBehaviour: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},{"valueA":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"valueB":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[{"valueA":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"valueB":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"foldEnter":true,"foldExit":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Ground - Idle","_position":{"x":449.1072,"y":171.9887},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"0"},{"_onEnterList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"Operation":2,"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetInt"}]},"_onUpdateList":{"executionMode":1,"actions":[{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.CalculateAirMovement"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Airborn + Idle","_position":{"x":441.1072,"y":185.9887},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"0"},{"_onEnterList":{"executionMode":1,"actions":[{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"Operation":2,"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetInt"}]},"_onUpdateList":{"executionMode":1,"actions":[{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.CalculateAirMovement"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Airborn (Actionable)","_position":{"x":607.037,"y":-147.5533},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"1"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":18.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"standStillJumpStrength":{},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":0.2},"directionalForce":{"_value":{"y":1.0,"z":0.3}},"directionalForceStrength":{"_value":1.0},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall Climb Jump","_position":{"x":1065.998,"y":-269.9991},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"2"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{},"airMoveDirection":{},"standStillJumpStrength":{},"jumpPower":{},"currentVelocityInheritence":{},"directionalForce":{},"directionalForceStrength":{},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall - Jump","_position":{"x":868.4374,"y":-418.9596},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"3"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":12.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"standStillJumpStrength":{"_value":1.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":1.0},"directionalForce":{},"directionalForceStrength":{},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Standard + Jump","_position":{"x":868.4374,"y":-419.9596},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"3"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":12.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"standStillJumpStrength":{"_value":1.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":1.0},"directionalForce":{},"directionalForceStrength":{},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Standard Jump","_position":{"x":831.2836,"y":45.40904},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"4"},{"_onEnterList":{"executionMode":1,"actions":[]},"_onUpdateList":{"executionMode":1,"actions":[{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"$type":"NodeCanvas.Tasks.Actions.CalculateAirMovement"}]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"foldUpdate":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Airborn","_position":{"x":213.7761,"y":-7.08618},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"5"},{"_onEnterList":{"executionMode":1,"actions":[{"jumpStrength":{"_value":10.0},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"standStillJumpStrength":{},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"currentVelocityInheritence":{"_value":0.3},"directionalForce":{"_value":{"x":1.0,"z":1.0}},"directionalForceStrength":{"_value":10.0},"$type":"NodeCanvas.Tasks.Actions.AddJump"},{"valueA":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_onUpdateList":{"executionMode":1,"actions":[]},"_onExitList":{"executionMode":1,"actions":[]},"foldEnter":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_name":"Wall - Jump","_position":{"x":328.7507,"y":-415.5261},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"6"},{"_subFSM":{"_value":1},"_variablesMap":[{"_targetSubGraphVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_canRead":true,"_canWrite":true,"_type":"UnityEngine.Vector3","_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},{"_targetSubGraphVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_canRead":true,"_canWrite":true,"_type":"System.Single","_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"}],"_position":{"x":-50.62204,"y":454.3138},"$type":"NodeCanvas.StateMachines.ConcurrentSubFSM"},{"_conditionList":{"conditions":[{"_invert":true,"$type":"NodeCanvas.Tasks.Conditions.DebugCondition"}]},"_actionList":{"executionMode":1,"actions":[{"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"gravityAcceleration":{"_value":1.0},"gravityMax":{"_value":8.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"jumpPowerDecay":{"_value":2.0},"playerFacingDirection":1,"rotationSpeed":{"_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"},"rotationSmoothing":{"_value":1.0},"gravityPower":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"$type":"NodeCanvas.Tasks.Actions.ProcessMovement"}]},"_position":{"x":-53.13062,"y":301.5233},"$type":"NodeCanvas.StateMachines.OnFSMEnter"}],"connections":[{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"eventName":{"_value":"ForwardRay"},"value":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckEventValue`1[[System.Boolean, - mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"RightRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInt"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"LeftRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"619300a4-be8b-4ad4-ba2a-978468094ba2","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean, + Jump","_position":{"x":328.7507,"y":-415.5261},"$type":"NodeCanvas.StateMachines.SuperActionState","$id":"6"},{"_actionList":{"executionMode":1,"actions":[{"orbitFollowTop":{"label":"Top","changeHeight":1,"height":2.0,"changeRadius":1,"radius":2.0},"orbitFollowCenter":{"label":"Center","changeHeight":1,"height":1.5,"changeRadius":1,"radius":2.4},"orbitFollowBottom":{"label":"Bottom","changeHeight":1,"height":0.7,"changeRadius":1,"radius":2.0},"screenPosition":{"label":"Screen + Position","newValue":{"x":-0.25}},"cameraOffset":{"label":"Screen Position","newValue":{"x":2.0},"changeX":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"}]},"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":803.9675,"y":376.7423},"$type":"NodeCanvas.StateMachines.ActionState","$id":"7"},{"_actionList":{"executionMode":1,"actions":[{"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"changeHeight":2,"changeRadius":2},"cameraOffset":{"label":"Screen + Position","changeX":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"}]},"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":583.0,"y":512.0},"$type":"NodeCanvas.StateMachines.ActionState","$id":"8"},{"_subFSM":{"_value":1},"_variablesMap":[{"_targetSubGraphVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_canRead":true,"_canWrite":true,"_type":"UnityEngine.Vector3","_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},{"_targetSubGraphVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_canRead":true,"_canWrite":true,"_type":"System.Single","_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"}],"_position":{"x":-257.669,"y":558.3375},"$type":"NodeCanvas.StateMachines.ConcurrentSubFSM"},{"_conditionList":{"conditions":[{"_invert":true,"$type":"NodeCanvas.Tasks.Conditions.DebugCondition"}]},"_actionList":{"executionMode":1,"actions":[{"groundMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"765d24b4-452d-4531-9fce-6cef7ba39634"},"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"8f5f926f-618d-4bcb-87eb-0bcd02e405a2"},"gravityAcceleration":{"_value":1.0},"gravityMax":{"_value":8.0},"jumpPower":{"_name":"jumpPower","_targetVariableID":"9a82efee-e317-423c-ad6e-5ef7e6145396"},"jumpPowerDecay":{"_value":2.0},"playerFacingDirection":1,"rotationSpeed":{"_name":"rotationSpeed","_targetVariableID":"3a7d1c7c-8fb6-4a99-b25a-b434b62d4611"},"rotationSmoothing":{"_value":1.0},"gravityPower":{"_name":"gravityPower","_targetVariableID":"2221dc20-d9b3-4781-bd23-0b2038a7ff5e"},"$type":"NodeCanvas.Tasks.Actions.ProcessMovement"}]},"_position":{"x":-260.1776,"y":405.5469},"$type":"NodeCanvas.StateMachines.OnFSMEnter"},{"_subTree":{"_value":2},"_position":{"x":-29.75668,"y":553.0593},"$type":"NodeCanvas.StateMachines.ConcurrentSubTree"}],"connections":[{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"7"},"_isDisabled":true,"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"eventName":{"_value":"ForwardRay"},"value":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckEventValue`1[[System.Boolean, + mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"RightRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"airJumpsRemaining","_targetVariableID":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInt"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"conditions":[{"actionName":{"_value":"Jump"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"eventName":{"_value":"LeftRay"},"$type":"NodeCanvas.Tasks.Conditions.CheckEvent"}],"$type":"NodeCanvas.Framework.ConditionList"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"619300a4-be8b-4ad4-ba2a-978468094ba2"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"8"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_sourceNode":{"$ref":"8"},"_targetNode":{"$ref":"0"},"_isDisabled":true,"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"619300a4-be8b-4ad4-ba2a-978468094ba2","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"forwardRay":{"_propertyPath":"PlayerMovement.forwardRay","_name":"forwardRay","_id":"a2506ca5-1b47-4820-9921-3ff4ecc18564","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.RaycastHit, UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"airJumpsRemaining":{"_name":"airJumpsRemaining","_id":"23f0ddc0-c4e8-462f-a7e0-fdd8e818d08d","$type":"NodeCanvas.Framework.Variable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"765d24b4-452d-4531-9fce-6cef7ba39634","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3, @@ -6729,12 +6760,13 @@ MonoBehaviour: _boundGraphObjectReferences: - {fileID: 0} - {fileID: 11400000, guid: b307c218c1a404548afe65e66737fa80, type: 2} + - {fileID: 11400000, guid: c2ae6811bd56a6245a6ab9ec1b0503ae, type: 2} _boundGraphSource: _version: 3.31 _category: _comments: - _translation: {x: 134, y: 549} - _zoomFactor: 1 + _translation: {x: 542, y: 188} + _zoomFactor: 0.7910043 _firstActivation: 0 _enableAction: 0 _disableAction: 0 diff --git a/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs b/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs new file mode 100644 index 0000000..9bd5ab6 --- /dev/null +++ b/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs @@ -0,0 +1,480 @@ +using NodeCanvas.Framework; +using ParadoxNotion.Design; +using Unity.Cinemachine; +using UnityEditor; +using UnityEngine; + +// Individual bool setting for each ring. Three of these will be used. +public struct OrbitalFollowValueGroup{ + public string label; + + public CameraSettingsToggle changeHeight; + public float height; + + public CameraSettingsToggle changeRadius; + public float radius; + + public OrbitalFollowValueGroup(string newLabel){ + label = newLabel; + changeHeight = CameraSettingsToggle.NoChange; + height = 0f; + changeRadius = CameraSettingsToggle.NoChange; + radius = 0f; + } +} + +// Setting for any X and Y based values +public struct CinemachineVectorValueGroup{ + public CameraSettingsToggle changeX; + public float xValue; + public CameraSettingsToggle changeY; + public float yValue; +} + +// Enum options for individual camera settings +public enum CameraSettingsToggle{ + NoChange, + NewValue, + ResetValue, +} + +public struct Vector3CameraValueGroup{ + public string label; + public Vector3 newValue; + + public CameraSettingsToggle changeX; + public CameraSettingsToggle changeY; + public CameraSettingsToggle changeZ; + + public Vector3CameraValueGroup(string newLabel){ + changeX = CameraSettingsToggle.NoChange; + changeY = CameraSettingsToggle.NoChange; + changeZ = CameraSettingsToggle.NoChange; + + newValue = Vector3.zero; + label = newLabel; + } +} + +public struct Vector2CameraValueGroup{ + public string label; + public Vector2 newValue; + + public CameraSettingsToggle changeX; + public CameraSettingsToggle changeY; + + public Vector2CameraValueGroup(string newLabel){ + changeX = CameraSettingsToggle.NoChange; + changeY = CameraSettingsToggle.NoChange; + + newValue = Vector2.zero; + label = newLabel; + } +} + +public struct FloatCameraValueGroup{ + public string label; + public float value; + + public CameraSettingsToggle changeValue; + + public FloatCameraValueGroup(string newLabel){ + label = newLabel; + value = 0f; + changeValue = CameraSettingsToggle.NoChange; + } +} + +public class FloatCameraValueGroupDrawer : ObjectDrawer { + public override FloatCameraValueGroup OnGUI(GUIContent _content, FloatCameraValueGroup _instance){ + // Remove label for floats + EditorGUIUtility.labelWidth = 50; + + // Set layout options for the label and the float fields + GUILayoutOption[] floatOptions = new GUILayoutOption[] { + GUILayout.Width(80.0f), + GUILayout.MinWidth(20.0f), + GUILayout.ExpandWidth(true), + }; + + GUILayoutOption[] labelOptions = new GUILayoutOption[]{ + GUILayout.Width(200.0f), + }; + + // Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options + GUILayout.BeginVertical(); + GUILayout.Label(_instance.ToString(), labelOptions); + GUILayout.BeginHorizontal(); + + // Create the x settings enum + _instance.changeValue = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", instance.changeValue); + + // Create the value/disabled information field + if (_instance.changeValue == CameraSettingsToggle.NewValue){ + _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeValue == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // Close this line up + GUILayout.EndHorizontal(); + GUILayout.EndVertical(); + + // Reset to default so the rest of things don't get messed up + EditorGUIUtility.labelWidth = 0; + return _instance; + } +} + +public class Vector3CameraValueGroupDrawer : ObjectDrawer { + public override Vector3CameraValueGroup OnGUI(GUIContent _content, Vector3CameraValueGroup _instance){ + // Remove label for floats + EditorGUIUtility.labelWidth = 20; + + // Set layout options for the label and the float fields + GUILayoutOption[] floatOptions = new GUILayoutOption[] { + GUILayout.Width(300.0f), + GUILayout.MinWidth(20.0f), + GUILayout.ExpandWidth(true), + }; + + GUILayoutOption[] labelOptions = new GUILayoutOption[]{ + GUILayout.Width(200.0f), + }; + + // Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options + GUILayout.BeginVertical(); + GUILayout.Label(_instance.ToString(), labelOptions); + GUILayout.BeginHorizontal(); + + // Create the x settings enum + _instance.changeX = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", instance.changeX); + + // Create the value/disabled information field + if (_instance.changeX == CameraSettingsToggle.NewValue){ + _instance.newValue.x = EditorGUILayout.FloatField(_instance.newValue.x, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeX == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // It do what it do. + GUILayout.Space(5); + + // Create the y settings enum + _instance.changeY = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", _instance.changeY); + + // Create the value/disabled information field + if (_instance.changeY == CameraSettingsToggle.NewValue){ + _instance.newValue.y = EditorGUILayout.FloatField(_instance.newValue.y, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeY == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // It do what it do. + GUILayout.Space(5); + + // Create the y settings enum + _instance.changeZ = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", _instance.changeZ); + + // Create the value/disabled information field + if (_instance.changeZ == CameraSettingsToggle.NewValue){ + _instance.newValue.z = EditorGUILayout.FloatField(_instance.newValue.z, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeZ == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // Close this line up + GUILayout.EndHorizontal(); + GUILayout.EndVertical(); + + // Reset to default so the rest of things don't get messed up + EditorGUIUtility.labelWidth = 0; + return _instance; + } +} + +public class Vector2CameraValueGroupDrawer : ObjectDrawer { + public override Vector2CameraValueGroup OnGUI(GUIContent _content, Vector2CameraValueGroup _instance){ + // Remove label for floats + EditorGUIUtility.labelWidth = 50; + + // Set layout options for the label and the float fields + GUILayoutOption[] floatOptions = new GUILayoutOption[] { + GUILayout.Width(300.0f), + GUILayout.MinWidth(20.0f), + GUILayout.ExpandWidth(true), + }; + + GUILayoutOption[] labelOptions = new GUILayoutOption[]{ + GUILayout.Width(200.0f), + }; + + // Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options + GUILayout.BeginVertical(); + GUILayout.Label(_instance.ToString(), labelOptions); + GUILayout.BeginHorizontal(); + + // Create the x settings enum + _instance.changeX = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", instance.changeX); + + // Create the value/disabled information field + if (_instance.changeX == CameraSettingsToggle.NewValue){ + _instance.newValue.x = EditorGUILayout.FloatField(_instance.newValue.x, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeX == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // It do what it do. + GUILayout.Space(5); + + // Create the y settings enum + _instance.changeY = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", _instance.changeY); + + // Create the value/disabled information field + if (_instance.changeY == CameraSettingsToggle.NewValue){ + _instance.newValue.y = EditorGUILayout.FloatField(_instance.newValue.y, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeY == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // Close this line up + GUILayout.EndHorizontal(); + GUILayout.EndVertical(); + + // Reset to default so the rest of things don't get messed up + EditorGUIUtility.labelWidth = 0; + return _instance; + } +} + +// Custom editor for each orbital follow ring setting +public class OrbitalFollowValueGroupDrawer : ObjectDrawer{ + public override OrbitalFollowValueGroup OnGUI(GUIContent _content, OrbitalFollowValueGroup _instance){ + // Remove label for floats + EditorGUIUtility.labelWidth = 1; + + // Set layout options for the label and the float fields + GUILayoutOption[] floatOptions = new GUILayoutOption[] { + GUILayout.Width(300.0f), + GUILayout.MinWidth(20.0f), + GUILayout.ExpandWidth(true), + }; + + GUILayoutOption[] labelOptions = new GUILayoutOption[]{ + GUILayout.Width(60.0f), + }; + + // Start a Horiztonal Section + GUILayout.BeginHorizontal(); + + // Add the left side label + GUILayout.Label(_instance.label, labelOptions); + + // Create the height settings enum + _instance.changeHeight = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", _instance.changeHeight); + + // Create the value/disabled information field + if (_instance.changeHeight == CameraSettingsToggle.NewValue){ + _instance.height = EditorGUILayout.FloatField(_instance.height, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeHeight == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // It do what it do. + GUILayout.Space(5); + + // Create the radius settings enum + _instance.changeRadius = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", _instance.changeRadius); + + // Create the value/disabled information field + if (_instance.changeRadius == CameraSettingsToggle.NewValue){ + _instance.radius = EditorGUILayout.FloatField(_instance.radius, floatOptions); + } else { + EditorGUI.BeginDisabledGroup(true); + EditorGUILayout.TextField(_instance.changeRadius == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions); + EditorGUI.EndDisabledGroup(); + } + + // Close this line up + GUILayout.EndHorizontal(); + + // Reset to default so the rest of things don't get messed up + EditorGUIUtility.labelWidth = 0; + return _instance; + } +} + +namespace NodeCanvas.Tasks.Actions { + [Category("Reset")] + [Description("Change Cinemachine camera settings for the player")] + public class ChangeCameraSettings : ActionTask{ + [ParadoxNotion.Design.Header("Main Settings")] + public FloatCameraValueGroup fieldOfView = new (newLabel: "FOV"); + + [ParadoxNotion.Design.Header("Orbit Follow Ring Settings")] + public OrbitalFollowValueGroup orbitFollowTop = new (newLabel: "Top"); + public OrbitalFollowValueGroup orbitFollowCenter = new (newLabel: "Center"); + public OrbitalFollowValueGroup orbitFollowBottom = new (newLabel: "Bottom"); + + [ParadoxNotion.Design.Header("Rotation Composer Settings")] + public Vector2CameraValueGroup screenPosition = new (newLabel: "Screen Position"); + + [ParadoxNotion.Design.Header("Camera Offset Settings")] + public Vector3CameraValueGroup cameraOffset = new (newLabel: "Screen Position"); + + //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 case farm for checking if values should be changed and what to + // Field of view + switch (fieldOfView.changeValue) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.mainFieldOfView.targetValue = fieldOfView.value; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.mainFieldOfView.Reset(); + break; + } + + // Orbit follow rings + switch (orbitFollowTop.changeHeight) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.orbitFollowTopHeight.targetValue = orbitFollowTop.height; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.orbitFollowTopHeight.Reset(); + break; + } + + switch (orbitFollowTop.changeRadius) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.orbitFollowTopRadius.targetValue = orbitFollowTop.radius; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.orbitFollowTopRadius.Reset(); + break; + } + + switch (orbitFollowCenter.changeHeight) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.orbitFollowCenterHeight.targetValue = orbitFollowCenter.height; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.orbitFollowCenterHeight.Reset(); + break; + } + + switch (orbitFollowCenter.changeRadius) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.orbitFollowCenterRadius.targetValue = orbitFollowCenter.radius; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.orbitFollowCenterRadius.Reset(); + break; + } + + switch (orbitFollowBottom.changeHeight) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.orbitFollowBottomHeight.targetValue = orbitFollowBottom.height; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.orbitFollowBottomHeight.Reset(); + break; + } + + switch (orbitFollowBottom.changeRadius) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.orbitFollowBottomRadius.targetValue = orbitFollowBottom.radius; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.orbitFollowBottomRadius.Reset(); + break; + } + + // Screen Position + switch (screenPosition.changeX) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.x = screenPosition.newValue.x; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.x = CameraSettingsProcessor.values.rotationComposerScreenPos.originalValue.x; + break; + } + + switch (screenPosition.changeY) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.y = screenPosition.newValue.y; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.y = CameraSettingsProcessor.values.rotationComposerScreenPos.originalValue.y; + break; + } + + // Camera Offset + switch (cameraOffset.changeX) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.x = cameraOffset.newValue.x; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.x = CameraSettingsProcessor.values.cameraOffsetOffset.originalValue.x; + break; + } + + switch (cameraOffset.changeY) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.y = cameraOffset.newValue.y; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.y = CameraSettingsProcessor.values.cameraOffsetOffset.originalValue.y; + break; + } + + switch (cameraOffset.changeZ) { + case CameraSettingsToggle.NewValue: + CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.z = cameraOffset.newValue.z; + break; + case CameraSettingsToggle.ResetValue: + CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.z = CameraSettingsProcessor.values.cameraOffsetOffset.originalValue.z; + break; + } + + 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/ChangeCameraSettings.cs.meta b/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs.meta new file mode 100644 index 0000000..9485a8e --- /dev/null +++ b/Assets/Scripts/Core/Graph Tasks/ChangeCameraSettings.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 87f3505b4ac62814ba2f782df47b0dbe \ No newline at end of file diff --git a/Assets/Scripts/Player/CameraSettingsProcessor.cs b/Assets/Scripts/Player/CameraSettingsProcessor.cs new file mode 100644 index 0000000..68f4d25 --- /dev/null +++ b/Assets/Scripts/Player/CameraSettingsProcessor.cs @@ -0,0 +1,140 @@ +using Unity.Cinemachine; +using UnityEngine; + +public struct CameraSettingSingleValue{ + // NOTE: Could add a locked variable here if needed?? + public T originalValue; + public T targetValue; + public float smoothing; + + public float velocityRef; + public Vector2 velocityRefV2; + public Vector3 velocityRefV3; + + public CameraSettingSingleValue(float defaultSmoothing, T original = default(T)){ + originalValue = original; + targetValue = original; + smoothing = defaultSmoothing; + + velocityRef = 0; + velocityRefV2 = default; + velocityRefV3 = default; + } + + public void Reset(){ + targetValue = originalValue; + } +} + +public struct CameraSettingValues{ + public CameraSettingSingleValue mainFieldOfView; + + public CameraSettingSingleValue orbitFollowTopHeight; + public CameraSettingSingleValue orbitFollowTopRadius; + public CameraSettingSingleValue orbitFollowCenterHeight; + public CameraSettingSingleValue orbitFollowCenterRadius; + public CameraSettingSingleValue orbitFollowBottomHeight; + public CameraSettingSingleValue orbitFollowBottomRadius; + + public CameraSettingSingleValue rotationComposerScreenPos; + + public CameraSettingSingleValue cameraOffsetOffset; + + public CameraSettingValues(float defaultSmoothing){ + mainFieldOfView = new CameraSettingSingleValue(defaultSmoothing); + + orbitFollowTopHeight = new CameraSettingSingleValue(defaultSmoothing); + orbitFollowTopRadius = new CameraSettingSingleValue(defaultSmoothing); + orbitFollowCenterHeight = new CameraSettingSingleValue(defaultSmoothing); + orbitFollowCenterRadius = new CameraSettingSingleValue(defaultSmoothing); + orbitFollowBottomHeight = new CameraSettingSingleValue(defaultSmoothing); + orbitFollowBottomRadius = new CameraSettingSingleValue(defaultSmoothing); + + rotationComposerScreenPos = new CameraSettingSingleValue(defaultSmoothing); + cameraOffsetOffset = new CameraSettingSingleValue(defaultSmoothing); + } +} + +public class CameraSettingsProcessor : MonoBehaviour{ + public static CameraSettingsProcessor Instance{ get; private set; } + + public static CameraSettingValues values = new(defaultSmoothing: .2f); + + public static GameObject mainCamera; + + private CinemachineCamera main; + private CinemachineOrbitalFollow orbit; + private CinemachineRotationComposer rotComp; + private CinemachineCameraOffset offset; + + public void Awake(){ + // Singleton management + if (Instance != null && Instance != this) { + Destroy(this); + } else { + Instance = this; + } + + // Set references for camera object and cinemachine components + mainCamera = gameObject; + main = mainCamera.GetComponent(); + orbit = mainCamera.GetComponent(); + rotComp = mainCamera.GetComponent(); + offset = mainCamera.GetComponent(); + + // Initialize camera settings values + values = new CameraSettingValues{ + cameraOffsetOffset = new CameraSettingSingleValue(defaultSmoothing: .2f, offset.Offset), + mainFieldOfView = new CameraSettingSingleValue(defaultSmoothing: .2f, main.Lens.FieldOfView), + orbitFollowTopHeight = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Top.Height), + orbitFollowTopRadius = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Top.Radius), + orbitFollowCenterHeight = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Center.Height), + orbitFollowCenterRadius = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Center.Radius), + orbitFollowBottomHeight = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Bottom.Height), + orbitFollowBottomRadius = new CameraSettingSingleValue(defaultSmoothing: .2f, orbit.Orbits.Bottom.Radius), + rotationComposerScreenPos = new CameraSettingSingleValue(defaultSmoothing: .2f, rotComp.Composition.ScreenPosition), + }; + } + + void ProcessCameraValues(){ + main.Lens.FieldOfView = Mathf.SmoothDamp(main.Lens.FieldOfView, + values.mainFieldOfView.targetValue, ref values.mainFieldOfView.velocityRef, + values.mainFieldOfView.smoothing); + + orbit.Orbits.Top.Height = Mathf.SmoothDamp(orbit.Orbits.Top.Height, + values.orbitFollowTopHeight.targetValue, ref values.orbitFollowTopHeight.velocityRef, + values.orbitFollowTopHeight.smoothing); + + orbit.Orbits.Top.Radius = Mathf.SmoothDamp(orbit.Orbits.Top.Radius, + values.orbitFollowTopRadius.targetValue, ref values.orbitFollowTopRadius.velocityRef, + values.orbitFollowTopRadius.smoothing); + + orbit.Orbits.Center.Height = Mathf.SmoothDamp(orbit.Orbits.Center.Height, + values.orbitFollowCenterHeight.targetValue, ref values.orbitFollowCenterHeight.velocityRef, + values.orbitFollowCenterHeight.smoothing); + + orbit.Orbits.Center.Radius = Mathf.SmoothDamp(orbit.Orbits.Center.Radius, + values.orbitFollowCenterRadius.targetValue, ref values.orbitFollowCenterRadius.velocityRef, + values.orbitFollowCenterRadius.smoothing); + + orbit.Orbits.Bottom.Height = Mathf.SmoothDamp(orbit.Orbits.Bottom.Height, + values.orbitFollowBottomHeight.targetValue, ref values.orbitFollowBottomHeight.velocityRef, + values.orbitFollowBottomHeight.smoothing); + + orbit.Orbits.Bottom.Radius = Mathf.SmoothDamp(orbit.Orbits.Bottom.Radius, + values.orbitFollowBottomRadius.targetValue, ref values.orbitFollowBottomRadius.velocityRef, + values.orbitFollowBottomRadius.smoothing); + + rotComp.Composition.ScreenPosition = Vector2.SmoothDamp(rotComp.Composition.ScreenPosition, + values.rotationComposerScreenPos.targetValue, ref values.rotationComposerScreenPos.velocityRefV2, + values.rotationComposerScreenPos.smoothing); + + offset.Offset = Vector3.SmoothDamp(offset.Offset, + values.cameraOffsetOffset.targetValue, ref values.cameraOffsetOffset.velocityRefV3, + values.cameraOffsetOffset.smoothing); + } + + void Update(){ + ProcessCameraValues(); + } +} diff --git a/Assets/Scripts/Player/CameraSettingsProcessor.cs.meta b/Assets/Scripts/Player/CameraSettingsProcessor.cs.meta new file mode 100644 index 0000000..069e56c --- /dev/null +++ b/Assets/Scripts/Player/CameraSettingsProcessor.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c032a18b0b0c1da4092bfc365c6e4aad \ No newline at end of file diff --git a/Assets/Scripts/Player/PlayerControls.cs b/Assets/Scripts/Player/PlayerControls.cs index d6690cb..2742493 100644 --- a/Assets/Scripts/Player/PlayerControls.cs +++ b/Assets/Scripts/Player/PlayerControls.cs @@ -48,6 +48,13 @@ public class PlayerControls : MonoBehaviour{ public void OnCancelLockOn(){ GetComponent().RemoveLockOnTarget(); graph.SendEvent("InputEvent", "CancelLockOn", null); - } + + // public void OnGrapple(InputInteractionContext context){ + // if (context.control.IsPressed()) { + // graph.SendEvent("InputEvent", "GrappleDown", null); + // } else { + // graph.SendEvent("InputEvent", "GrappleUp", null); + // } + // } } diff --git a/Packages/com.singularitygroup.hotreload/Editor/HotReloadAttributeProcessor.cs b/Packages/com.singularitygroup.hotreload/Editor/HotReloadAttributeProcessor.cs new file mode 100644 index 0000000..b99e2a6 --- /dev/null +++ b/Packages/com.singularitygroup.hotreload/Editor/HotReloadAttributeProcessor.cs @@ -0,0 +1,35 @@ +#if ODIN_INSPECTOR +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using SingularityGroup.HotReload.EditorDependencies; +using Sirenix.OdinInspector; +using Sirenix.OdinInspector.Editor; + +namespace SingularityGroup.HotReload.Editor { + public class HotReloadAttributeProcessor : OdinAttributeProcessor { + public override bool CanProcessChildMemberAttributes(InspectorProperty parentProperty, MemberInfo member) { + return member is FieldInfo; + } + + static object nullObject = new object(); + public override void ProcessChildMemberAttributes(InspectorProperty property, MemberInfo member, List attributes) { + var field = member as FieldInfo; + if (field?.DeclaringType == null) { + return; + } + if (UnityFieldHelper.TryGetFieldAttributes(field, out var fieldAttributes)) { + attributes.Clear(); + attributes.AddRange(fieldAttributes); + } + if (UnityFieldHelper.IsFieldHidden(field.DeclaringType, field.Name)) { + attributes.Add(new HideIfAttribute("@true")); + } + // we assume this is always not null. Most of the times it will not be. If it is the side effect is some memory footprint which hopefully gets cleared when enough objects + var key = property.ParentValues.FirstOrDefault() ?? nullObject; + UnityFieldHelper.CacheFieldInvalidation(key, field, property.RefreshSetup); + } + } +} +#endif diff --git a/Packages/com.singularitygroup.hotreload/Editor/HotReloadAttributeProcessor.cs.meta b/Packages/com.singularitygroup.hotreload/Editor/HotReloadAttributeProcessor.cs.meta new file mode 100644 index 0000000..22b1b82 --- /dev/null +++ b/Packages/com.singularitygroup.hotreload/Editor/HotReloadAttributeProcessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c63452dd912fe4c46909c1c5ce844e69 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: