change: finished and cleaned all settings changes, code commented, smoothing and easing are now exponential
This commit is contained in:
@@ -344,6 +344,142 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: c032a18b0b0c1da4092bfc365c6e4aad, type: 3}
|
m_Script: {fileID: 11500000, guid: c032a18b0b0c1da4092bfc365c6e4aad, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
data:
|
||||||
|
mainFieldOfView:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitPositionDamping:
|
||||||
|
targetValue: {x: 0, y: 0, z: 0}
|
||||||
|
currentValue: {x: 0, y: 0, z: 0}
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: {x: 0, y: 0, z: 0}
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitTargetOffset:
|
||||||
|
targetValue: {x: 0, y: 0, z: 0}
|
||||||
|
currentValue: {x: 0, y: 0, z: 0}
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: {x: 0, y: 0, z: 0}
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
axisLookEnabledX:
|
||||||
|
targetValue: 1
|
||||||
|
currentValue: 1
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 1
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
axisLookEnabledY:
|
||||||
|
targetValue: 1
|
||||||
|
currentValue: 1
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 1
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
axisLookGainX:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
axisLookGainY:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitFollowTopHeight:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 20
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitFollowTopRadius:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 20
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitFollowCenterHeight:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 20
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitFollowCenterRadius:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 20
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitFollowBottomHeight:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 20
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
orbitFollowBottomRadius:
|
||||||
|
targetValue: 0
|
||||||
|
currentValue: 0
|
||||||
|
targetSmoothing: 20
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 0
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
rotationComposerScreenPos:
|
||||||
|
targetValue: {x: 0, y: 0}
|
||||||
|
currentValue: {x: 0, y: 0}
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: {x: 0, y: 0}
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
cameraOffsetOffset:
|
||||||
|
targetValue: {x: 0, y: 0, z: 0}
|
||||||
|
currentValue: {x: 0, y: 0, z: 0}
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: {x: 0, y: 0, z: 0}
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
--- !u!114 &4383369033389970653
|
--- !u!114 &4383369033389970653
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -208,31 +208,32 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: b3b4e13d59527d1429a62dde97c6a001, type: 3}
|
m_Script: {fileID: 11500000, guid: b3b4e13d59527d1429a62dde97c6a001, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
outputMoveDirection: {x: 0, y: 0, z: 0}
|
|
||||||
additionalMoveDirection: {x: 0, y: 0, z: 0}
|
|
||||||
data:
|
data:
|
||||||
moveSmoothing:
|
directionChangingSoftness:
|
||||||
targetValue: {x: 0.5, y: 0.5}
|
targetValue: 1
|
||||||
currentValue: {x: 0.5, y: 0.5}
|
currentValue: 1
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
defaultValue: {x: 0.5, y: 0.5}
|
currentSmoothing: 1
|
||||||
|
defaultValue: 1
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
acceleration:
|
directionSpinningHardness:
|
||||||
targetValue: 10
|
targetValue: 30
|
||||||
currentValue: 1.5
|
currentValue: 30
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
defaultValue: 5
|
currentSmoothing: 1
|
||||||
|
defaultValue: 3
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
deacceleration:
|
directionSpinningSpeed:
|
||||||
targetValue: 20
|
targetValue: 5
|
||||||
currentValue: 2
|
currentValue: 5
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
defaultValue: 5
|
currentSmoothing: 1
|
||||||
|
defaultValue: 3
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
airDirectionDecay:
|
airDirectionDecay:
|
||||||
@@ -240,15 +241,26 @@ MonoBehaviour:
|
|||||||
currentValue: 1
|
currentValue: 1
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
softening:
|
acceleration:
|
||||||
targetValue: 4
|
targetValue: 28
|
||||||
currentValue: 1
|
currentValue: 28
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
defaultValue: 1
|
currentSmoothing: 1
|
||||||
|
defaultValue: 5
|
||||||
|
defaultSmoothing: 1
|
||||||
|
defaultEasing: 2
|
||||||
|
deacceleration:
|
||||||
|
targetValue: 20
|
||||||
|
currentValue: 20
|
||||||
|
targetSmoothing: 1
|
||||||
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
|
defaultValue: 5
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
moveSpeed:
|
moveSpeed:
|
||||||
@@ -256,6 +268,7 @@ MonoBehaviour:
|
|||||||
currentValue: 15
|
currentValue: 15
|
||||||
targetSmoothing: 10
|
targetSmoothing: 10
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 10
|
||||||
defaultValue: 15
|
defaultValue: 15
|
||||||
defaultSmoothing: 10
|
defaultSmoothing: 10
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
@@ -264,22 +277,25 @@ MonoBehaviour:
|
|||||||
currentValue: 1
|
currentValue: 1
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
gravityMax:
|
gravityMax:
|
||||||
targetValue: 8
|
targetValue: 4
|
||||||
currentValue: 8
|
currentValue: 4
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 8
|
defaultValue: 8
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
gravityAcceleration:
|
gravityAcceleration:
|
||||||
targetValue: 5
|
targetValue: 15
|
||||||
currentValue: 5
|
currentValue: 15
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
@@ -288,14 +304,16 @@ MonoBehaviour:
|
|||||||
currentValue: 1
|
currentValue: 1
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 1
|
defaultValue: 1
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
rotateFacing:
|
facingDirection:
|
||||||
targetValue: 4
|
targetValue: 4
|
||||||
currentValue: 4
|
currentValue: 4
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 4
|
defaultValue: 4
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
@@ -304,6 +322,7 @@ MonoBehaviour:
|
|||||||
currentValue: 5
|
currentValue: 5
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 5
|
defaultValue: 5
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
@@ -312,6 +331,7 @@ MonoBehaviour:
|
|||||||
currentValue: 0.3
|
currentValue: 0.3
|
||||||
targetSmoothing: 1
|
targetSmoothing: 1
|
||||||
targetEasing: 2
|
targetEasing: 2
|
||||||
|
currentSmoothing: 1
|
||||||
defaultValue: 0.3
|
defaultValue: 0.3
|
||||||
defaultSmoothing: 1
|
defaultSmoothing: 1
|
||||||
defaultEasing: 2
|
defaultEasing: 2
|
||||||
@@ -625,6 +645,7 @@ MonoBehaviour:
|
|||||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"currentSpeed":{"_name":"currentSpeed","_id":"f585caab-68c5-4ead-85c4-cbc16c18655e","$type":"NodeCanvas.Framework.Variable`1[[System.Single,
|
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"currentSpeed":{"_name":"currentSpeed","_id":"f585caab-68c5-4ead-85c4-cbc16c18655e","$type":"NodeCanvas.Framework.Variable`1[[System.Single,
|
||||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"movementData":{"_propertyPath":"Reset.Units.UnitMovementHandler.data","_name":"movementData","_id":"357123c2-2d10-4425-a3c9-7341e810fc88","$type":"NodeCanvas.Framework.Variable`1[[Reset.Units.UnitMovementData,
|
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"movementData":{"_propertyPath":"Reset.Units.UnitMovementHandler.data","_name":"movementData","_id":"357123c2-2d10-4425-a3c9-7341e810fc88","$type":"NodeCanvas.Framework.Variable`1[[Reset.Units.UnitMovementData,
|
||||||
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"outputMoveDirection":{"_propertyPath":"Reset.Units.UnitMovementHandler.outputMoveDirection","_name":"outputMoveDirection","_id":"3b9833f5-870a-4182-9824-e31a9896eec2","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"outputMoveDirection":{"_propertyPath":"Reset.Units.UnitMovementHandler.outputMoveDirection","_name":"outputMoveDirection","_id":"3b9833f5-870a-4182-9824-e31a9896eec2","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
||||||
|
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"myVector3":{"_name":"myVector3","_id":"9367e2ee-ac93-43f7-9cd7-6a7cf167e07a","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
||||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}}'
|
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}}'
|
||||||
_objectReferences: []
|
_objectReferences: []
|
||||||
_serializedVariables:
|
_serializedVariables:
|
||||||
@@ -649,6 +670,9 @@ MonoBehaviour:
|
|||||||
- _json: '{"_propertyPath":"Reset.Units.UnitMovementHandler.outputMoveDirection","_name":"outputMoveDirection","_id":"3b9833f5-870a-4182-9824-e31a9896eec2","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
- _json: '{"_propertyPath":"Reset.Units.UnitMovementHandler.outputMoveDirection","_name":"outputMoveDirection","_id":"3b9833f5-870a-4182-9824-e31a9896eec2","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
||||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}'
|
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}'
|
||||||
_references: []
|
_references: []
|
||||||
|
- _json: '{"_name":"myVector3","_id":"9367e2ee-ac93-43f7-9cd7-6a7cf167e07a","$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
||||||
|
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}'
|
||||||
|
_references: []
|
||||||
--- !u!114 &43868462096200776
|
--- !u!114 &43868462096200776
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -2971,19 +2971,19 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0.9996973
|
value: 0.99973595
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0.024602825
|
value: -0.022979952
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0.000000011836157
|
value: 3.1949018e-10
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 2.9129085e-10
|
value: 7.3437315e-12
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 1478733240008970968, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
@@ -3001,6 +3001,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 5
|
value: 5
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3229831872226355039, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
|
propertyPath: Composition.ScreenPosition.y
|
||||||
|
value: 0.14794445
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3716971538123186913, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 3716971538123186913, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: CameraGroup
|
value: CameraGroup
|
||||||
@@ -3019,24 +3023,48 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 0.9996973
|
value: 0.99973595
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: -0.024602825
|
value: -0.022979954
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0.000000011836157
|
value: 3.1949024e-10
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 2.9129105e-10
|
value: 7.34381e-12
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
- target: {fileID: 5136833180492354989, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
value: -89
|
value: -89
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7070283194321853303, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
|
propertyPath: data.orbitFollowTopHeight.targetSmoothing
|
||||||
|
value: 20
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7070283194321853303, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
|
propertyPath: data.orbitFollowTopRadius.targetSmoothing
|
||||||
|
value: 20
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7070283194321853303, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
|
propertyPath: data.orbitFollowBottomHeight.targetSmoothing
|
||||||
|
value: 20
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7070283194321853303, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
|
propertyPath: data.orbitFollowBottomRadius.targetSmoothing
|
||||||
|
value: 20
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7070283194321853303, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
|
propertyPath: data.orbitFollowCenterHeight.targetSmoothing
|
||||||
|
value: 20
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7070283194321853303, guid: 6ae1b39ffbe1f0f468d521bb08a8b547, type: 3}
|
||||||
|
propertyPath: data.orbitFollowCenterRadius.targetSmoothing
|
||||||
|
value: 20
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
|
|||||||
@@ -9,32 +9,36 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
[Category("Reset")]
|
[Category("Reset")]
|
||||||
[Description("Change Cinemachine camera settings for the player")]
|
[Description("Change Cinemachine camera settings for the player")]
|
||||||
public class ChangeCameraSettings : ActionTask{
|
public class ChangeCameraSettings : ActionTask{
|
||||||
[ParadoxNotion.Design.Header("Main Settings")]
|
[ParadoxNotion.Design.Header("Main Settings"), Space(8)]
|
||||||
public FloatValueGroup fieldOfView = new (newLabel: "FOV");
|
public FloatValueGroup fieldOfView = new (newLabel: "FOV");
|
||||||
|
|
||||||
[ParadoxNotion.Design.Header("Orbit Follow Ring Settings"), Space (5)]
|
|
||||||
public Vector3ValueGroup orbitTargetOffset = new(newLabel: "Target Offset");
|
public Vector3ValueGroup orbitTargetOffset = new(newLabel: "Target Offset");
|
||||||
[Space(5)]public Vector3ValueGroup orbitPositionDamping = new(newLabel: "Position Damping");
|
[Space(5)]public Vector3ValueGroup orbitPositionDamping = new(newLabel: "Position Damping");
|
||||||
|
|
||||||
public OrbitalFollowValueGroup orbitFollowTop = new (newLabel: "Top");
|
[ParadoxNotion.Design.Header("Orbit Follow Ring Settings"), Space (5)]
|
||||||
public OrbitalFollowValueGroup orbitFollowCenter = new (newLabel: "Center");
|
public OrbitalFollowValueGroup orbitFollowTop = new (newLabel: "Top Ring");
|
||||||
public OrbitalFollowValueGroup orbitFollowBottom = new (newLabel: "Bottom");
|
public OrbitalFollowValueGroup orbitFollowCenter = new (newLabel: "Top Ring");
|
||||||
|
[Space(8)]
|
||||||
|
public OrbitalFollowValueGroup orbitFollowBottom = new (newLabel: "Top Ring");
|
||||||
|
|
||||||
public BoolValueGroup enableXAxis = new (newLabel: "Input Axis X Enabled");
|
public BoolValueGroup enableXAxis = new (newLabel: "Input Axis X Enabled");
|
||||||
public BoolValueGroup enableYAxis = new (newLabel: "Input Axis Y Enabled");
|
public BoolValueGroup enableYAxis = new (newLabel: "Input Axis Y Enabled");
|
||||||
|
|
||||||
public FloatValueGroup axisLookXGain = new (newLabel: "Look Orbit X Gain");
|
public FloatValueGroup axisLookXGain = new (newLabel: "Look Orbit X Gain");
|
||||||
public FloatValueGroup axisLookYGain = new (newLabel: "Look Orbit Y Gain");
|
public FloatValueGroup axisLookYGain = new (newLabel: "Look Orbit Y Gain");
|
||||||
|
|
||||||
[ParadoxNotion.Design.Header("Rotation Composer Settings")]
|
[ParadoxNotion.Design.Header("Rotation Composer Settings"), Space(8)]
|
||||||
public Vector2ValueGroup screenPosition = new (newLabel: "Screen Position");
|
public Vector2ValueGroup screenPosition = new (newLabel: "Screen Position");
|
||||||
|
|
||||||
[ParadoxNotion.Design.Header("Camera Offset Settings")]
|
[ParadoxNotion.Design.Header("Camera Offset Settings"), Space(8)]
|
||||||
public Vector3ValueGroup cameraOffset = new (newLabel: "Offset");
|
public Vector3ValueGroup cameraOffset = new (newLabel: "Offset");
|
||||||
|
|
||||||
|
private CameraSettingsProcessor processor;
|
||||||
|
|
||||||
//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(){
|
||||||
|
processor = CameraSettingsProcessor.Instance;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,29 +46,28 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||||
//EndAction can be called from anywhere.
|
//EndAction can be called from anywhere.
|
||||||
protected override void OnExecute(){
|
protected override void OnExecute(){
|
||||||
OrbitalFollowValueGroup.UpdateValue(orbitFollowTop, ref CameraSettingsProcessor.data.orbitFollowTopHeight.targetValue, ref CameraSettingsProcessor.original.orbitFollowTopRadius.targetValue);
|
OrbitalFollowValueGroup.UpdateValue(orbitFollowTop, processor.data.orbitFollowTopHeight, processor.data.orbitFollowTopRadius);
|
||||||
OrbitalFollowValueGroup.UpdateValue(orbitFollowCenter, ref CameraSettingsProcessor.data.orbitFollowCenterHeight.targetValue, ref CameraSettingsProcessor.original.orbitFollowCenterRadius.targetValue);
|
OrbitalFollowValueGroup.UpdateValue(orbitFollowCenter, processor.data.orbitFollowCenterHeight, processor.data.orbitFollowCenterRadius);
|
||||||
OrbitalFollowValueGroup.UpdateValue(orbitFollowBottom, ref CameraSettingsProcessor.data.orbitFollowBottomHeight.targetValue, ref CameraSettingsProcessor.original.orbitFollowBottomRadius.targetValue);
|
OrbitalFollowValueGroup.UpdateValue(orbitFollowBottom, processor.data.orbitFollowBottomHeight, processor.data.orbitFollowBottomRadius);
|
||||||
|
|
||||||
Vector3ValueGroup.UpdateValue(cameraOffset, ref CameraSettingsProcessor.data.cameraOffsetOffset.targetValue, ref CameraSettingsProcessor.original.cameraOffsetOffset.targetValue);
|
Vector3ValueGroup.UpdateValue(cameraOffset, processor.data.cameraOffsetOffset);
|
||||||
|
|
||||||
Vector3ValueGroup.UpdateValue(orbitPositionDamping, ref CameraSettingsProcessor.data.orbitPositionDamping.targetValue, ref CameraSettingsProcessor.original.cameraOffsetOffset.targetValue);
|
Vector3ValueGroup.UpdateValue(orbitPositionDamping, processor.data.orbitPositionDamping);
|
||||||
Vector3ValueGroup.UpdateValue(orbitTargetOffset, ref CameraSettingsProcessor.data.orbitTargetOffset.targetValue, ref CameraSettingsProcessor.original.cameraOffsetOffset.targetValue);
|
Vector3ValueGroup.UpdateValue(orbitTargetOffset, processor.data.orbitTargetOffset);
|
||||||
|
|
||||||
Vector2ValueGroup.UpdateValue(screenPosition, ref CameraSettingsProcessor.data.rotationComposerScreenPos.targetValue, ref CameraSettingsProcessor.original.rotationComposerScreenPos.targetValue);
|
Vector2ValueGroup.UpdateValue(screenPosition, processor.data.rotationComposerScreenPos);
|
||||||
FloatValueGroup.UpdateValue(fieldOfView, ref CameraSettingsProcessor.data.mainFieldOfView.targetValue, ref CameraSettingsProcessor.original.mainFieldOfView.targetValue);
|
|
||||||
|
|
||||||
FloatValueGroup.UpdateValue(axisLookXGain, ref CameraSettingsProcessor.data.axisLookGainX.targetValue, ref CameraSettingsProcessor.original.axisLookGainX.targetValue);
|
FloatValueGroup.UpdateValue(fieldOfView, processor.data.mainFieldOfView);
|
||||||
FloatValueGroup.UpdateValue(axisLookYGain, ref CameraSettingsProcessor.data.axisLookGainY.targetValue, ref CameraSettingsProcessor.original.axisLookGainY.targetValue);
|
|
||||||
|
|
||||||
BoolValueGroup.UpdateValue(enableXAxis, ref CameraSettingsProcessor.data.axisLookEnabledX.targetValue, ref CameraSettingsProcessor.original.axisLookEnabledX.targetValue);
|
FloatValueGroup.UpdateValue(axisLookXGain, processor.data.axisLookGainX);
|
||||||
BoolValueGroup.UpdateValue(enableYAxis, ref CameraSettingsProcessor.data.axisLookEnabledY.targetValue, ref CameraSettingsProcessor.original.axisLookEnabledY.targetValue);
|
FloatValueGroup.UpdateValue(axisLookYGain, processor.data.axisLookGainY);
|
||||||
|
|
||||||
|
BoolValueGroup.UpdateValue(enableXAxis, processor.data.axisLookEnabledX);
|
||||||
|
BoolValueGroup.UpdateValue(enableYAxis, processor.data.axisLookEnabledY);
|
||||||
|
|
||||||
EndAction(true);
|
EndAction(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//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() {
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
directionOnStart = agent.transform.position.DirectionTo(grapplePoint.value);
|
directionOnStart = agent.transform.position.DirectionTo(grapplePoint.value);
|
||||||
|
|
||||||
// Get the current move direction
|
// Get the current move direction
|
||||||
velocityOnStart = agent.outputMoveDirection;
|
// velocityOnStart = agent.outputMoveDirection; // NOTE: Deprecated by new movement values
|
||||||
|
|
||||||
// For setting finalDirection's initial value, first compose the swing variables one-time
|
// For setting finalDirection's initial value, first compose the swing variables one-time
|
||||||
Vector3 velocityWhenMoving = CalculateSwingDirections(Vector3.Distance(agent.transform.position, grapplePoint.value), directionOnStart);
|
Vector3 velocityWhenMoving = CalculateSwingDirections(Vector3.Distance(agent.transform.position, grapplePoint.value), directionOnStart);
|
||||||
@@ -86,7 +86,7 @@ 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(){
|
||||||
agent.outputMoveDirection = Vector3.MoveTowards(agent.outputMoveDirection, Vector3.zero, .5f);
|
// agent.outputMoveDirection = Vector3.MoveTowards(agent.outputMoveDirection, Vector3.zero, .5f); // NOTE: Deprecated by new movement values
|
||||||
|
|
||||||
// Basic variables, direction to point and current distnace
|
// Basic variables, direction to point and current distnace
|
||||||
Vector3 directionToPoint = agent.transform.position.DirectionTo(grapplePoint.value);
|
Vector3 directionToPoint = agent.transform.position.DirectionTo(grapplePoint.value);
|
||||||
@@ -178,7 +178,7 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
gizmoFinalDirection = finalDirection;
|
gizmoFinalDirection = finalDirection;
|
||||||
|
|
||||||
// Finalize the movement to the controller
|
// Finalize the movement to the controller
|
||||||
agent.SetNewDirection(Vector3.Lerp(agent.additionalMoveDirection, finalDirection.Flatten(null, 0), 1f * Time.deltaTime));
|
// agent.SetNewDirection(Vector3.Lerp(agent.additionalMoveDirection, finalDirection.Flatten(null, 0), 1f * Time.deltaTime)); // NOTE: Deprecated by new movement values
|
||||||
agent.SetNewGravity(finalDirection.y);
|
agent.SetNewGravity(finalDirection.y);
|
||||||
agent.SmoothToSpeed(speed, 25f * Time.deltaTime);
|
agent.SmoothToSpeed(speed, 25f * Time.deltaTime);
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,9 @@ namespace Reset.Units {
|
|||||||
public class ChangeDirectionSettings : ActionTask<UnitMovementHandler> {
|
public class ChangeDirectionSettings : ActionTask<UnitMovementHandler> {
|
||||||
// Direction
|
// Direction
|
||||||
[Space(5)]
|
[Space(5)]
|
||||||
public Vector3ValueGroup feedNewDirection = new Vector3ValueGroup("Feed New Direction");
|
public FloatValueGroup directionChangingSoftness = new FloatValueGroup("Direction Changing Softness");
|
||||||
public float newDirectionStrength;
|
public FloatValueGroup directionSpinningHardness = new FloatValueGroup("Direction Spinning Hardness");
|
||||||
[Space(5)]
|
public FloatValueGroup directionSpinningSpeed = new FloatValueGroup("Direction Spinning Speed");
|
||||||
public Vector2 addDirectionFromInput;
|
|
||||||
public float addInputStrength;
|
|
||||||
[SliderField(0,1)]
|
|
||||||
public float addInputPriorty;
|
|
||||||
|
|
||||||
public FloatValueGroup directionSmoothing = new FloatValueGroup("Direction Smoothing");
|
|
||||||
|
|
||||||
//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
|
||||||
@@ -30,23 +24,9 @@ namespace Reset.Units {
|
|||||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||||
//EndAction can be called from anywhere.
|
//EndAction can be called from anywhere.
|
||||||
protected override void OnExecute() {
|
protected override void OnExecute() {
|
||||||
// Direction from value
|
FloatValueGroup.UpdateValue(directionChangingSoftness, agent.data.directionChangingSoftness);
|
||||||
// Check that feedDir is not changed
|
FloatValueGroup.UpdateValue(directionSpinningHardness, agent.data.directionSpinningHardness);
|
||||||
// UpdateVector3Value(feedNewDirection, ref feedDir, ref feedDir);
|
FloatValueGroup.UpdateValue(directionSpinningSpeed, agent.data.directionSpinningSpeed);
|
||||||
//
|
|
||||||
// Vector3ValueGroup.ResolvedValue(feedNewDirection, ref feedDir, ref feedDir);
|
|
||||||
//
|
|
||||||
// // If there's a direciton add it to the player for a frame
|
|
||||||
// if (feedDir != Vector3.zero) {
|
|
||||||
// agent.AddToCurrentDirection(agent.transform.rotation * feedDir.normalized, newDirectionStrength);
|
|
||||||
// // Reset the fed direction after it's added so future runs don't have
|
|
||||||
// feedDir = Vector3.zero;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Direction from controller input
|
|
||||||
if (addDirectionFromInput != Vector2.zero){
|
|
||||||
agent.OverwriteDirectionFromInput(new Vector3(addDirectionFromInput.x, addDirectionFromInput.y), addInputPriorty, addInputStrength);
|
|
||||||
}
|
|
||||||
|
|
||||||
EndAction(true);
|
EndAction(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ namespace Reset.Units {
|
|||||||
|
|
||||||
[Category("Reset/Movement")]
|
[Category("Reset/Movement")]
|
||||||
public class ChangeGravitySettings : ActionTask<UnitMovementHandler>{
|
public class ChangeGravitySettings : ActionTask<UnitMovementHandler>{
|
||||||
[SerializeField] public FloatValueGroup jumpPower = new FloatValueGroup("Jump Power");
|
[SliderField(0f, 1f), SerializeField] public FloatValueGroup airDirectionDecay = new FloatValueGroup("Air Direction Decay");
|
||||||
[SerializeField] public FloatValueGroup jumpPowerDecay = new FloatValueGroup("Jump Power Decay");
|
|
||||||
|
|
||||||
[SerializeField] public FloatValueGroup gravityPower = new FloatValueGroup("Gravity Power");
|
|
||||||
[SerializeField] public FloatValueGroup gravityMax = new FloatValueGroup("Gravity Max");
|
[SerializeField] public FloatValueGroup gravityMax = new FloatValueGroup("Gravity Max");
|
||||||
[SerializeField] public FloatValueGroup gravityAcceleration = new FloatValueGroup("Gravity Acceleration");
|
[SerializeField] public FloatValueGroup gravityAcceleration = new FloatValueGroup("Gravity Acceleration");
|
||||||
[SerializeField] public FloatValueGroup gravityScale = new FloatValueGroup("Gravity Scale");
|
[SerializeField] public FloatValueGroup gravityScale = new FloatValueGroup("Gravity Scale");
|
||||||
@@ -27,23 +25,10 @@ namespace Reset.Units {
|
|||||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||||
//EndAction can be called from anywhere.
|
//EndAction can be called from anywhere.
|
||||||
protected override void OnExecute() {
|
protected override void OnExecute() {
|
||||||
// Deprecated by unified gravity system, including SetNewGravity
|
FloatValueGroup.UpdateValue(airDirectionDecay, agent.data.airDirectionDecay);
|
||||||
// // Jump
|
|
||||||
// FloatValueGroup.UpdateValue(jumpPower, ref agent.data.jumpPower.value, ref agent.defaultData.jumpPower.value);
|
|
||||||
// ValueGroup.ChangeSmoothingEasing(jumpPower, ref agent.data.jumpPower.currentSmoothing,
|
|
||||||
// ref agent.data.jumpPower.easing, ref agent.defaultData.jumpPower.smoothing, ref agent.defaultData.jumpPower.easing);
|
|
||||||
|
|
||||||
// FloatValueGroup.UpdateValue(jumpPowerDecay, agent.data.jumpPowerDecay);
|
|
||||||
|
|
||||||
// Deprecated by SetNewGravity
|
|
||||||
// FloatValueGroup.UpdateValue(gravityPower, ref agent.data.gravityPower.value, ref agent.defaultData.gravityPower.value);
|
|
||||||
// ValueGroup.ChangeSmoothingEasing(gravityPower, ref agent.data.gravityPower.currentSmoothing,
|
|
||||||
// ref agent.data.gravityPower.easing, ref agent.defaultData.gravityPower.smoothing, ref agent.defaultData.gravityPower.easing);
|
|
||||||
|
|
||||||
FloatValueGroup.UpdateValue(gravityMax, agent.data.gravityMax);
|
FloatValueGroup.UpdateValue(gravityMax, agent.data.gravityMax);
|
||||||
|
|
||||||
FloatValueGroup.UpdateValue(gravityAcceleration, agent.data.gravityAcceleration);
|
FloatValueGroup.UpdateValue(gravityAcceleration, agent.data.gravityAcceleration);
|
||||||
|
|
||||||
FloatValueGroup.UpdateValue(gravityScale, agent.data.gravityScale);
|
FloatValueGroup.UpdateValue(gravityScale, agent.data.gravityScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,18 +22,9 @@ namespace Reset.Units {
|
|||||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||||
//EndAction can be called from anywhere.
|
//EndAction can be called from anywhere.
|
||||||
protected override void OnExecute() {
|
protected override void OnExecute() {
|
||||||
FloatValueGroup.UpdateValue(moveSpeed, ref agent.data.moveSpeed.targetValue, ref agent.data.moveSpeed.defaultValue);
|
FloatValueGroup.UpdateValue(moveSpeed, agent.data.moveSpeed);
|
||||||
ValueGroup.ChangeSmoothingEasing(moveSpeed, ref agent.data.moveSpeed.targetSmoothing,
|
FloatValueGroup.UpdateValue(acceleration, agent.data.acceleration);
|
||||||
ref agent.data.moveSpeed.targetEasing, ref agent.data.moveSpeed.defaultSmoothing, ref agent.data.moveSpeed.defaultEasing);
|
FloatValueGroup.UpdateValue(deacceleration, agent.data.deacceleration);
|
||||||
|
|
||||||
FloatValueGroup.UpdateValue(acceleration, ref agent.data.acceleration.targetValue, ref agent.data.acceleration.defaultValue);
|
|
||||||
ValueGroup.ChangeSmoothingEasing(acceleration, ref agent.data.acceleration.targetSmoothing,
|
|
||||||
ref agent.data.acceleration.targetEasing, ref agent.data.acceleration.defaultSmoothing, ref agent.data.acceleration.defaultEasing);
|
|
||||||
|
|
||||||
FloatValueGroup.UpdateValue(deacceleration, ref agent.data.deacceleration.targetValue, ref agent.data.deacceleration.defaultValue);
|
|
||||||
ValueGroup.ChangeSmoothingEasing(deacceleration, ref agent.data.deacceleration.targetSmoothing,
|
|
||||||
ref agent.data.deacceleration.targetEasing, ref agent.data.deacceleration.defaultSmoothing, ref agent.data.deacceleration.defaultEasing);
|
|
||||||
|
|
||||||
|
|
||||||
EndAction(true);
|
EndAction(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using Codice.Client.BaseCommands;
|
||||||
using NodeCanvas.Framework;
|
using NodeCanvas.Framework;
|
||||||
using ParadoxNotion.Design;
|
using ParadoxNotion.Design;
|
||||||
|
using Reset.Core;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
namespace Reset.Units {
|
namespace Reset.Units {
|
||||||
|
|
||||||
[Category("Reset/Movement")]
|
[Category("Reset/Movement")]
|
||||||
public class ChangeRotationSettings : ActionTask<UnitMovementHandler> {
|
public class ChangeRotationSettings : ActionTask<UnitMovementHandler> {
|
||||||
|
[SerializeField] public EnumValueGroup facingDirection = new EnumValueGroup("Facing Direction", PlayerFacingDirection.TowardsTarget);
|
||||||
|
[SerializeField] public FloatValueGroup rotationSpeed = new (newLabel: "Rotation Speed");
|
||||||
|
|
||||||
//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() {
|
||||||
@@ -16,7 +22,10 @@ namespace Reset.Units {
|
|||||||
//This is called once each time the task is enabled.
|
//This is called once each time the task is enabled.
|
||||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||||
//EndAction can be called from anywhere.
|
//EndAction can be called from anywhere.
|
||||||
protected override void OnExecute() {
|
protected override void OnExecute(){
|
||||||
|
EnumValueGroup.UpdateValue(facingDirection, agent.data.facingDirection);
|
||||||
|
FloatValueGroup.UpdateValue(rotationSpeed, agent.data.rotationSpeed);
|
||||||
|
|
||||||
EndAction(true);
|
EndAction(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace NodeCanvas.Tasks.Actions {
|
|||||||
switch (playerFacingDirection.value) {
|
switch (playerFacingDirection.value) {
|
||||||
case PlayerFacingDirection.TowardsTarget:
|
case PlayerFacingDirection.TowardsTarget:
|
||||||
break;
|
break;
|
||||||
case PlayerFacingDirection.MatchForward: // TODO: Recomment
|
case PlayerFacingDirection.MatchInput: // TODO: Recomment
|
||||||
// targetDirection = agent.transform.forward * inputMovement.magnitude;
|
// targetDirection = agent.transform.forward * inputMovement.magnitude;
|
||||||
targetDirection = inputMovement;
|
targetDirection = inputMovement;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -15,23 +15,23 @@ namespace Reset.Core{
|
|||||||
public BBParameter<float> Easing{ get; set; }
|
public BBParameter<float> Easing{ get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ChangeSmoothingEasing(ISmoothable valueGroup, ref float targetSmoothing,
|
public static void ChangeSmoothingEasing<T>(ISmoothable valueGroup, SettingValue<T> settingValue){
|
||||||
ref float targetEasing, ref float defaultSmoothing, ref float defaultEasing){
|
|
||||||
switch (valueGroup.changeSmoothing.value) {
|
switch (valueGroup.changeSmoothing.value) {
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
targetSmoothing = valueGroup.Smoothing.value;
|
settingValue.targetSmoothing = valueGroup.Smoothing.value;
|
||||||
|
settingValue.currentSmoothing = valueGroup.Smoothing.value;
|
||||||
break;
|
break;
|
||||||
case ValueChangeAction.ResetValue:
|
case ValueChangeAction.ResetValue:
|
||||||
targetSmoothing = defaultSmoothing;
|
settingValue.targetSmoothing = settingValue.defaultSmoothing;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (valueGroup.changeEasing.value) {
|
switch (valueGroup.changeEasing.value) {
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
targetEasing = valueGroup.Easing.value;
|
settingValue.targetEasing = valueGroup.Easing.value;
|
||||||
break;
|
break;
|
||||||
case ValueChangeAction.ResetValue:
|
case ValueChangeAction.ResetValue:
|
||||||
targetEasing = defaultEasing;
|
settingValue.targetEasing = settingValue.defaultEasing;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,12 +96,54 @@ namespace Reset.Core{
|
|||||||
|
|
||||||
changeEasing = new BBParameter<ValueChangeAction>();
|
changeEasing = new BBParameter<ValueChangeAction>();
|
||||||
Easing = new BBParameter<float>().value = 0f;
|
Easing = new BBParameter<float>().value = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateValue(OrbitalFollowValueGroup valueGroup, SettingValue<float> heightSetting, SettingValue<float> radiusSetting){
|
||||||
|
switch (valueGroup.changeHeight.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
heightSetting.Value = valueGroup.height.value;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
heightSetting.Value = heightSetting.defaultValue;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.RelativeValue:
|
||||||
|
heightSetting.Value += valueGroup.height.value;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (valueGroup.changeRadius.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
radiusSetting.Value = valueGroup.radius.value;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
radiusSetting.Value = radiusSetting.defaultValue;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.RelativeValue:
|
||||||
|
radiusSetting.Value += valueGroup.radius.value;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ValueGroup.ChangeSmoothingEasing(valueGroup, heightSetting);
|
||||||
|
|
||||||
|
|
||||||
|
// Debug.Log($"{heightSetting.targetSmoothing} {valueGroup.Smoothing.value}");
|
||||||
|
ValueGroup.ChangeSmoothingEasing(valueGroup, radiusSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
public static void UpdateValue(OrbitalFollowValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
public static void UpdateValue(OrbitalFollowValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
||||||
switch (valueGroup.changeHeight.value) {
|
switch (valueGroup.changeHeight.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
targetProperty = valueGroup.height.value;
|
targetProperty = valueGroup.height.value;
|
||||||
break;
|
break;
|
||||||
@@ -111,6 +153,7 @@ namespace Reset.Core{
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (valueGroup.changeRadius.value) {
|
switch (valueGroup.changeRadius.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
targetProperty = valueGroup.radius.value;
|
targetProperty = valueGroup.radius.value;
|
||||||
break;
|
break;
|
||||||
@@ -133,14 +176,18 @@ namespace Reset.Core{
|
|||||||
value = new AnimationCurve();
|
value = new AnimationCurve();
|
||||||
label = newLabel;
|
label = newLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateValue(CurveValueGroup valueGroup, ref AnimationCurve targetProperty, ref AnimationCurve defaultProperty){
|
public static void UpdateValue(CurveValueGroup valueGroup, SettingValue<AnimationCurve> settingValue){
|
||||||
switch (valueGroup.changeValue.value) {
|
switch (valueGroup.changeValue.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
targetProperty = valueGroup.value.value;
|
settingValue.Value = valueGroup.value.value;
|
||||||
break;
|
break;
|
||||||
case ValueChangeAction.ResetValue:
|
case ValueChangeAction.ResetValue:
|
||||||
targetProperty = defaultProperty;
|
settingValue.Value = settingValue.defaultValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,16 +206,21 @@ namespace Reset.Core{
|
|||||||
label = newLabel;
|
label = newLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateValue(EnumValueGroup valueGroup, ref Enum targetProperty, ref Enum defaultProperty){
|
public static void UpdateValue<T>(EnumValueGroup valueGroup, SettingValue<T> settingValue){
|
||||||
switch (valueGroup.changeValue.value) {
|
switch (valueGroup.changeValue.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
targetProperty = valueGroup.value.value;
|
settingValue.Value = (T)(object)valueGroup.value.value;
|
||||||
break;
|
break;
|
||||||
case ValueChangeAction.ResetValue:
|
case ValueChangeAction.ResetValue:
|
||||||
targetProperty = defaultProperty;
|
settingValue.Value = settingValue.defaultValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Vector3ValueGroup : ValueGroup.ISmoothable{ // Done
|
public class Vector3ValueGroup : ValueGroup.ISmoothable{ // Done
|
||||||
@@ -227,8 +279,57 @@ namespace Reset.Core{
|
|||||||
|
|
||||||
changeEasing = new BBParameter<ValueChangeAction>();
|
changeEasing = new BBParameter<ValueChangeAction>();
|
||||||
Easing = new BBParameter<float>().value = 0f;
|
Easing = new BBParameter<float>().value = 0f;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateValue(Vector3ValueGroup valueGroup, SettingValue<Vector3> settingValue){
|
||||||
|
Vector3 newValue = settingValue.Value;
|
||||||
|
|
||||||
|
switch (valueGroup.changeX.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
newValue.x = valueGroup.value.value.x;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
newValue.x = settingValue.defaultValue.x;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (valueGroup.changeY.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
newValue.y = valueGroup.value.value.y;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
newValue.y = settingValue.defaultValue.y;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (valueGroup.changeZ.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
newValue.z = valueGroup.value.value.z;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
newValue.z = settingValue.defaultValue.z;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
settingValue.Value = newValue;
|
||||||
|
|
||||||
|
ValueGroup.ChangeSmoothingEasing(valueGroup, settingValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
public static void UpdateValue(Vector3ValueGroup valueGroup, ref Vector3 targetProperty, ref Vector3 defaultProperty){
|
public static void UpdateValue(Vector3ValueGroup valueGroup, ref Vector3 targetProperty, ref Vector3 defaultProperty){
|
||||||
switch (valueGroup.changeX.value) {
|
switch (valueGroup.changeX.value) {
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
@@ -313,7 +414,42 @@ namespace Reset.Core{
|
|||||||
changeEasing = new BBParameter<ValueChangeAction>();
|
changeEasing = new BBParameter<ValueChangeAction>();
|
||||||
Easing = new BBParameter<float>().value = 0f;
|
Easing = new BBParameter<float>().value = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UpdateValue(Vector2ValueGroup valueGroup, SettingValue<Vector2> settingValue){
|
||||||
|
Vector2 newValue = settingValue.Value;
|
||||||
|
|
||||||
|
switch (valueGroup.changeX.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
newValue.x = valueGroup.value.value.x;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
newValue.x = settingValue.defaultValue.x;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (valueGroup.changeY.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
newValue.y = valueGroup.value.value.y;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
newValue.y = settingValue.defaultValue.y;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
settingValue.Value = newValue;
|
||||||
|
|
||||||
|
ValueGroup.ChangeSmoothingEasing(valueGroup, settingValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
public static void UpdateValue(Vector2ValueGroup valueGroup, ref Vector2 targetProperty, ref Vector2 defaultProperty){
|
public static void UpdateValue(Vector2ValueGroup valueGroup, ref Vector2 targetProperty, ref Vector2 defaultProperty){
|
||||||
switch (valueGroup.changeX.value) {
|
switch (valueGroup.changeX.value) {
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
@@ -386,6 +522,7 @@ namespace Reset.Core{
|
|||||||
|
|
||||||
public static void UpdateValue(FloatValueGroup valueGroup, SettingValue<float> settingValue){
|
public static void UpdateValue(FloatValueGroup valueGroup, SettingValue<float> settingValue){
|
||||||
switch (valueGroup.changeValue.value) {
|
switch (valueGroup.changeValue.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
settingValue.Value = valueGroup.value.value;
|
settingValue.Value = valueGroup.value.value;
|
||||||
break;
|
break;
|
||||||
@@ -395,12 +532,15 @@ namespace Reset.Core{
|
|||||||
case ValueChangeAction.RelativeValue:
|
case ValueChangeAction.RelativeValue:
|
||||||
settingValue.Value += valueGroup.value.value;
|
settingValue.Value += valueGroup.value.value;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueGroup.ChangeSmoothingEasing(valueGroup, ref settingValue.targetSmoothing,
|
ValueGroup.ChangeSmoothingEasing(valueGroup, settingValue);
|
||||||
ref settingValue.targetEasing, ref settingValue.defaultEasing, ref settingValue.defaultSmoothing);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
public static void UpdateValue(FloatValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
public static void UpdateValue(FloatValueGroup valueGroup, ref float targetProperty, ref float defaultProperty){
|
||||||
Debug.LogWarning("Deprecated call of UpdateValue(). Use the new one with only two arguments!");
|
Debug.LogWarning("Deprecated call of UpdateValue(). Use the new one with only two arguments!");
|
||||||
switch (valueGroup.changeValue.value) {
|
switch (valueGroup.changeValue.value) {
|
||||||
@@ -429,8 +569,25 @@ namespace Reset.Core{
|
|||||||
changeValue = ValueChangeAction.NoChange;
|
changeValue = ValueChangeAction.NoChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void UpdateValue(BoolValueGroup valueGroup, SettingValue<bool> settingValue){
|
||||||
|
switch (valueGroup.changeValue.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
|
case ValueChangeAction.NewValue:
|
||||||
|
settingValue.Value = valueGroup.value.value;
|
||||||
|
break;
|
||||||
|
case ValueChangeAction.ResetValue:
|
||||||
|
settingValue.Value = settingValue.defaultValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Debug.LogError($"No value was changed for part of {valueGroup.label} because this ValueChangeAction was not supported.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
public static void UpdateValue(BoolValueGroup valueGroup, ref bool targetProperty, ref bool defaultProperty){
|
public static void UpdateValue(BoolValueGroup valueGroup, ref bool targetProperty, ref bool defaultProperty){
|
||||||
switch (valueGroup.changeValue.value) {
|
switch (valueGroup.changeValue.value) {
|
||||||
|
case ValueChangeAction.NoChange: break;
|
||||||
case ValueChangeAction.NewValue:
|
case ValueChangeAction.NewValue:
|
||||||
targetProperty = valueGroup.value.value;
|
targetProperty = valueGroup.value.value;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -16,14 +16,10 @@ using UnityEngine;
|
|||||||
GUILayout.MinWidth(20.0f),
|
GUILayout.MinWidth(20.0f),
|
||||||
GUILayout.ExpandWidth(true),
|
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
|
// 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.BeginVertical();
|
||||||
GUILayout.Label(_instance.label, labelOptions);
|
GUILayout.Label(_instance.label, ValueGroupEditorUtilities.titleText);
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
|
|
||||||
// Create the x settings enum
|
// Create the x settings enum
|
||||||
@@ -66,13 +62,9 @@ using UnityEngine;
|
|||||||
GUILayout.ExpandWidth(true),
|
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
|
// 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.BeginVertical();
|
||||||
GUILayout.Label(_instance.label, labelOptions);
|
GUILayout.Label(_instance.label, ValueGroupEditorUtilities.titleText);
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
|
|
||||||
// Create the x settings enum
|
// Create the x settings enum
|
||||||
@@ -105,14 +97,11 @@ using UnityEngine;
|
|||||||
GUILayout.MinWidth(100.0f),
|
GUILayout.MinWidth(100.0f),
|
||||||
GUILayout.ExpandWidth(true),
|
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
|
// 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.BeginVertical();
|
||||||
GUILayout.Label(_instance.label, labelOptions);
|
GUILayout.Label(_instance.label, ValueGroupEditorUtilities.titleText);
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
|
|
||||||
// Create the x settings enum
|
// Create the x settings enum
|
||||||
@@ -152,22 +141,9 @@ using UnityEngine;
|
|||||||
GUILayout.MinWidth(20.0f),
|
GUILayout.MinWidth(20.0f),
|
||||||
GUILayout.ExpandWidth(true),
|
GUILayout.ExpandWidth(true),
|
||||||
};
|
};
|
||||||
|
|
||||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
|
||||||
GUILayout.Width(200.0f),
|
|
||||||
};
|
|
||||||
|
|
||||||
GUIStyle titleText = new GUIStyle{
|
|
||||||
fontSize = 12,
|
|
||||||
fontStyle = FontStyle.Bold,
|
|
||||||
padding = new RectOffset(8, 0, 3,0),
|
|
||||||
normal ={
|
|
||||||
textColor = Color.white
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
// 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.Label(_instance.label, titleText);
|
GUILayout.Label(_instance.label, ValueGroupEditorUtilities.titleText);
|
||||||
|
|
||||||
// End the label
|
// End the label
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
@@ -210,14 +186,10 @@ using UnityEngine;
|
|||||||
GUILayout.MinWidth(20.0f),
|
GUILayout.MinWidth(20.0f),
|
||||||
GUILayout.ExpandWidth(true),
|
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
|
// 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.BeginVertical();
|
||||||
GUILayout.Label(_instance.label, labelOptions);
|
GUILayout.Label(_instance.label, ValueGroupEditorUtilities.titleText);
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
|
|
||||||
// Create the x settings enum
|
// Create the x settings enum
|
||||||
@@ -292,14 +264,10 @@ using UnityEngine;
|
|||||||
GUILayout.MinWidth(20.0f),
|
GUILayout.MinWidth(20.0f),
|
||||||
GUILayout.ExpandWidth(true),
|
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
|
// 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.BeginVertical();
|
||||||
GUILayout.Label(_instance.label, labelOptions);
|
GUILayout.Label(_instance.label, ValueGroupEditorUtilities.titleText);
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
|
|
||||||
// Create the x settings enum
|
// Create the x settings enum
|
||||||
@@ -354,49 +322,73 @@ using UnityEngine;
|
|||||||
|
|
||||||
// Set layout options for the label and the float fields
|
// Set layout options for the label and the float fields
|
||||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||||
GUILayout.Width(300.0f),
|
// GUILayout.Width(300.0f),
|
||||||
GUILayout.MinWidth(20.0f),
|
// GUILayout.MinWidth(20.0f),
|
||||||
GUILayout.ExpandWidth(true),
|
GUILayout.ExpandWidth(true),
|
||||||
};
|
};
|
||||||
|
|
||||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
|
||||||
GUILayout.Width(60.0f),
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start a Horiztonal Section
|
// Add the label
|
||||||
|
GUILayout.Label(_instance.label, ValueGroupEditorUtilities.titleText);
|
||||||
|
|
||||||
|
// Start the smoothing and easing section
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
|
|
||||||
// Add the left side label
|
GUIStyle smallText= new GUIStyle{
|
||||||
GUILayout.Label(_instance.label, labelOptions);
|
fontSize = 10,
|
||||||
|
padding = new RectOffset(8, 0, 0,0),
|
||||||
// Create the height settings enum
|
normal ={
|
||||||
_instance.changeHeight.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeHeight.value);
|
textColor = Color.gray + Color.gray / 2f
|
||||||
|
}
|
||||||
// Create the value/disabled information field
|
};
|
||||||
if (_instance.changeHeight.value == ValueChangeAction.NewValue){
|
|
||||||
_instance.height.value = EditorGUILayout.FloatField(_instance.height.value, floatOptions);
|
// Start the left side for height
|
||||||
|
GUILayout.BeginVertical();
|
||||||
|
|
||||||
|
// Draw the label
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("Height", smallText);
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
// Height
|
||||||
|
BBParameterEditor.ParameterField("", _instance.changeHeight);
|
||||||
|
|
||||||
|
if (_instance.changeHeight.value == ValueChangeAction.NewValue || _instance.changeHeight.value == ValueChangeAction.RelativeValue){
|
||||||
|
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||||
|
BBParameterEditor.ParameterField("", _instance.height);
|
||||||
} else {
|
} else {
|
||||||
EditorGUI.BeginDisabledGroup(true);
|
EditorGUI.BeginDisabledGroup(true);
|
||||||
EditorGUILayout.TextField(_instance.changeHeight.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
EditorGUILayout.TextField(_instance.changeHeight.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||||
EditorGUI.EndDisabledGroup();
|
EditorGUI.EndDisabledGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// It do what it do.
|
// Close height
|
||||||
GUILayout.Space(5);
|
GUILayout.EndVertical();
|
||||||
|
|
||||||
// Create the radius settings enum
|
// Start the right for radius
|
||||||
_instance.changeRadius.value = (ValueChangeAction)EditorGUILayout.EnumPopup("", _instance.changeRadius.value);
|
GUILayout.BeginVertical();
|
||||||
|
|
||||||
// Create the value/disabled information field
|
// Draw the label
|
||||||
if (_instance.changeRadius.value == ValueChangeAction.NewValue){
|
GUILayout.BeginHorizontal();
|
||||||
_instance.radius = EditorGUILayout.FloatField(_instance.radius.value, floatOptions);
|
GUILayout.Label("Radius", smallText);
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
// Radius
|
||||||
|
BBParameterEditor.ParameterField("", _instance.changeRadius);
|
||||||
|
|
||||||
|
if (_instance.changeRadius.value == ValueChangeAction.NewValue || _instance.changeRadius.value == ValueChangeAction.RelativeValue){
|
||||||
|
// _instance.value = EditorGUILayout.FloatField(_instance.value, floatOptions);
|
||||||
|
BBParameterEditor.ParameterField("", _instance.radius);
|
||||||
} else {
|
} else {
|
||||||
EditorGUI.BeginDisabledGroup(true);
|
EditorGUI.BeginDisabledGroup(true);
|
||||||
EditorGUILayout.TextField(_instance.changeRadius.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
EditorGUILayout.TextField(_instance.changeRadius.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||||
EditorGUI.EndDisabledGroup();
|
EditorGUI.EndDisabledGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close this line up
|
// Close easing
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
|
||||||
|
GUILayout.Space(8);
|
||||||
|
|
||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
ValueGroupEditorUtilities.DrawEasingAndSmoothingSection(_instance);
|
ValueGroupEditorUtilities.DrawEasingAndSmoothingSection(_instance);
|
||||||
@@ -463,7 +455,7 @@ using UnityEngine;
|
|||||||
EditorGUILayout.TextField(_instance.changeSmoothing.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
EditorGUILayout.TextField(_instance.changeSmoothing.value == ValueChangeAction.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||||
EditorGUI.EndDisabledGroup();
|
EditorGUI.EndDisabledGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close easing
|
// Close easing
|
||||||
GUILayout.EndVertical();
|
GUILayout.EndVertical();
|
||||||
|
|
||||||
@@ -477,5 +469,14 @@ using UnityEngine;
|
|||||||
GUILayout.MinWidth(20.0f),
|
GUILayout.MinWidth(20.0f),
|
||||||
GUILayout.ExpandWidth(true),
|
GUILayout.ExpandWidth(true),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static GUIStyle titleText = new GUIStyle{
|
||||||
|
fontSize = 12,
|
||||||
|
fontStyle = FontStyle.Bold,
|
||||||
|
padding = new RectOffset(8, 0, 3,0),
|
||||||
|
normal ={
|
||||||
|
textColor = Color.white
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,39 +1,37 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public struct CameraSettingData : ICloneable{
|
[Serializable]
|
||||||
public SettingValue<float> mainFieldOfView;
|
public class CameraSettingData{
|
||||||
|
[Title("Field of View"), HideLabel, InlineProperty] public SettingValue<float> mainFieldOfView = new SettingValue<float>(0f);
|
||||||
|
|
||||||
public SettingValue<Vector3> orbitPositionDamping;
|
[Title("Orbit Position Damping"), HideLabel, InlineProperty] public SettingValue<Vector3> orbitPositionDamping = new SettingValue<Vector3>(Vector3.zero);
|
||||||
public SettingValue<Vector3> orbitTargetOffset;
|
[Title("Orbit Target Offset"), HideLabel, InlineProperty] public SettingValue<Vector3> orbitTargetOffset= new SettingValue<Vector3>(Vector3.zero);
|
||||||
|
|
||||||
public SettingValue<bool> axisLookEnabledX;
|
[Title("X Axis Look Enabled"), HideLabel, InlineProperty] public SettingValue<bool> axisLookEnabledX = new SettingValue<bool>(true);
|
||||||
public SettingValue<bool> axisLookEnabledY;
|
[Title("Y Axis Look Enabled"), HideLabel, InlineProperty] public SettingValue<bool> axisLookEnabledY = new SettingValue<bool>(true);
|
||||||
|
|
||||||
public SettingValue<float> axisLookGainX;
|
[Title("X Axis Look Gain"), HideLabel, InlineProperty] public SettingValue<float> axisLookGainX = new SettingValue<float>(0f);
|
||||||
public SettingValue<float> axisLookGainY;
|
[Title("Y Axis Look Gain"), HideLabel, InlineProperty] public SettingValue<float> axisLookGainY = new SettingValue<float>(0f);
|
||||||
|
|
||||||
public SettingValue<float> orbitFollowTopHeight;
|
[Title("Orbit Follow Top Height"), HideLabel, InlineProperty] public SettingValue<float> orbitFollowTopHeight = new SettingValue<float>(0f);
|
||||||
public SettingValue<float> orbitFollowTopRadius;
|
[Title("Orbit Follow Top Radius"), HideLabel, InlineProperty] public SettingValue<float> orbitFollowTopRadius = new SettingValue<float>(0f);
|
||||||
public SettingValue<float> orbitFollowCenterHeight;
|
[Title("Orbit Follow Center Height"), HideLabel, InlineProperty] public SettingValue<float> orbitFollowCenterHeight = new SettingValue<float>(0f);
|
||||||
public SettingValue<float> orbitFollowCenterRadius;
|
[Title("Orbit Follow Center Radius"), HideLabel, InlineProperty] public SettingValue<float> orbitFollowCenterRadius = new SettingValue<float>(0f);
|
||||||
public SettingValue<float> orbitFollowBottomHeight;
|
[Title("Orbit Follow Bottom Height"), HideLabel, InlineProperty] public SettingValue<float> orbitFollowBottomHeight = new SettingValue<float>(0f);
|
||||||
public SettingValue<float> orbitFollowBottomRadius;
|
[Title("Orbit Follow Bottom Radius"), HideLabel, InlineProperty] public SettingValue<float> orbitFollowBottomRadius = new SettingValue<float>(0f);
|
||||||
|
|
||||||
public SettingValue<Vector2> rotationComposerScreenPos;
|
public SettingValue<Vector2> rotationComposerScreenPos= new SettingValue<Vector2>(Vector2.zero);
|
||||||
|
|
||||||
public SettingValue<Vector3> cameraOffsetOffset;
|
public SettingValue<Vector3> cameraOffsetOffset= new SettingValue<Vector3>(Vector3.zero);
|
||||||
|
|
||||||
public object Clone(){
|
|
||||||
return MemberwiseClone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<IResettableSettingValue> GetAllSettings(){
|
public List<IResettableSettingValue> GetAllSettings(){
|
||||||
var outputList = new List<IResettableSettingValue>();
|
var outputList = new List<IResettableSettingValue>();
|
||||||
|
|
||||||
IResettableSettingValue[] settings = new[]{
|
IResettableSettingValue[] settings = {
|
||||||
mainFieldOfView as IResettableSettingValue,
|
mainFieldOfView,
|
||||||
orbitPositionDamping,
|
orbitPositionDamping,
|
||||||
orbitTargetOffset,
|
orbitTargetOffset,
|
||||||
axisLookEnabledX,
|
axisLookEnabledX,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using Reset.Core;
|
using Reset.Core;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using Unity.Cinemachine;
|
using Unity.Cinemachine;
|
||||||
@@ -6,14 +7,8 @@ using UnityEngine;
|
|||||||
public class CameraSettingsProcessor : MonoBehaviour{
|
public class CameraSettingsProcessor : MonoBehaviour{
|
||||||
public static CameraSettingsProcessor Instance{ get; private set; }
|
public static CameraSettingsProcessor Instance{ get; private set; }
|
||||||
|
|
||||||
[HideInInspector] public static CameraSettingData data;
|
[ShowInInspector, FoldoutGroup("Camera Data", expanded: true), InlineProperty, HideLabel]
|
||||||
[HideInInspector] public static CameraSettingData original;
|
public CameraSettingData data;
|
||||||
[ShowInInspector] public static CameraSettingData smoothing;
|
|
||||||
[ShowInInspector] public static CameraSettingData easing;
|
|
||||||
|
|
||||||
|
|
||||||
[HideInInspector] public static CameraSettingData currentSmoothing;
|
|
||||||
[HideInInspector] public static CameraSettingData currentValue;
|
|
||||||
|
|
||||||
public static GameObject mainCamera;
|
public static GameObject mainCamera;
|
||||||
|
|
||||||
@@ -38,59 +33,32 @@ public class CameraSettingsProcessor : MonoBehaviour{
|
|||||||
rotComp = mainCamera.GetComponent<CinemachineRotationComposer>();
|
rotComp = mainCamera.GetComponent<CinemachineRotationComposer>();
|
||||||
offset = mainCamera.GetComponent<CinemachineCameraOffset>();
|
offset = mainCamera.GetComponent<CinemachineCameraOffset>();
|
||||||
axisCont = mainCamera.GetComponent<CinemachineInputAxisController>();
|
axisCont = mainCamera.GetComponent<CinemachineInputAxisController>();
|
||||||
|
|
||||||
|
// Quick check for a camera settings
|
||||||
|
if (data == null) {
|
||||||
|
Debug.LogWarning("No Camera Settings Data was found on processing. One will be created. Is this intentional? This will have strong effects on camera movement");
|
||||||
|
data = new CameraSettingData();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize camera settings values from current values
|
// Initialize camera settings values from current values
|
||||||
data.mainFieldOfView.targetValue = main.Lens.FieldOfView;
|
InitializeAllSettings();
|
||||||
|
|
||||||
data.orbitPositionDamping.targetValue = orbit.TrackerSettings.PositionDamping;
|
|
||||||
data.orbitTargetOffset.targetValue = orbit.TargetOffset;
|
|
||||||
|
|
||||||
data.axisLookEnabledX.targetValue = axisCont.Controllers[0].Enabled;
|
|
||||||
data.axisLookEnabledY.targetValue = axisCont.Controllers[1].Enabled;
|
|
||||||
|
|
||||||
data.axisLookGainX.targetValue = axisCont.Controllers[0].Input.Gain;
|
|
||||||
data.axisLookGainY.targetValue = axisCont.Controllers[1].Input.Gain;
|
|
||||||
|
|
||||||
data.orbitFollowTopHeight.targetValue = orbit.Orbits.Top.Height;
|
|
||||||
data.orbitFollowTopRadius.targetValue = orbit.Orbits.Top.Radius;
|
|
||||||
data.orbitFollowCenterHeight.targetValue = orbit.Orbits.Center.Height;
|
|
||||||
data.orbitFollowCenterRadius.targetValue = orbit.Orbits.Center.Radius;
|
|
||||||
data.orbitFollowBottomHeight.targetValue = orbit.Orbits.Bottom.Height;
|
|
||||||
data.orbitFollowBottomRadius.targetValue = orbit.Orbits.Bottom.Radius;
|
|
||||||
|
|
||||||
data.rotationComposerScreenPos.targetValue = rotComp.Composition.ScreenPosition;
|
|
||||||
data.cameraOffsetOffset.targetValue = offset.Offset;
|
|
||||||
|
|
||||||
// And copy to the original
|
|
||||||
original = (CameraSettingData)data.Clone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update(){
|
void Update(){
|
||||||
// EaseToNewSmoothingValues();
|
SmoothCameraSettings();
|
||||||
// ProcessCameraValues();
|
ApplyCameraSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EaseToNewSmoothingValues(){
|
void SmoothCameraSettings(){
|
||||||
data.mainFieldOfView.SmoothAndEase();
|
var settings = data.GetAllSettings();
|
||||||
|
|
||||||
data.orbitPositionDamping.SmoothAndEase();
|
|
||||||
data.orbitTargetOffset.SmoothAndEase();
|
|
||||||
|
|
||||||
data.axisLookGainX.SmoothAndEase();
|
|
||||||
data.axisLookGainY.SmoothAndEase();
|
|
||||||
|
|
||||||
data.orbitFollowTopHeight.SmoothAndEase();
|
|
||||||
data.orbitFollowTopRadius.SmoothAndEase();
|
|
||||||
data.orbitFollowCenterHeight.SmoothAndEase();
|
|
||||||
data.orbitFollowCenterRadius.SmoothAndEase();
|
|
||||||
data.orbitFollowBottomHeight.SmoothAndEase();
|
|
||||||
data.orbitFollowBottomRadius.SmoothAndEase();
|
|
||||||
|
|
||||||
data.rotationComposerScreenPos.SmoothAndEase();
|
for (int i = 0; i < settings.Count; i++) {
|
||||||
data.cameraOffsetOffset.SmoothAndEase();
|
settings[i].SmoothAndEase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessCameraValues(){
|
// Responsible for actively applying the settings to the Cinemachine components
|
||||||
|
void ApplyCameraSettings(){
|
||||||
main.Lens.FieldOfView = data.mainFieldOfView.Value;
|
main.Lens.FieldOfView = data.mainFieldOfView.Value;
|
||||||
|
|
||||||
axisCont.Controllers[0].Enabled = data.axisLookEnabledX.Value;
|
axisCont.Controllers[0].Enabled = data.axisLookEnabledX.Value;
|
||||||
@@ -113,9 +81,30 @@ public class CameraSettingsProcessor : MonoBehaviour{
|
|||||||
|
|
||||||
offset.Offset = data.cameraOffsetOffset.Value;
|
offset.Offset = data.cameraOffsetOffset.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Button]
|
[Button]
|
||||||
void InitializeAllSettings(){
|
void InitializeAllSettings(){
|
||||||
|
data.mainFieldOfView.targetValue = main.Lens.FieldOfView;
|
||||||
|
|
||||||
|
data.orbitPositionDamping.targetValue = orbit.TrackerSettings.PositionDamping;
|
||||||
|
data.orbitTargetOffset.targetValue = orbit.TargetOffset;
|
||||||
|
|
||||||
|
data.axisLookEnabledX.targetValue = axisCont.Controllers[0].Enabled;
|
||||||
|
data.axisLookEnabledY.targetValue = axisCont.Controllers[1].Enabled;
|
||||||
|
|
||||||
|
data.axisLookGainX.targetValue = axisCont.Controllers[0].Input.Gain;
|
||||||
|
data.axisLookGainY.targetValue = axisCont.Controllers[1].Input.Gain;
|
||||||
|
|
||||||
|
data.orbitFollowTopHeight.targetValue = orbit.Orbits.Top.Height;
|
||||||
|
data.orbitFollowTopRadius.targetValue = orbit.Orbits.Top.Radius;
|
||||||
|
data.orbitFollowCenterHeight.targetValue = orbit.Orbits.Center.Height;
|
||||||
|
data.orbitFollowCenterRadius.targetValue = orbit.Orbits.Center.Radius;
|
||||||
|
data.orbitFollowBottomHeight.targetValue = orbit.Orbits.Bottom.Height;
|
||||||
|
data.orbitFollowBottomRadius.targetValue = orbit.Orbits.Bottom.Radius;
|
||||||
|
|
||||||
|
data.rotationComposerScreenPos.targetValue = rotComp.Composition.ScreenPosition;
|
||||||
|
data.cameraOffsetOffset.targetValue = offset.Offset;
|
||||||
|
|
||||||
var allSettings = data.GetAllSettings();
|
var allSettings = data.GetAllSettings();
|
||||||
for (int i = 0; i < allSettings.Count; i++) {
|
for (int i = 0; i < allSettings.Count; i++) {
|
||||||
allSettings[i].Initialize();
|
allSettings[i].Initialize();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Reset.Units{
|
namespace Reset.Units{
|
||||||
public enum PlayerFacingDirection{
|
public enum PlayerFacingDirection{
|
||||||
TowardsTarget = 0,
|
TowardsTarget = 0,
|
||||||
MatchForward,
|
MatchInput,
|
||||||
MatchCamera,
|
MatchCamera,
|
||||||
Static,
|
Static,
|
||||||
Momentum,
|
Momentum,
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ namespace Reset.Units{
|
|||||||
public struct MoveDirection{
|
public struct MoveDirection{
|
||||||
private Transform owner;
|
private Transform owner;
|
||||||
|
|
||||||
|
// Both are in world space, and translated to local
|
||||||
private Vector2 _moveRaw;
|
private Vector2 _moveRaw;
|
||||||
private Vector2 _moveDir; // Always world??
|
private Vector2 _moveDir;
|
||||||
|
|
||||||
[ShowInInspector]
|
[ShowInInspector]
|
||||||
public Vector2 World{
|
public Vector2 World{
|
||||||
get{
|
get{
|
||||||
DebugOverlayDrawer.ChangeValue("Movement", "_moveDir", _moveDir);
|
DebugOverlayDrawer.ChangeValue("Movement", "_moveDir", _moveDir);
|
||||||
// return owner.TransformDirection(_moveDir.ToVector3()).ToVector2();
|
|
||||||
return _moveDir;
|
return _moveDir;
|
||||||
}
|
}
|
||||||
set{
|
set{
|
||||||
@@ -23,14 +23,9 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
|
|
||||||
[ShowInInspector]
|
[ShowInInspector]
|
||||||
public Vector2 Local{
|
public Vector2 Local => owner.InverseTransformDirection(_moveDir.ToVector3()).ToVector2();
|
||||||
get => owner.InverseTransformDirection(_moveDir.ToVector3()).ToVector2();
|
|
||||||
|
|
||||||
private set {
|
|
||||||
// _moveDir = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
[ShowInInspector, PropertySpace(5)]
|
||||||
public Vector2 RawWorld{
|
public Vector2 RawWorld{
|
||||||
get{
|
get{
|
||||||
DebugOverlayDrawer.ChangeValue("Movement", "_moveRaw", _moveRaw);
|
DebugOverlayDrawer.ChangeValue("Movement", "_moveRaw", _moveRaw);
|
||||||
@@ -42,11 +37,9 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 RawLocal{
|
[ShowInInspector]
|
||||||
get => owner.InverseTransformDirection(_moveRaw.ToVector3()).ToVector2();
|
public Vector2 RawLocal => owner.InverseTransformDirection(_moveRaw.ToVector3()).ToVector2();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public MoveDirection(Transform ownerTransform){
|
public MoveDirection(Transform ownerTransform){
|
||||||
owner = ownerTransform;
|
owner = ownerTransform;
|
||||||
_moveDir = Vector2.zero;
|
_moveDir = Vector2.zero;
|
||||||
@@ -54,7 +47,7 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[ShowInInspector] public MoveDirection moveDirection;
|
[ShowInInspector, InlineProperty, BoxGroup("Direction"), HideLabel] public MoveDirection moveDirection;
|
||||||
public float moveSpeed;
|
public float moveSpeed;
|
||||||
public Quaternion rotation;
|
public Quaternion rotation;
|
||||||
public float rotationSpeed;
|
public float rotationSpeed;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class SettingValue<T> : IResettableSettingValue{
|
|||||||
set => targetValue = value;
|
set => targetValue = value;
|
||||||
}
|
}
|
||||||
[HorizontalGroup("Settings"), VerticalGroup("Settings/Smoothing"), BoxGroup("Settings/Smoothing/Smoothing"), LabelText("Current"), ShowIf("@IsSmoothable()")]
|
[HorizontalGroup("Settings"), VerticalGroup("Settings/Smoothing"), BoxGroup("Settings/Smoothing/Smoothing"), LabelText("Current"), ShowIf("@IsSmoothable()")]
|
||||||
private float currentSmoothing;
|
public float currentSmoothing;
|
||||||
[HorizontalGroup("Settings"), VerticalGroup("Settings/Value"), BoxGroup("Settings/Value/Value"), LabelText("Default")]
|
[HorizontalGroup("Settings"), VerticalGroup("Settings/Value"), BoxGroup("Settings/Value/Value"), LabelText("Default")]
|
||||||
public T defaultValue;
|
public T defaultValue;
|
||||||
[HorizontalGroup("Settings"), VerticalGroup("Settings/Smoothing"), BoxGroup("Settings/Smoothing/Smoothing"), LabelText("Default"), ShowIf("@IsSmoothable()")]
|
[HorizontalGroup("Settings"), VerticalGroup("Settings/Smoothing"), BoxGroup("Settings/Smoothing/Smoothing"), LabelText("Default"), ShowIf("@IsSmoothable()")]
|
||||||
@@ -75,31 +75,33 @@ public class SettingValue<T> : IResettableSettingValue{
|
|||||||
Debug.LogWarning($"A SettingValue ({this}) wasn't verified before being smoothed and eased. What's up with that?");
|
Debug.LogWarning($"A SettingValue ({this}) wasn't verified before being smoothed and eased. What's up with that?");
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSmoothing = Mathf.MoveTowards(currentSmoothing, targetSmoothing, targetEasing * 1f * Time.deltaTime);
|
currentSmoothing = Mathf.MoveTowards(currentSmoothing, targetSmoothing, targetEasing * targetEasing * Time.deltaTime);
|
||||||
|
|
||||||
if (typeof(T) == typeof(float)) {
|
if (typeof(T) == typeof(float)) {
|
||||||
currentValue = (T)(object)Mathf.SmoothDamp((float)(object)currentValue, (float)(object)targetValue, ref refVelFloat, currentSmoothing * Time.deltaTime);
|
currentValue = (T)(object)Mathf.SmoothDamp((float)(object)currentValue, (float)(object)targetValue, ref refVelFloat, currentSmoothing * currentSmoothing * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof(T) == typeof(Vector2)) {
|
if (typeof(T) == typeof(Vector2)) {
|
||||||
currentValue = (T)(object)Vector2.SmoothDamp((Vector2)(object)currentValue, (Vector2)(object)targetValue, ref refVelV2, currentSmoothing * Time.deltaTime);
|
currentValue = (T)(object)Vector2.SmoothDamp((Vector2)(object)currentValue, (Vector2)(object)targetValue, ref refVelV2, currentSmoothing * currentSmoothing * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof(T) == typeof(Vector3)) {
|
if (typeof(T) == typeof(Vector3)) {
|
||||||
currentValue = (T)(object)Vector3.SmoothDamp((Vector3)(object)currentValue, (Vector3)(object)targetValue, ref refVelV3, currentSmoothing * Time.deltaTime);
|
currentValue = (T)(object)Vector3.SmoothDamp((Vector3)(object)currentValue, (Vector3)(object)targetValue, ref refVelV3, currentSmoothing * currentSmoothing * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof(T) == typeof(Vector4) || typeof(T) == typeof(Quaternion)) {
|
if (typeof(T) == typeof(Vector4) || typeof(T) == typeof(Quaternion)) {
|
||||||
// I have... zero clue if this will work. There is no Vector4 or Quaternion SmoothDamp
|
// I have... zero clue if this will work. There is no Vector4 or Quaternion SmoothDamp
|
||||||
Vector3 v3value = Vector3.SmoothDamp((Vector4)(object)currentValue, (Vector4)(object)targetValue, ref refVelV3, currentSmoothing * Time.deltaTime);
|
Vector3 v3value = Vector3.SmoothDamp((Vector4)(object)currentValue, (Vector4)(object)targetValue, ref refVelV3, currentSmoothing * currentSmoothing * Time.deltaTime);
|
||||||
float v4value = Mathf.SmoothDamp(((Vector4)(object)currentValue).z, ((Vector4)(object)targetValue).z, ref refVelFloat, currentSmoothing * Time.deltaTime);
|
float v4value = Mathf.SmoothDamp(((Vector4)(object)currentValue).z, ((Vector4)(object)targetValue).z, ref refVelFloat, currentSmoothing * currentSmoothing * Time.deltaTime);
|
||||||
|
|
||||||
currentValue = (T)(object)new Vector4(v3value.x, v3value.y, v3value.z, v4value);
|
currentValue = (T)(object)new Vector4(v3value.x, v3value.y, v3value.z, v4value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(){
|
public void Initialize(){
|
||||||
currentValue = targetValue;
|
currentValue = targetValue;
|
||||||
Debug.Log(Value);
|
defaultValue = targetValue;
|
||||||
|
defaultSmoothing = targetSmoothing;
|
||||||
|
defaultEasing = targetEasing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,17 +6,18 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Reset.Units{
|
namespace Reset.Units{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class UnitMovementData : ICloneable{
|
public class UnitMovementData{
|
||||||
// Movement Direction
|
// Movement Direction
|
||||||
[Title("Move Smoothing"), HideLabel, InlineProperty] public SettingValue<Vector2> moveSmoothing = new SettingValue<Vector2>(new Vector2(.5f, .5f));
|
[Title("Direction Changing Softeness"), HideLabel, InlineProperty] public SettingValue<float> directionChangingSoftness = new SettingValue<float>(1f, defaultSmoothing: 1f);
|
||||||
[Title("Acceleration"), HideLabel, InlineProperty] public SettingValue<float> acceleration = new SettingValue<float>(5f);
|
[Title("Direction Spinning Hardness"), HideLabel, InlineProperty] public SettingValue<float> directionSpinningHardness = new SettingValue<float>(3f, defaultSmoothing: 1f);
|
||||||
[Title("Deacceleration"), HideLabel, InlineProperty] public SettingValue<float> deacceleration = new SettingValue<float>(5f);
|
[Title("Directoon Spinning Speed"), HideLabel, InlineProperty] public SettingValue<float> directionSpinningSpeed= new SettingValue<float>(3f, defaultSmoothing: 1f);
|
||||||
|
|
||||||
[SliderField(0,1)]
|
[SliderField(0,1)]
|
||||||
[Title("Air Direction Decay"), HideLabel, InlineProperty] public SettingValue<float> airDirectionDecay = new SettingValue<float>(1f); // TODO: Check default value
|
[Title("Air Direction Decay"), HideLabel, InlineProperty] public SettingValue<float> airDirectionDecay = new SettingValue<float>(1f); // TODO: Check default value
|
||||||
|
|
||||||
// Move Speed
|
// Move Speed
|
||||||
[Title("Softening"), HideLabel, InlineProperty] public SettingValue<float> softening = new SettingValue<float>(1f, defaultSmoothing: 1f);
|
[Title("Acceleration"), HideLabel, InlineProperty] public SettingValue<float> acceleration = new SettingValue<float>(5f);
|
||||||
|
[Title("Deacceleration"), HideLabel, InlineProperty] public SettingValue<float> deacceleration = new SettingValue<float>(5f);
|
||||||
[Title("Move Speed"), HideLabel, InlineProperty] public SettingValue<float> moveSpeed = new SettingValue<float>(15f, defaultSmoothing: 10f);
|
[Title("Move Speed"), HideLabel, InlineProperty] public SettingValue<float> moveSpeed = new SettingValue<float>(15f, defaultSmoothing: 10f);
|
||||||
|
|
||||||
// Jumping
|
// Jumping
|
||||||
@@ -30,33 +31,27 @@ namespace Reset.Units{
|
|||||||
[Title("Gravity Scale"), HideLabel, InlineProperty] public SettingValue<float> gravityScale = new SettingValue<float>(1f);
|
[Title("Gravity Scale"), HideLabel, InlineProperty] public SettingValue<float> gravityScale = new SettingValue<float>(1f);
|
||||||
|
|
||||||
// Rotation
|
// Rotation
|
||||||
[Title("Rotate Facing"), HideLabel, InlineProperty] public SettingValue<PlayerFacingDirection> rotateFacing = new SettingValue<PlayerFacingDirection>(initValue: PlayerFacingDirection.Momentum);
|
[Title("Rotate Facing"), HideLabel, InlineProperty] public SettingValue<PlayerFacingDirection> facingDirection = new SettingValue<PlayerFacingDirection>(initValue: PlayerFacingDirection.Momentum);
|
||||||
[Title("Rotation Speed"), HideLabel, InlineProperty] public SettingValue<float> rotationSpeed = new SettingValue<float>(5f);
|
[Title("Rotation Speed"), HideLabel, InlineProperty] public SettingValue<float> rotationSpeed = new SettingValue<float>(5f);
|
||||||
[Title("Rotation Input Blending"), HideLabel, InlineProperty] public SettingValue<float> rotationInputBlending = new SettingValue<float>(.3f);
|
|
||||||
|
|
||||||
public object Clone(){
|
|
||||||
return MemberwiseClone();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<IResettableSettingValue> GetAllSettings(){
|
public List<IResettableSettingValue> GetAllSettings(){
|
||||||
var outputList = new List<IResettableSettingValue>();
|
var outputList = new List<IResettableSettingValue>();
|
||||||
|
|
||||||
IResettableSettingValue[] settings = new[]{
|
IResettableSettingValue[] settings = {
|
||||||
moveSmoothing as IResettableSettingValue,
|
directionChangingSoftness,
|
||||||
|
directionSpinningHardness,
|
||||||
|
directionSpinningSpeed,
|
||||||
acceleration,
|
acceleration,
|
||||||
deacceleration,
|
deacceleration,
|
||||||
airDirectionDecay,
|
airDirectionDecay,
|
||||||
softening,
|
|
||||||
moveSpeed,
|
moveSpeed,
|
||||||
// jumpPower,
|
|
||||||
// jumpPowerDecay,
|
|
||||||
gravityPower,
|
gravityPower,
|
||||||
gravityMax,
|
gravityMax,
|
||||||
gravityAcceleration,
|
gravityAcceleration,
|
||||||
gravityScale,
|
gravityScale,
|
||||||
rotateFacing,
|
facingDirection,
|
||||||
rotationSpeed,
|
rotationSpeed,
|
||||||
rotationInputBlending,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputList.AddRange(settings);
|
outputList.AddRange(settings);
|
||||||
|
|||||||
@@ -8,13 +8,8 @@ namespace Reset.Units{
|
|||||||
[ShowInInspector, InlineProperty, HideLabel, FoldoutGroup("Resolved Movement", expanded: true)]
|
[ShowInInspector, InlineProperty, HideLabel, FoldoutGroup("Resolved Movement", expanded: true)]
|
||||||
public ResolvedMovement resolvedMovement;
|
public ResolvedMovement resolvedMovement;
|
||||||
|
|
||||||
[HideInInspector] public Vector3 outputMoveDirection;
|
|
||||||
[HideInInspector] public Vector3 additionalMoveDirection;
|
|
||||||
|
|
||||||
// SmoothDamp Velocities
|
// SmoothDamp Velocities
|
||||||
private Quaternion refVelocityRotationSpeed;
|
private Vector2 refVelocityDirectionChangingHardness;
|
||||||
private float refVelocityAcceleration;
|
|
||||||
private float refVelocityDeacceleration;
|
|
||||||
|
|
||||||
// Smoothing Values
|
// Smoothing Values
|
||||||
private float directionChangeDotLerp;
|
private float directionChangeDotLerp;
|
||||||
@@ -29,6 +24,9 @@ namespace Reset.Units{
|
|||||||
// Movement Data
|
// Movement Data
|
||||||
[ShowInInspector, PropertyOrder(2), FoldoutGroup("Movement Data", expanded: true), InlineProperty, HideLabel] public UnitMovementData data = new();
|
[ShowInInspector, PropertyOrder(2), FoldoutGroup("Movement Data", expanded: true), InlineProperty, HideLabel] public UnitMovementData data = new();
|
||||||
|
|
||||||
|
// Other
|
||||||
|
private Quaternion specifiedRotation; // Used for locking a specific direction
|
||||||
|
|
||||||
void Awake(){
|
void Awake(){
|
||||||
controller = GetComponent<CharacterController>();
|
controller = GetComponent<CharacterController>();
|
||||||
controls = GetComponent<PlayerControls>();
|
controls = GetComponent<PlayerControls>();
|
||||||
@@ -45,13 +43,14 @@ namespace Reset.Units{
|
|||||||
|
|
||||||
void Update(){
|
void Update(){
|
||||||
SmoothAllSettings();
|
SmoothAllSettings();
|
||||||
|
|
||||||
UpdateCurrentDirection();
|
UpdateCurrentDirection();
|
||||||
UpdateCurrentGravity();
|
UpdateCurrentGravity();
|
||||||
UpdateCurrentSpeed();
|
UpdateCurrentSpeed();
|
||||||
UpdateCurrentRotation();
|
UpdateCurrentRotation();
|
||||||
|
|
||||||
DoMovement();
|
// Apply movement
|
||||||
|
DoMovement(resolvedMovement.moveDirection.World, resolvedMovement.gravity, resolvedMovement.moveSpeed, data.gravityScale.Value);
|
||||||
|
|
||||||
DebugOverlayDrawer.ChangeValue("Movement", "Move Direction (Local)", resolvedMovement.moveDirection.Local);
|
DebugOverlayDrawer.ChangeValue("Movement", "Move Direction (Local)", resolvedMovement.moveDirection.Local);
|
||||||
DebugOverlayDrawer.ChangeValue("Movement", "Move Direction (World)", resolvedMovement.moveDirection.World);
|
DebugOverlayDrawer.ChangeValue("Movement", "Move Direction (World)", resolvedMovement.moveDirection.World);
|
||||||
@@ -62,6 +61,7 @@ namespace Reset.Units{
|
|||||||
// Get input value
|
// Get input value
|
||||||
Vector2 targetDirection = new Vector2(controls.rawMoveInput.x, controls.rawMoveInput.y);
|
Vector2 targetDirection = new Vector2(controls.rawMoveInput.x, controls.rawMoveInput.y);
|
||||||
|
|
||||||
|
// Rotate input by camera rotation (instead of rotating the output direction by camera rotation)
|
||||||
targetDirection = (Camera.main.transform.rotation * targetDirection.ToVector3()).ToVector2();
|
targetDirection = (Camera.main.transform.rotation * targetDirection.ToVector3()).ToVector2();
|
||||||
|
|
||||||
// Deadzone
|
// Deadzone
|
||||||
@@ -69,7 +69,7 @@ namespace Reset.Units{
|
|||||||
targetDirection = Vector2.zero;
|
targetDirection = Vector2.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Raw Direciton
|
// Set Raw Direction (this is used by the camera later)
|
||||||
resolvedMovement.moveDirection.RawWorld = targetDirection;
|
resolvedMovement.moveDirection.RawWorld = targetDirection;
|
||||||
|
|
||||||
// Get current direction
|
// Get current direction
|
||||||
@@ -79,7 +79,7 @@ namespace Reset.Units{
|
|||||||
float switchedDirection = Vector3.Dot(targetDirection, currentDirection);
|
float switchedDirection = Vector3.Dot(targetDirection, currentDirection);
|
||||||
float switchedDirectionRemapped = Mathf.Lerp(0, 1, switchedDirection);
|
float switchedDirectionRemapped = Mathf.Lerp(0, 1, switchedDirection);
|
||||||
|
|
||||||
directionChangeDotLerp = Mathf.Lerp(switchedDirection, switchedDirectionRemapped, 5f * Time.deltaTime) ; // turn that .5f into a variable
|
directionChangeDotLerp = Mathf.Lerp(switchedDirection, switchedDirectionRemapped, data.directionSpinningHardness.Value * Time.deltaTime);
|
||||||
DebugOverlayDrawer.ChangeValue("Movement", "Direction Change Dot", directionChangeDotLerp);
|
DebugOverlayDrawer.ChangeValue("Movement", "Direction Change Dot", directionChangeDotLerp);
|
||||||
|
|
||||||
// Smooth movement. Use deaccel smoothing if the input magnitude is lower, and accel smoothing if it's higher
|
// Smooth movement. Use deaccel smoothing if the input magnitude is lower, and accel smoothing if it's higher
|
||||||
@@ -89,12 +89,12 @@ namespace Reset.Units{
|
|||||||
Vector2 newDirection;
|
Vector2 newDirection;
|
||||||
|
|
||||||
if (controller.isGrounded){
|
if (controller.isGrounded){
|
||||||
slerpedValue = Vector3.Slerp(currentDirection, targetDirection, data.softening.Value * Time.deltaTime);
|
slerpedValue = Vector3.Slerp(currentDirection, targetDirection, data.directionSpinningSpeed.Value * Time.deltaTime);
|
||||||
lerpedValue = Vector2.Lerp(currentDirection, targetDirection, data.softening.Value * Time.deltaTime);
|
lerpedValue = Vector2.SmoothDamp(currentDirection, targetDirection, ref refVelocityDirectionChangingHardness, data.directionChangingSoftness.Value * Time.deltaTime);
|
||||||
|
|
||||||
newDirection = Vector2.Lerp(slerpedValue, lerpedValue, directionChangeDotLerp);
|
newDirection = Vector2.Lerp(slerpedValue, lerpedValue, directionChangeDotLerp);
|
||||||
} else {
|
} else {
|
||||||
newDirection = Vector2.Lerp(currentDirection, targetDirection, data.softening.Value * data.airDirectionDecay.Value * Time.deltaTime);
|
newDirection = Vector2.SmoothDamp(currentDirection, targetDirection, ref refVelocityDirectionChangingHardness, data.directionChangingSoftness.Value * data.airDirectionDecay.Value * Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit the new direction
|
// Commit the new direction
|
||||||
@@ -119,6 +119,7 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the gravity, called every frame
|
// Update the gravity, called every frame
|
||||||
|
// NOTE: most gravity interactions, like when grounded or not, is now handled by the state machine
|
||||||
private void UpdateCurrentGravity(){
|
private void UpdateCurrentGravity(){
|
||||||
// Accelerate gravity
|
// Accelerate gravity
|
||||||
if (!controller.isGrounded){
|
if (!controller.isGrounded){
|
||||||
@@ -136,10 +137,16 @@ namespace Reset.Units{
|
|||||||
|
|
||||||
Quaternion targetRotation = Quaternion.identity;
|
Quaternion targetRotation = Quaternion.identity;
|
||||||
// Switch the desired rotation based on current movement setting
|
// Switch the desired rotation based on current movement setting
|
||||||
switch (data.rotateFacing.Value) { // TODO: Check that this isn't broken
|
switch (data.facingDirection.Value) {
|
||||||
// Just look at target
|
// Just look at target
|
||||||
case PlayerFacingDirection.TowardsTarget:
|
case PlayerFacingDirection.TowardsTarget:
|
||||||
// Look directly at the target
|
// Look directly at the target
|
||||||
|
if (lockOnManager.mainTarget == null) {
|
||||||
|
Debug.LogError("Trying to rotate towards a target but there is no target. Not setting a rotation");
|
||||||
|
targetRotation = transform.rotation;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
targetRotation = Quaternion.LookRotation(transform.position.DirectionTo(lockOnManager.mainTarget.gameObject.transform.position));
|
targetRotation = Quaternion.LookRotation(transform.position.DirectionTo(lockOnManager.mainTarget.gameObject.transform.position));
|
||||||
break;
|
break;
|
||||||
case PlayerFacingDirection.Momentum:
|
case PlayerFacingDirection.Momentum:
|
||||||
@@ -148,8 +155,8 @@ namespace Reset.Units{
|
|||||||
targetRotation = Quaternion.LookRotation(resolvedMovement.moveDirection.RawWorld.ToVector3(), Vector3.up);
|
targetRotation = Quaternion.LookRotation(resolvedMovement.moveDirection.RawWorld.ToVector3(), Vector3.up);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PlayerFacingDirection.MatchForward:
|
case PlayerFacingDirection.MatchInput:
|
||||||
// Look towards the input direction....why??? I guess cause move direction is PlayerFacingDirection.Momentum.
|
// Look towards the input direction- similar to Momentum but snappier
|
||||||
if (controls.rawMoveInput.magnitude < 0.05f) { break; }
|
if (controls.rawMoveInput.magnitude < 0.05f) { break; }
|
||||||
|
|
||||||
targetRotation = Camera.main.transform.rotation * Quaternion.LookRotation(inputMovement);
|
targetRotation = Camera.main.transform.rotation * Quaternion.LookRotation(inputMovement);
|
||||||
@@ -160,7 +167,7 @@ namespace Reset.Units{
|
|||||||
break;
|
break;
|
||||||
case PlayerFacingDirection.Static:
|
case PlayerFacingDirection.Static:
|
||||||
// Don't change
|
// Don't change
|
||||||
targetRotation = transform.rotation;
|
targetRotation = resolvedMovement.rotation;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,27 +175,21 @@ namespace Reset.Units{
|
|||||||
|
|
||||||
// Add the current input into the created rotation
|
// Add the current input into the created rotation
|
||||||
if (inputMovement.magnitude > .05) {
|
if (inputMovement.magnitude > .05) {
|
||||||
// Quaternion inputRot = Camera.main.transform.rotation * Quaternion.LookRotation(inputMovement);
|
resolvedMovement.rotation = targetRotation;
|
||||||
// resolvedMovement.rotation = Quaternion.RotateTowards(resolvedMovement.rotation, targetRotation, 10f);
|
} else if (data.facingDirection.Value == PlayerFacingDirection.MatchCamera) {
|
||||||
resolvedMovement.rotation = targetRotation;
|
resolvedMovement.rotation = targetRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set final rotation
|
// Apply rotation to the character
|
||||||
transform.rotation = Quaternion.Slerp(transform.rotation, resolvedMovement.rotation, data.rotationSpeed.Value * Time.deltaTime).Flatten(0, null, 0);
|
transform.rotation = Quaternion.Slerp(transform.rotation, resolvedMovement.rotation, data.rotationSpeed.Value * Time.deltaTime).Flatten(0, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move with default settings
|
|
||||||
public void DoMovement(){
|
|
||||||
DoMovement(resolvedMovement.moveDirection.World, resolvedMovement.moveSpeed, data.gravityScale.Value); // TODO: Gets multiplied a second time in DoMovement by gravity scale????
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom move from input
|
|
||||||
public void DoMovement(Vector2 moveDir, float speed, float gravityScale){
|
|
||||||
// Debug.Log($"moveDir: {moveDir}, agent velocity: {transform.InverseTransformDirection(controller.velocity.normalized)}");
|
|
||||||
|
|
||||||
|
// Custom move from input
|
||||||
|
private void DoMovement(Vector2 moveDir, float gravDir, float speed, float gravityScale){
|
||||||
// Seperate the different move directions. Additonal becomes it's own because it needs to be added independently of the other two
|
// Seperate the different move directions. Additonal becomes it's own because it needs to be added independently of the other two
|
||||||
Vector2 moveXZDir = moveDir;
|
Vector2 moveXZDir = moveDir;
|
||||||
float moveYDir = resolvedMovement.gravity;
|
float moveYDir = gravDir;
|
||||||
|
|
||||||
// Add their related speeds
|
// Add their related speeds
|
||||||
moveXZDir *= speed * Time.deltaTime;
|
moveXZDir *= speed * Time.deltaTime;
|
||||||
@@ -209,7 +210,7 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNewDirection(Vector2 value, float relativity, bool absolute){ // new
|
public void SetNewDirection(Vector2 value, float relativity, bool absolute, Vector2 relativeTo = default){ // new
|
||||||
if (absolute){
|
if (absolute){
|
||||||
resolvedMovement.moveDirection.World = Vector2.Lerp(resolvedMovement.moveDirection.World, value, relativity);
|
resolvedMovement.moveDirection.World = Vector2.Lerp(resolvedMovement.moveDirection.World, value, relativity);
|
||||||
} else {
|
} else {
|
||||||
@@ -217,7 +218,7 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNewRawDirection(Vector2 value, float relativity, bool absolute){ // new
|
public void SetNewRawDirection(Vector2 value, float relativity, bool absolute, Vector2 relativeTo = default){ // new
|
||||||
if (absolute){
|
if (absolute){
|
||||||
resolvedMovement.moveDirection.RawWorld = Vector2.Lerp(resolvedMovement.moveDirection.RawWorld, value, relativity);
|
resolvedMovement.moveDirection.RawWorld = Vector2.Lerp(resolvedMovement.moveDirection.RawWorld, value, relativity);
|
||||||
} else {
|
} else {
|
||||||
@@ -225,7 +226,7 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNewSpeed(float value, float relativity, bool absolute){ // new
|
public void SetNewSpeed(float value, float relativity, bool absolute, float relativeTo = Mathf.Infinity){ // new
|
||||||
if (absolute){
|
if (absolute){
|
||||||
resolvedMovement.moveSpeed = Mathf.Lerp(resolvedMovement.moveSpeed, value, relativity);
|
resolvedMovement.moveSpeed = Mathf.Lerp(resolvedMovement.moveSpeed, value, relativity);
|
||||||
} else {
|
} else {
|
||||||
@@ -233,7 +234,7 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNewRotation(Quaternion value, float relativity, bool absolute){ // new
|
public void SetNewRotation(Quaternion value, float relativity, bool absolute, Quaternion relativeTo = default){ // new
|
||||||
if (absolute){
|
if (absolute){
|
||||||
resolvedMovement.rotation = Quaternion.Lerp(resolvedMovement.rotation, value, relativity);
|
resolvedMovement.rotation = Quaternion.Lerp(resolvedMovement.rotation, value, relativity);
|
||||||
} else {
|
} else {
|
||||||
@@ -241,6 +242,10 @@ namespace Reset.Units{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSpecifiedRotation(Quaternion inputRotation){
|
||||||
|
specifiedRotation = inputRotation;
|
||||||
|
}
|
||||||
|
|
||||||
[Button("Initialize Settings", ButtonHeight = 30), PropertySpace(10,5 )]
|
[Button("Initialize Settings", ButtonHeight = 30), PropertySpace(10,5 )]
|
||||||
void InitAllSettings(){
|
void InitAllSettings(){
|
||||||
var settingsList = data.GetAllSettings();
|
var settingsList = data.GetAllSettings();
|
||||||
@@ -274,14 +279,11 @@ namespace Reset.Units{
|
|||||||
public void SetNewGravity(float value){
|
public void SetNewGravity(float value){
|
||||||
Debug.LogError("Using an old movement command! Switch to one of the new alternatives!");
|
Debug.LogError("Using an old movement command! Switch to one of the new alternatives!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSpecifiedRotation(Quaternion inputRotation){ // Old
|
|
||||||
Debug.LogError("Using an old movement command! Switch to one of the new alternatives!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OverwriteDirectionFromInput(Vector2 value, float priority, float speed = Mathf.Infinity){ // Old
|
public void OverwriteDirectionFromInput(Vector2 value, float priority, float speed = Mathf.Infinity){ // Old
|
||||||
Debug.LogError("Using an old movement command! Switch to one of the new alternatives!");
|
Debug.LogError("Using an old movement command! Switch to one of the new alternatives!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user