feat: lock-on added, rotation reworked
This commit is contained in:
@@ -12,7 +12,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: f945e777233a59f4aba40aeca29093a6, type: 3}
|
m_Script: {fileID: 11500000, guid: f945e777233a59f4aba40aeca29093a6, type: 3}
|
||||||
m_Name: PlayerLocomotionFSM
|
m_Name: PlayerLocomotionFSM
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":10.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":0.3},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":559.9924,"y":711.7622},"$type":"NodeCanvas.StateMachines.ActionState","$id":"0"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":15.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":0.2},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":874.288,"y":572.152},"$type":"NodeCanvas.StateMachines.ActionState","$id":"1"},{"_position":{"x":430.6569,"y":381.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"2"},{"_position":{"x":465.0,"y":561.0},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"3"}],"connections":[{"_condition":{"actionName":{"_value":"Sprint"},"actionValue":{"_value":""},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"desiredVector3":{"_value":{"z":1.0}},"tolerance":{"_value":0.5},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$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":"0"},"$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,
|
_serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":10.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":0.3},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":559.9924,"y":711.7622},"$type":"NodeCanvas.StateMachines.ActionState","$id":"0"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":15.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":0.2},"$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":"1"},{"_position":{"x":430.6569,"y":381.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"2"},{"_position":{"x":465.0,"y":561.0},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"3"}],"connections":[{"_condition":{"actionName":{"_value":"Sprint"},"actionValue":{"_value":""},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"desiredVector3":{"_value":{"z":1.0}},"tolerance":{"_value":0.5},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$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":"0"},"$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,
|
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,
|
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]]"}}}}'
|
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}}}}'
|
||||||
@@ -21,7 +21,7 @@ MonoBehaviour:
|
|||||||
_version: 3.31
|
_version: 3.31
|
||||||
_category:
|
_category:
|
||||||
_comments:
|
_comments:
|
||||||
_translation: {x: 129, y: -157}
|
_translation: {x: 1, y: -175}
|
||||||
_zoomFactor: 0.9962392
|
_zoomFactor: 0.9967056
|
||||||
_haltSerialization: 0
|
_haltSerialization: 0
|
||||||
_externalSerializationFile: {fileID: 0}
|
_externalSerializationFile: {fileID: 0}
|
||||||
|
|||||||
@@ -2447,7 +2447,7 @@ GameObject:
|
|||||||
- component: {fileID: 263093400}
|
- component: {fileID: 263093400}
|
||||||
- component: {fileID: 263093404}
|
- component: {fileID: 263093404}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Lock-On Target
|
m_Name: 'Lock-On Target: Open'
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@@ -2644,8 +2644,8 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 330585543}
|
m_GameObject: {fileID: 330585543}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0.09176971, y: 0.050800513, z: -0.0046878606, w: 0.99447256}
|
m_LocalRotation: {x: 0.11558351, y: 0.00000003563248, z: -0.000000004146316, w: 0.99329776}
|
||||||
m_LocalPosition: {x: 1.5039132, y: 2.1421127, z: -6.8609486}
|
m_LocalPosition: {x: 1.503913, y: 2.0657892, z: -6.8609486}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -2837,7 +2837,7 @@ GameObject:
|
|||||||
- component: {fileID: 402424906}
|
- component: {fileID: 402424906}
|
||||||
- component: {fileID: 402424905}
|
- component: {fileID: 402424905}
|
||||||
- component: {fileID: 402424907}
|
- component: {fileID: 402424907}
|
||||||
- component: {fileID: 402424909}
|
- component: {fileID: 402424911}
|
||||||
- component: {fileID: 402424910}
|
- component: {fileID: 402424910}
|
||||||
- component: {fileID: 402424908}
|
- component: {fileID: 402424908}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
@@ -2898,8 +2898,8 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 402424904}
|
m_GameObject: {fileID: 402424904}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0.09176965, y: 0.050800513, z: -0.0046878555, w: 0.9944726}
|
m_LocalRotation: {x: 0.115583494, y: 0.000000035632475, z: -0.000000004146315, w: 0.99329776}
|
||||||
m_LocalPosition: {x: 1.5039132, y: 2.1421127, z: -6.8609486}
|
m_LocalPosition: {x: 1.503913, y: 2.0657892, z: -6.8609486}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
@@ -2919,7 +2919,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
TargetOffset: {x: 0, y: 0, z: 0}
|
TargetOffset: {x: 0, y: 0, z: 0}
|
||||||
TrackerSettings:
|
TrackerSettings:
|
||||||
BindingMode: 0
|
BindingMode: 5
|
||||||
PositionDamping: {x: 1, y: 1, z: 1}
|
PositionDamping: {x: 1, y: 1, z: 1}
|
||||||
AngularDampingMode: 0
|
AngularDampingMode: 0
|
||||||
RotationDamping: {x: 0, y: 0, z: 0}
|
RotationDamping: {x: 0, y: 0, z: 0}
|
||||||
@@ -2929,7 +2929,7 @@ MonoBehaviour:
|
|||||||
Orbits:
|
Orbits:
|
||||||
Top:
|
Top:
|
||||||
Radius: 5.12
|
Radius: 5.12
|
||||||
Height: 6.55
|
Height: 5.25
|
||||||
Center:
|
Center:
|
||||||
Radius: 5.53
|
Radius: 5.53
|
||||||
Height: 2.7
|
Height: 2.7
|
||||||
@@ -2937,16 +2937,16 @@ MonoBehaviour:
|
|||||||
Radius: 4.18
|
Radius: 4.18
|
||||||
Height: 1.89
|
Height: 1.89
|
||||||
SplineCurvature: 0
|
SplineCurvature: 0
|
||||||
RecenteringTarget: 0
|
RecenteringTarget: 2
|
||||||
HorizontalAxis:
|
HorizontalAxis:
|
||||||
Value: 0
|
Value: 0
|
||||||
Center: 0
|
Center: 41.584503
|
||||||
Range: {x: -180, y: 180}
|
Range: {x: -180, y: 180}
|
||||||
Wrap: 1
|
Wrap: 1
|
||||||
Recentering:
|
Recentering:
|
||||||
Enabled: 0
|
Enabled: 0
|
||||||
Wait: 0
|
Wait: 0
|
||||||
Time: 0.3
|
Time: 60
|
||||||
Restrictions: 0
|
Restrictions: 0
|
||||||
VerticalAxis:
|
VerticalAxis:
|
||||||
Value: 20
|
Value: 20
|
||||||
@@ -2987,10 +2987,10 @@ MonoBehaviour:
|
|||||||
Controllers:
|
Controllers:
|
||||||
- Name: Look Orbit X
|
- Name: Look Orbit X
|
||||||
Owner: {fileID: 402424907}
|
Owner: {fileID: 402424907}
|
||||||
Enabled: 0
|
Enabled: 1
|
||||||
Input:
|
Input:
|
||||||
InputAction: {fileID: 6185001796860367008, guid: 652c4cc5d47d8de45a54e21abc9d8d1a, type: 3}
|
InputAction: {fileID: 6185001796860367008, guid: 652c4cc5d47d8de45a54e21abc9d8d1a, type: 3}
|
||||||
Gain: 1
|
Gain: 200
|
||||||
LegacyInput:
|
LegacyInput:
|
||||||
LegacyGain: 200
|
LegacyGain: 200
|
||||||
CancelDeltaTime: 0
|
CancelDeltaTime: 0
|
||||||
@@ -3026,35 +3026,6 @@ MonoBehaviour:
|
|||||||
DecelTime: 0
|
DecelTime: 0
|
||||||
PlayerIndex: -1
|
PlayerIndex: -1
|
||||||
AutoEnableInputs: 1
|
AutoEnableInputs: 1
|
||||||
--- !u!114 &402424909
|
|
||||||
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: f38bda98361e1de48a4ca2bd86ea3c17, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
Composition:
|
|
||||||
ScreenPosition: {x: 0, y: 0}
|
|
||||||
DeadZone:
|
|
||||||
Enabled: 0
|
|
||||||
Size: {x: 0.2, y: 0.2}
|
|
||||||
HardLimits:
|
|
||||||
Enabled: 0
|
|
||||||
Size: {x: 0.8, y: 0.8}
|
|
||||||
Offset: {x: 0, y: 0}
|
|
||||||
CenterOnActivate: 1
|
|
||||||
TargetOffset: {x: 0.57, y: 1.92, z: 0}
|
|
||||||
Damping: {x: 0, y: 0.1}
|
|
||||||
Lookahead:
|
|
||||||
Enabled: 1
|
|
||||||
Time: 0
|
|
||||||
Smoothing: 0
|
|
||||||
IgnoreY: 0
|
|
||||||
--- !u!114 &402424910
|
--- !u!114 &402424910
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -3076,6 +3047,35 @@ MonoBehaviour:
|
|||||||
FovRange: {x: 1, y: 100}
|
FovRange: {x: 1, y: 100}
|
||||||
DollyRange: {x: -100, y: 100}
|
DollyRange: {x: -100, y: 100}
|
||||||
OrthoSizeRange: {x: 1, y: 1000}
|
OrthoSizeRange: {x: 1, y: 1000}
|
||||||
|
--- !u!114 &402424911
|
||||||
|
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: f38bda98361e1de48a4ca2bd86ea3c17, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
Composition:
|
||||||
|
ScreenPosition: {x: 0, y: 0.15}
|
||||||
|
DeadZone:
|
||||||
|
Enabled: 0
|
||||||
|
Size: {x: 0.2, y: 0.2}
|
||||||
|
HardLimits:
|
||||||
|
Enabled: 0
|
||||||
|
Size: {x: 0.8, y: 0.8}
|
||||||
|
Offset: {x: 0, y: 0}
|
||||||
|
CenterOnActivate: 1
|
||||||
|
TargetOffset: {x: 0, y: 0, z: 0}
|
||||||
|
Damping: {x: 0.5, y: 0.5}
|
||||||
|
Lookahead:
|
||||||
|
Enabled: 0
|
||||||
|
Time: 0
|
||||||
|
Smoothing: 0
|
||||||
|
IgnoreY: 0
|
||||||
--- !u!1 &410087039
|
--- !u!1 &410087039
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -5296,7 +5296,7 @@ GameObject:
|
|||||||
- component: {fileID: 1379573503}
|
- component: {fileID: 1379573503}
|
||||||
- component: {fileID: 1379573507}
|
- component: {fileID: 1379573507}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Lock-On Target
|
m_Name: 'Lock-On Target: Platform'
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@@ -5419,7 +5419,7 @@ GameObject:
|
|||||||
- component: {fileID: 1505662771}
|
- component: {fileID: 1505662771}
|
||||||
- component: {fileID: 1505662775}
|
- component: {fileID: 1505662775}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Lock-On Target
|
m_Name: 'Lock-On Target: Floor'
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@@ -6150,7 +6150,7 @@ Transform:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 9.9538, y: 9.9538, z: 9.9538}
|
m_LocalScale: {x: 168.92595, y: 168.92595, z: 168.92595}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 204093123}
|
m_Father: {fileID: 204093123}
|
||||||
@@ -6713,10 +6713,10 @@ MonoBehaviour:
|
|||||||
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
|
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":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
|
||||||
(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
|
(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":1082.0,"y":-276.0},"$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
|
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":-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":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":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":-51.59897,"y":405.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},"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.13061,"y":270.8315},"$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,
|
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,
|
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,
|
||||||
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,
|
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,
|
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,
|
||||||
@@ -6733,7 +6733,7 @@ MonoBehaviour:
|
|||||||
_version: 3.31
|
_version: 3.31
|
||||||
_category:
|
_category:
|
||||||
_comments:
|
_comments:
|
||||||
_translation: {x: 601, y: 245}
|
_translation: {x: 134, y: 549}
|
||||||
_zoomFactor: 1
|
_zoomFactor: 1
|
||||||
_firstActivation: 0
|
_firstActivation: 0
|
||||||
_enableAction: 0
|
_enableAction: 0
|
||||||
@@ -6755,12 +6755,19 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 092c74123418b7a4482fc45aa5870077, type: 3}
|
m_Script: {fileID: 11500000, guid: 092c74123418b7a4482fc45aa5870077, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
lockOnDocument: {fileID: 1223043171}
|
|
||||||
lockOnTarget: {fileID: 0}
|
|
||||||
targetGroup: {fileID: 615613680}
|
|
||||||
cmOrbitalFollow: {fileID: 0}
|
|
||||||
lockOnRange: 40
|
lockOnRange: 40
|
||||||
lockOnTargets: []
|
lockOnMaxAngle: 70
|
||||||
|
lockonGameObject: {fileID: 0}
|
||||||
|
lockonTarget:
|
||||||
|
Object: {fileID: 0}
|
||||||
|
Weight: 1
|
||||||
|
Radius: 0.5
|
||||||
|
targetGroup: {fileID: 615613680}
|
||||||
|
lockOnTargets:
|
||||||
|
- {fileID: 1505662770}
|
||||||
|
- {fileID: 1379573502}
|
||||||
|
- {fileID: 263093399}
|
||||||
|
lockOnDocument: {fileID: 1223043171}
|
||||||
--- !u!1 &2024357130
|
--- !u!1 &2024357130
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class GenericLockOnTarget : MonoBehaviour, ILockOnTarget{
|
public class GenericLockOnTarget : MonoBehaviour, ILockOnTarget{
|
||||||
public float lockonTargetRadius{ get; set; } = 1f;
|
public float lockonTargetRadius{ get; set; } = 1f;
|
||||||
public Renderer thisRenderer { get; }
|
|
||||||
|
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start(){
|
void Start(){
|
||||||
@@ -10,6 +9,6 @@ public class GenericLockOnTarget : MonoBehaviour, ILockOnTarget{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Update(){
|
void Update(){
|
||||||
Debug.Log((this as ILockOnTarget).GetReticlePosition());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using NodeCanvas.Framework;
|
using NodeCanvas.Framework;
|
||||||
using ParadoxNotion.Design;
|
using ParadoxNotion.Design;
|
||||||
using ParadoxNotion.Services;
|
using ParadoxNotion.Services;
|
||||||
|
using Unity.Cinemachine;
|
||||||
using Unity.Mathematics;
|
using Unity.Mathematics;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
public enum PlayerFacingDirection{
|
||||||
|
Target = 0,
|
||||||
|
Movement,
|
||||||
|
MatchCamera
|
||||||
|
}
|
||||||
|
|
||||||
namespace NodeCanvas.Tasks.Actions {
|
namespace NodeCanvas.Tasks.Actions {
|
||||||
|
|
||||||
[Category("Reset/Movement")]
|
[Category("Reset/Movement")]
|
||||||
@@ -18,19 +27,36 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
public BBParameter<float> jumpPower;
|
public BBParameter<float> jumpPower;
|
||||||
public BBParameter<float> jumpPowerDecay;
|
public BBParameter<float> jumpPowerDecay;
|
||||||
|
|
||||||
|
// Rotation
|
||||||
|
public PlayerFacingDirection playerFacingDirection;
|
||||||
|
|
||||||
|
[ShowIf("playerFacingDirection", 0)]
|
||||||
|
public Vector3 rotationTargetPosition;
|
||||||
|
|
||||||
public BBParameter<float> rotationSpeed = 5f;
|
public BBParameter<float> rotationSpeed = 5f;
|
||||||
public BBParameter<float> rotationSmoothing;
|
public BBParameter<float> rotationSmoothing;
|
||||||
|
|
||||||
private float currentRotSpeed;
|
private float currentRotSpeed;
|
||||||
private Vector3 rotationNoY;
|
private float lastLookMagnitude;
|
||||||
|
private Quaternion targetRotation;
|
||||||
|
|
||||||
|
// References
|
||||||
|
private PlayerControls controls;
|
||||||
|
|
||||||
public BBParameter<float> gravityPower;
|
public BBParameter<float> gravityPower;
|
||||||
|
|
||||||
//Use for initialization. This is called only once in the lifetime of the task.
|
//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
|
//Return null if init was successfull. Return an error string otherwise
|
||||||
protected override string OnInit() {
|
protected override string OnInit() {
|
||||||
|
// Append the late update method to actually happen on late update
|
||||||
MonoManager.current.onLateUpdate += LateUpdate;
|
MonoManager.current.onLateUpdate += LateUpdate;
|
||||||
|
|
||||||
|
// What
|
||||||
currentRotSpeed = rotationSpeed.value;
|
currentRotSpeed = rotationSpeed.value;
|
||||||
|
|
||||||
|
// Reference to controls
|
||||||
|
controls = agent.GetComponent<PlayerControls>();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,67 +69,63 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
|
|
||||||
//Called once per frame while the action is active.
|
//Called once per frame while the action is active.
|
||||||
protected override void OnUpdate(){
|
protected override void OnUpdate(){
|
||||||
// Get input values
|
// Accelerate gravity
|
||||||
Vector2 rawLookInputVector3 = agent.GetComponent<PlayerControls>().rawLookInput;
|
|
||||||
Vector2 rawMoveInputVector3 = agent.GetComponent<PlayerControls>().rawMoveInput;
|
|
||||||
|
|
||||||
gravityPower.value += gravityAcceleration.value * Time.deltaTime;
|
gravityPower.value += gravityAcceleration.value * Time.deltaTime;
|
||||||
gravityPower.value = Mathf.Min(gravityPower.value, gravityMax.value);
|
gravityPower.value = Mathf.Min(gravityPower.value, gravityMax.value);
|
||||||
|
|
||||||
// Calculate rotation speed
|
// Calculate rotation speed
|
||||||
currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime);
|
currentRotSpeed = Mathf.Lerp(currentRotSpeed, rotationSpeed.value, rotationSmoothing.value * Time.deltaTime);
|
||||||
|
|
||||||
// Process input rotation
|
switch (playerFacingDirection) {
|
||||||
agent.transform.Rotate(new Vector3(0, agent.GetComponent<PlayerControls>().rawLookInput.x * rotationSpeed.value * 360f * Time.deltaTime)); // *360 to account for a full circle taking a long ass time
|
case PlayerFacingDirection.Target:
|
||||||
|
// Set rotation to just the direction of the target
|
||||||
|
targetRotation = Quaternion.LookRotation((agent.transform.position.DirectionTo(rotationTargetPosition)).Flatten(null, 0, null));
|
||||||
|
|
||||||
// Process movement rotation
|
break;
|
||||||
if (agent.isGrounded){
|
case PlayerFacingDirection.Movement:
|
||||||
// Quaternion cameraRotNoY = Quaternion.Euler(0f, Camera.main.transform.rotation.eulerAngles.y , 0f);
|
// Check magnitude to avoid the "Look rotation viewing vector is zero" debug
|
||||||
// agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, Quaternion.LookRotation(agent.transform.position + groundMoveDirection.value), 10f * Time.deltaTime);
|
if (controls.rawMoveInput.magnitude == 0) { break; }
|
||||||
} else {
|
|
||||||
// rotationNoY = airMoveDirection.value;
|
// Set desired rotation to input direction, with respect to camera rotation
|
||||||
// rotationNoY.x = 0f;
|
targetRotation = Quaternion.LookRotation(new Vector3(controls.rawMoveInput.x, 0, controls.rawMoveInput.y)) *
|
||||||
// rotationNoY.z = 0f;
|
Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f));
|
||||||
// agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, Quaternion.Euler(rotationNoY), 5f * Time.deltaTime);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set final rotation
|
||||||
|
agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime);
|
||||||
|
|
||||||
// Construct move direction
|
// Construct move direction
|
||||||
Vector3 finalMoveDir = Vector3.zero;
|
Vector3 finalMoveDir = Vector3.zero;
|
||||||
Vector3 gravityMoveDirection;
|
Vector3 gravityMoveDirection;
|
||||||
|
|
||||||
// Create movement direction for ground movement based on move direction, facing direction, and input
|
|
||||||
// Start by lerping facing direction towards move direction based on input power
|
|
||||||
rotationNoY = airMoveDirection.value;
|
|
||||||
rotationNoY.x = 0f;
|
|
||||||
rotationNoY.z = 0f;
|
|
||||||
|
|
||||||
// agent.transform.rotation = Quaternion.RotateTowards(agent.transform.rotation, Quaternion.Euler(rotationNoY), )
|
|
||||||
|
|
||||||
// Vector3 groundMoveDirModified = Vector3.Lerp();
|
|
||||||
|
|
||||||
// Add input movement
|
// Add input movement
|
||||||
if (agent.isGrounded){
|
if (agent.isGrounded){
|
||||||
Quaternion cameraRotNoY = Quaternion.Euler(0f, Camera.main.transform.rotation.eulerAngles.y , 0f);
|
|
||||||
|
|
||||||
finalMoveDir += groundMoveDirection.value + Vector3.down * .03f;
|
finalMoveDir += groundMoveDirection.value + Vector3.down * .03f;
|
||||||
gravityMoveDirection = new(0f, jumpPower.value + (Physics.gravity.y *.08f), 0f);
|
gravityMoveDirection = new(0f, jumpPower.value + (Physics.gravity.y *.3f), 0f);
|
||||||
} else {
|
} else {
|
||||||
finalMoveDir += airMoveDirection.value;
|
finalMoveDir += airMoveDirection.value;
|
||||||
gravityMoveDirection = new(0f, jumpPower.value + Physics.gravity.y * gravityPower.value, 0f);
|
gravityMoveDirection = new(0f, jumpPower.value + Physics.gravity.y * gravityPower.value, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do final movement
|
|
||||||
if (agent.isGrounded) {
|
|
||||||
agent.Move((Camera.main.transform.rotation * finalMoveDir + gravityMoveDirection) * Time.deltaTime);
|
|
||||||
} else {
|
|
||||||
agent.Move((finalMoveDir + gravityMoveDirection) * Time.deltaTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset gravity power when grounded
|
// Reset gravity power when grounded
|
||||||
if (agent.isGrounded) {
|
if (agent.isGrounded) {
|
||||||
gravityPower.value = 0f;
|
gravityPower.value = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do final movement
|
||||||
|
if (agent.isGrounded) {
|
||||||
|
agent.Move((Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f)) * finalMoveDir + gravityMoveDirection) * Time.deltaTime);
|
||||||
|
} else {
|
||||||
|
agent.Move((finalMoveDir + gravityMoveDirection) * Time.deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ???? Moved this above but don't remember if this needs to be here still
|
||||||
if (agent.isGrounded) {
|
if (agent.isGrounded) {
|
||||||
jumpPower.value = 0f;
|
jumpPower.value = 0f;
|
||||||
}
|
}
|
||||||
@@ -111,7 +133,6 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
|
|
||||||
// Gravity is processed in LateUpdate (added to MonoManager's onLateUpdate in OnInit())
|
// Gravity is processed in LateUpdate (added to MonoManager's onLateUpdate in OnInit())
|
||||||
public void LateUpdate(){
|
public void LateUpdate(){
|
||||||
|
|
||||||
// Decay jump power
|
// Decay jump power
|
||||||
jumpPower.value = Mathf.Lerp(jumpPower.value, 0f, jumpPowerDecay.value * Time.deltaTime);
|
jumpPower.value = Mathf.Lerp(jumpPower.value, 0f, jumpPowerDecay.value * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,24 +10,36 @@ using Vector2 = UnityEngine.Vector2;
|
|||||||
using Vector3 = UnityEngine.Vector3;
|
using Vector3 = UnityEngine.Vector3;
|
||||||
|
|
||||||
public class LockOnManager : MonoBehaviour{
|
public class LockOnManager : MonoBehaviour{
|
||||||
[ShowInInspector]
|
|
||||||
public UIDocument lockOnDocument;
|
|
||||||
public GameObject lockOnTarget;
|
|
||||||
public CinemachineTargetGroup targetGroup;
|
|
||||||
public CinemachineOrbitalFollow cmOrbitalFollow;
|
|
||||||
|
|
||||||
public float lockOnRange;
|
private CinemachineTargetGroup.Target playerTarget;
|
||||||
|
|
||||||
|
// Lock On settings
|
||||||
|
[Space(5)]
|
||||||
|
public float lockOnRange = 40f;
|
||||||
|
public float lockOnMaxAngle = 70f;
|
||||||
|
|
||||||
|
// Lock On Tracking
|
||||||
|
[Space(10)] public GameObject lockonGameObject; // Needed because nulling the Target below doesn't actually empty it out
|
||||||
|
[ReadOnly] public CinemachineTargetGroup.Target lockonTarget;
|
||||||
|
public CinemachineTargetGroup targetGroup;
|
||||||
|
|
||||||
[Space(5)]
|
[Space(5)]
|
||||||
public List<GameObject> lockOnTargets = new List<GameObject>();
|
public List<GameObject> lockOnTargets = new List<GameObject>();
|
||||||
|
|
||||||
|
// UI
|
||||||
|
[ShowInInspector]
|
||||||
|
public UIDocument lockOnDocument;
|
||||||
private Label elementLabelName;
|
private Label elementLabelName;
|
||||||
private VisualElement elementRoot;
|
private VisualElement elementRoot;
|
||||||
|
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start(){
|
||||||
{
|
// Save the player target object to track later
|
||||||
if (lockOnTarget && lockOnTarget.GetComponent<ILockOnTarget>() == null) {
|
playerTarget = targetGroup.Targets[0];
|
||||||
Debug.LogError($"Game Object {lockOnTarget.name} does not implement the ILockOnTarget interface. Not processing lock-on actions!");
|
|
||||||
|
// Quick check for things in lock-on target that aren't lock-onable
|
||||||
|
if (lockonGameObject != null && lockonTarget.Object.GetComponent<ILockOnTarget>() == null) {
|
||||||
|
Debug.LogError($"Game Object {lockonTarget.Object.name} does not implement the ILockOnTarget interface!");
|
||||||
}
|
}
|
||||||
|
|
||||||
elementRoot = lockOnDocument.rootVisualElement.Query<VisualElement>("LockOnGroup");
|
elementRoot = lockOnDocument.rootVisualElement.Query<VisualElement>("LockOnGroup");
|
||||||
@@ -47,17 +59,29 @@ public class LockOnManager : MonoBehaviour{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Update(){
|
void Update(){
|
||||||
if (targetGroup.Targets.Count > 1){
|
if (lockonGameObject && lockonTarget.Object.GetComponent<ILockOnTarget>() == null) {
|
||||||
targetGroup.Targets[1].Weight = Mathf.Lerp(targetGroup.Targets[1].Weight, .15f, 5f * Time.deltaTime);
|
Debug.LogError($"Game Object {lockonTarget.Object.name} does not implement the ILockOnTarget interface!");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 2; i < targetGroup.Targets.Count; i++) {
|
// Find the current lock-on target and increase it's weight to the .15f max slowly
|
||||||
|
// They start at 0 weight when the lock-on adds them to the group
|
||||||
|
if (lockonGameObject) {
|
||||||
|
CinemachineTargetGroup.Target currentTarget = targetGroup.Targets.Find(target => target == lockonTarget);
|
||||||
|
currentTarget.Weight = Mathf.MoveTowards(currentTarget.Weight, .15f, .5f * Time.deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If a target is not the current lock on target, lower their targeting weight. When low enough to not cause a sharp jitter, remove them.
|
||||||
|
for (int i = 1; i < targetGroup.Targets.Count; i++) {
|
||||||
|
if (targetGroup.Targets[i] == lockonTarget || targetGroup.Targets[i] == playerTarget){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (targetGroup.Targets[i].Weight < 0.001f) {
|
if (targetGroup.Targets[i].Weight < 0.001f) {
|
||||||
StartCoroutine(RemoveFromTargetAtFrameEnd(targetGroup.Targets[i]));
|
StartCoroutine(RemoveFromTargetAtFrameEnd(targetGroup.Targets[i]));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
targetGroup.Targets[i].Weight = Mathf.Lerp(targetGroup.Targets[i].Weight, 0f, 8f * Time.deltaTime);
|
targetGroup.Targets[i].Weight = Mathf.MoveTowards(targetGroup.Targets[i].Weight, 0f, 1f * Time.deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,91 +91,92 @@ public class LockOnManager : MonoBehaviour{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeLockOnTarget(){
|
public void ChangeLockOnTarget(){
|
||||||
if (!lockOnTarget) {
|
Transform cameraTransform = Camera.main.transform;
|
||||||
// If there is no target, simply find the closest to the center of the camera
|
|
||||||
GameObject mostForwardGameObject = null;
|
|
||||||
float mostForwardAngle = Mathf.Infinity;
|
|
||||||
|
|
||||||
foreach (GameObject target in lockOnTargets) {
|
// If there is no target, simply find the closest to the center of the camera
|
||||||
// Skip targets behind walls
|
GameObject closestTarget = null;
|
||||||
if (!Physics.Raycast(Camera.main.transform.position, Camera.main.transform.position - target.transform.position)) {
|
float lowestDistanceToCenter = Mathf.Infinity;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector3 dirToTarget = target.transform.position - Camera.main.transform.position;
|
foreach (GameObject target in lockOnTargets) {
|
||||||
float angleToTarget = Vector3.Angle(Camera.main.transform.forward, dirToTarget);
|
// Skip the current target if one exists
|
||||||
|
if (lockonGameObject != null && lockonTarget.Object.gameObject == target) {
|
||||||
// Set the new target to closest to screen
|
continue;
|
||||||
if (angleToTarget < mostForwardAngle) {
|
|
||||||
mostForwardAngle = angleToTarget;
|
|
||||||
mostForwardGameObject = target;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the winner to the new target
|
// Skip targets currently behind objects.
|
||||||
lockOnTarget = mostForwardGameObject;
|
Physics.Raycast(cameraTransform.position,
|
||||||
|
cameraTransform.position.DirectionTo(target.transform.position), out RaycastHit hit);
|
||||||
|
|
||||||
targetGroup.Targets.Insert(1, new CinemachineTargetGroup.Target{
|
if (hit.transform != target.transform) {
|
||||||
Object = mostForwardGameObject.transform,
|
continue;
|
||||||
Radius = 1f,
|
|
||||||
Weight = 0f
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Set it to either the next in the list or the first, if there already is a target
|
|
||||||
int desiredIndex;
|
|
||||||
|
|
||||||
if (lockOnTargets.IndexOf(lockOnTarget) == lockOnTargets.Count - 1) {
|
|
||||||
desiredIndex = 0;
|
|
||||||
} else {
|
|
||||||
desiredIndex = lockOnTargets.IndexOf(lockOnTarget) + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lockOnTarget = lockOnTargets[desiredIndex];
|
// Skip targets outside lock on angle
|
||||||
targetGroup.Targets.Insert(1, new CinemachineTargetGroup.Target{
|
float angleFromCameraForward = Vector3.Angle(cameraTransform.forward, cameraTransform.position.DirectionTo(target.transform.position));
|
||||||
Object = lockOnTargets[desiredIndex].transform,
|
if (angleFromCameraForward > lockOnMaxAngle) {
|
||||||
Radius = 1f,
|
continue;
|
||||||
Weight = 0f
|
}
|
||||||
});
|
|
||||||
|
// Find how close this target is from the center of the screen
|
||||||
|
Vector3 targetScreenPoint = Camera.main.WorldToScreenPoint(target.transform.position);
|
||||||
|
float distanceFromScreenCenter = targetScreenPoint.Flatten(null, null, 0f).magnitude - new Vector3(Screen.width, Screen.height, 0f).magnitude / 2f;
|
||||||
|
distanceFromScreenCenter = Mathf.Abs(distanceFromScreenCenter);
|
||||||
|
|
||||||
|
// Debug.Log($"{target.name}: {distanceFromScreenCenter} pixels, {angleFromCameraForward} degrees");
|
||||||
|
|
||||||
|
// Set the new target to closest to screen
|
||||||
|
if (distanceFromScreenCenter < lowestDistanceToCenter) {
|
||||||
|
lowestDistanceToCenter = distanceFromScreenCenter;
|
||||||
|
closestTarget = target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Catch exception from nothing being found
|
||||||
|
if (!closestTarget) {
|
||||||
|
Debug.LogWarning("Lock-on attempted, but no lock on target was found viable.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new Target for the Target Group
|
||||||
|
var newTarget = new CinemachineTargetGroup.Target{
|
||||||
|
Object = closestTarget.transform,
|
||||||
|
Radius = 1f,
|
||||||
|
Weight = 0f
|
||||||
|
};
|
||||||
|
|
||||||
|
// Set the new target variables
|
||||||
|
lockonTarget = newTarget;
|
||||||
|
lockonGameObject = closestTarget.gameObject;
|
||||||
|
|
||||||
|
targetGroup.Targets.Add(newTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveLockOnTarget(){
|
public void RemoveLockOnTarget(){
|
||||||
lockOnTarget = null;
|
lockonTarget = null;
|
||||||
cmOrbitalFollow.HorizontalAxis.Center = transform.rotation.eulerAngles.y;
|
lockonGameObject = null;
|
||||||
cmOrbitalFollow.HorizontalAxis.TriggerRecentering();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateLockOnUI(){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LateUpdate(){
|
void LateUpdate(){
|
||||||
if (lockOnTarget) {
|
if (lockonGameObject) {
|
||||||
if (lockOnTarget.GetComponent<ILockOnTarget>() != null) {
|
// This is just test logic to get an image above a lock on.
|
||||||
// This is just test logic to get an image above a lock on.
|
// TODO: Replace with something less silly
|
||||||
// TODO: Replace with something less silly
|
Vector2 screenPos = RuntimePanelUtils.CameraTransformWorldToPanel(
|
||||||
Vector2 screenPos = RuntimePanelUtils.CameraTransformWorldToPanel(
|
lockOnDocument.rootVisualElement.panel,
|
||||||
lockOnDocument.rootVisualElement.panel,
|
lockonTarget.Object.GetComponent<ILockOnTarget>().GetReticlePosition(),
|
||||||
lockOnTarget.GetComponent<ILockOnTarget>().GetReticlePosition(),
|
Camera.main
|
||||||
Camera.main.GetComponent<Camera>()
|
);
|
||||||
);
|
|
||||||
|
|
||||||
// Set name
|
// Set name
|
||||||
elementLabelName.text = lockOnTarget.name;
|
elementLabelName.text = lockonTarget.Object.name;
|
||||||
|
|
||||||
// Set position (add the width/height of the element)
|
// Set position (add the width/height of the element)
|
||||||
elementRoot.style.top = new StyleLength(screenPos.y - elementRoot.resolvedStyle.height * .7f);
|
elementRoot.style.top = new StyleLength(screenPos.y - 25f); // Was elementRoot.resolvedStyle.height * .7f
|
||||||
elementRoot.style.left = new StyleLength(screenPos.x - elementRoot.resolvedStyle.width / 2f);
|
elementRoot.style.left = new StyleLength(screenPos.x - elementRoot.resolvedStyle.width / 2f);
|
||||||
|
|
||||||
// Set enabled
|
// Set enabled
|
||||||
elementRoot.style.display = new StyleEnum<DisplayStyle>(DisplayStyle.Flex);
|
elementRoot.style.display = new StyleEnum<DisplayStyle>(DisplayStyle.Flex);
|
||||||
|
|
||||||
} else {
|
|
||||||
elementRoot.style.display = new StyleEnum<DisplayStyle>(DisplayStyle.None);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
elementRoot.style.display = new StyleEnum<DisplayStyle>(DisplayStyle.None);
|
elementRoot.style.display = new StyleEnum<DisplayStyle>(DisplayStyle.None);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,12 @@ public class PlayerControls : MonoBehaviour{
|
|||||||
|
|
||||||
public void OnLockOn(){
|
public void OnLockOn(){
|
||||||
GetComponent<LockOnManager>().ChangeLockOnTarget();
|
GetComponent<LockOnManager>().ChangeLockOnTarget();
|
||||||
|
graph.SendEvent<string>("InputEvent", "LockOn", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnCancelLockOn(){
|
public void OnCancelLockOn(){
|
||||||
GetComponent<LockOnManager>().RemoveLockOnTarget();
|
GetComponent<LockOnManager>().RemoveLockOnTarget();
|
||||||
|
graph.SendEvent<string>("InputEvent", "CancelLockOn", null);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user