Compare commits
33 Commits
main
...
fa2b7ea3ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa2b7ea3ad | ||
|
|
aeba8ead77 | ||
|
|
5165f79ed2 | ||
|
|
64fe9eb811 | ||
|
|
c60a16729d | ||
|
|
7cdfa067c5 | ||
|
|
9eb394d295 | ||
|
|
d531b127e5 | ||
| 676c523cf3 | |||
|
|
88b0acdaaa | ||
|
|
f663c934ab | ||
|
|
ee71a34ecc | ||
|
|
a083af6f5e | ||
|
|
b3ff205e69 | ||
|
|
07b7f5d48b | ||
|
|
cee2e74f29 | ||
|
|
f2df9a6910 | ||
|
|
6ebfd4ef2b | ||
|
|
78498e5212 | ||
|
|
80276fbdbf | ||
|
|
598fa9f6fc | ||
|
|
ae1908013d | ||
|
|
39313c96d0 | ||
|
|
4a1dbb9728 | ||
|
|
7fbe05e39b | ||
|
|
92c6ac0016 | ||
|
|
706e53c5f7 | ||
|
|
1c27be3e2f | ||
|
|
7ee82db2cb | ||
|
|
e95748e0e2 | ||
|
|
355f6207a5 | ||
|
|
947be1a946 | ||
|
|
43de6b0d3b |
@@ -12,15 +12,28 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3}
|
||||
m_Name: GrappleAimBT
|
||||
m_EditorClassIdentifier:
|
||||
_serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"_position":{"x":730.5245,"y":284.5939},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"0"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":498.9515,"y":429.918},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"1"},{"_action":{"fieldOfView":{"label":"FOV","value":60.0,"changeValue":1},"orbitFollowTop":{"label":"Top","changeHeight":1,"height":2.0,"changeRadius":1,"radius":2.0},"orbitFollowCenter":{"label":"Center","changeHeight":1,"height":1.5,"changeRadius":1,"radius":2.4},"orbitFollowBottom":{"label":"Bottom","changeHeight":1,"height":0.7,"changeRadius":1,"radius":2.0},"cameraOffset":{"label":"Screen
|
||||
Position","newValue":{"x":2.0,"z":-1.0},"changeX":1,"changeZ":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":527.6321,"y":581.3029},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"2"},{"_action":{"waitTime":{"_value":0.3},"$type":"NodeCanvas.Tasks.Actions.Wait"},"_position":{"x":682.4366,"y":430.895},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"3"},{"_condition":{"actionName":{"_value":"Grapple"},"actionValue":{},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":826.7462,"y":427.8908},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"4"},{"_action":{"fieldOfView":{"label":"FOV","changeValue":2},"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"label":"Center","changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"label":"Bottom","changeHeight":2,"changeRadius":2},"screenPosition":{"label":"Screen
|
||||
Position","changeX":2,"changeY":2},"cameraOffset":{"label":"Screen Position","changeX":2,"changeY":2,"changeZ":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":880.8403,"y":568.1857},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}'
|
||||
_serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"_position":{"x":732.5245,"y":286.5939},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"0"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":89.95151,"y":510.918},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"1"},{"_action":{"fieldOfView":{"label":"FOV","value":60.0,"changeValue":1},"orbitPositionDamping":{"label":"Position
|
||||
Damping","newValue":{"x":0.2,"z":0.2},"changeX":1,"changeZ":1},"orbitFollowTop":{"label":"Top","changeHeight":1,"height":2.0,"changeRadius":1,"radius":2.0},"orbitFollowCenter":{"label":"Center","changeHeight":1,"height":1.5,"changeRadius":1,"radius":2.4},"orbitFollowBottom":{"label":"Bottom","changeHeight":1,"height":0.2,"changeRadius":1,"radius":0.8},"cameraOffset":{"label":"Screen
|
||||
Position","newValue":{"x":2.0,"y":0.5,"z":-1.0},"changeX":1,"changeY":1,"changeZ":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":-85.3679,"y":667.3029},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"2"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":336.0,"y":511.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"3"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":568.0,"y":515.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"4"},{"policy":1,"dynamic":true,"_position":{"x":749.7742,"y":517.9701},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"5"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":247.0,"y":763.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"6"},{"_condition":{"castType":{"_value":4},"length":{"_value":20.0},"direction":{"_value":{"z":1.0}},"offset":{},"ignoreLayers":{"_value":{"value":8}},"width":{"_value":3.0},"size":{},"rotation":{},"drawGizmos":true,"outputHit":{"_name":"_observerHit"},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":209.0,"y":871.0},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"7"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":127.0,"y":975.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"8"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":320.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"9"},{"_position":{"x":841.0,"y":848.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"10"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":540.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"11"},{"_condition":{"valueA":{"_name":"_castHit"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":569.0,"y":1079.0},"$type":"NodeCanvas.BehaviourTrees.ConditionalEvaluator","$id":"12"},{"_action":{"eventName":{"_value":"Started
|
||||
Tilt Controls"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":511.9847,"y":1182.83},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"13"},{"_position":{"x":852.0,"y":973.0},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"14"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":799.0,"y":1035.0},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"15"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":902.6089,"y":1145.236},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"16"},{"_position":{"x":912.0,"y":1202.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"17"},{"_action":{"orbitTargetOffset":{"label":"Target
|
||||
Offset","newValue":{"y":0.04},"changeX":2,"changeY":1},"axisLookXGain":{"label":"Look
|
||||
Orbit X Gain","changeValue":1},"axisLookYGain":{"label":"Look Orbit Y Gain","changeValue":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":550.5596,"y":1329.851},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"18"},{"_action":{"actions":[{"actionName":{"_value":"Look"},"outputTo":{"_name":"_lookDir"},"$type":"NodeCanvas.Tasks.Actions.CheckInputValue`1[[UnityEngine.Vector2,
|
||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},{"targetVector":{"_name":"_lookDir"},"x":{"_name":""},"y":{"_name":"_lookDirY"},"z":{"_name":""},"$type":"NodeCanvas.Tasks.Actions.DecomposeVector"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":753.6562,"y":1331.63},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"19"},{"_condition":{"valueA":{"_name":"_lookDirY"},"checkType":1,"valueB":{"_value":0.2},"differenceThreshold":0.1,"$type":"NodeCanvas.Tasks.Conditions.CheckFloat"},"_position":{"x":1076.257,"y":1335.687},"$type":"NodeCanvas.BehaviourTrees.BinarySelector","$id":"20"},{"_action":{"orbitTargetOffset":{"label":"Target
|
||||
Offset","newValue":{"y":0.04},"changeY":1},"enableXAxis":{"label":"Input Axis
|
||||
X Enabled","changeValue":1},"enableYAxis":{"label":"Input Axis Y Enabled","changeValue":1},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":958.9839,"y":1482.521},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"21"},{"_action":{"orbitTargetOffset":{"label":"Target
|
||||
Offset","changeY":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},"_position":{"x":1176.0,"y":1476.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"22"},{"_action":{"eventName":{"_value":"Confirmed
|
||||
Choice"},"delay":{},"$type":"NodeCanvas.Tasks.Actions.SendEvent"},"_position":{"x":1059.947,"y":979.5414},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"23"},{"policy":1,"_position":{"x":928.0059,"y":524.0208},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"24"},{"_condition":{"conditions":[{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},{"valueA":{"_name":"_castHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"}],"$type":"NodeCanvas.Framework.ConditionList"},"_position":{"x":965.381,"y":658.2095},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"25"},{"_action":{"log":{"_value":"Cancelled"},"secondsToRun":0.0,"$type":"NodeCanvas.Tasks.Actions.DebugLogText"},"_position":{"x":1046.394,"y":796.2429},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"26"},{"_action":{"actions":[{"fieldOfView":{"label":"FOV","changeValue":2},"orbitFollowTop":{"label":"Top","changeHeight":2,"changeRadius":2},"orbitFollowCenter":{"label":"Center","changeHeight":2,"changeRadius":2},"orbitFollowBottom":{"label":"Bottom","changeHeight":2,"changeRadius":2},"axisLookXGain":{"label":"Look
|
||||
Orbit X Gain","changeValue":2},"axisLookYGain":{"label":"Look Orbit Y Gain","changeValue":2},"screenPosition":{"label":"Screen
|
||||
Position","changeX":2,"changeY":2},"cameraOffset":{"label":"Screen Position","changeX":2,"changeY":2,"changeZ":2},"$type":"NodeCanvas.Tasks.Actions.ChangeCameraSettings"},{"valueA":{"_name":"_observerHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[UnityEngine.RaycastHit,
|
||||
UnityEngine.PhysicsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}],"$type":"NodeCanvas.Framework.ActionList"},"_position":{"x":1106.84,"y":503.1857},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"27"},{"failureRemap":1,"_position":{"x":400.0,"y":1531.0},"$type":"NodeCanvas.BehaviourTrees.Remapper","$id":"28"},{"_condition":{"conditions":[{"valueA":{"_name":"_castHit"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"_isDisabled":true,"$type":"NodeCanvas.Tasks.Conditions.CheckInput"}],"$type":"NodeCanvas.Framework.ConditionList"},"_position":{"x":360.6637,"y":1617.808},"$type":"NodeCanvas.BehaviourTrees.Interruptor","$id":"29"},{"monitorMode":1,"_position":{"x":-312.8632,"y":1265.204},"$type":"NodeCanvas.BehaviourTrees.Monitor","$id":"30"},{"_position":{"x":-309.8632,"y":1368.204},"$type":"NodeCanvas.BehaviourTrees.Inverter","$id":"31"},{"_position":{"x":-307.8632,"y":1422.204},"$type":"NodeCanvas.BehaviourTrees.Selector","$id":"32"},{"_condition":{"castType":{"_value":4},"length":{"_value":20.0},"direction":{"_value":{"z":1.0}},"offset":{},"ignoreLayers":{"_value":{"value":8}},"width":{"_value":3.0},"size":{},"rotation":{},"drawGizmos":true,"outputHit":{"_name":"_observerHit"},"overrideAgent":{"_type":"UnityEngine.Transform","_name":"camera","_targetVariableID":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba"},"$type":"Reset.CheckGenericObserver"},"_position":{"x":-621.8632,"y":1503.204},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"33"},{"_position":{"x":-659.8632,"y":1633.204},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"34"},{"_action":{"boolVariable":{"_name":"_castHit"},"setTo":0,"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-914.8632,"y":1736.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"35"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-726.2145,"y":1735.09},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"36"},{"_action":{"boolVariable":{"_name":"_castHit"},"$type":"NodeCanvas.Tasks.Actions.SetBoolean"},"_position":{"x":-505.8632,"y":1739.204},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"37"},{"policy":1,"dynamic":true,"_position":{"x":-305.8632,"y":1532.204},"$type":"NodeCanvas.BehaviourTrees.Parallel","$id":"38"},{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":-311.8632,"y":1674.204},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"39"},{"_action":{"actionName":{"_value":"Move"},"outputTo":{"_name":"_test"},"$type":"NodeCanvas.Tasks.Actions.CheckInputValue`1[[UnityEngine.Vector2,
|
||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"_position":{"x":-326.9252,"y":1793.079},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"40"},{"_condition":{"actionName":{"_value":"Grapple"},"actionPhase":{"_value":4},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_position":{"x":-159.1308,"y":1664.066},"$type":"NodeCanvas.BehaviourTrees.ConditionNode","$id":"41"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"24"},"_isDisabled":true,"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"27"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"5"},"_targetNode":{"$ref":"10"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"6"},"_targetNode":{"$ref":"7"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"8"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"7"},"_targetNode":{"$ref":"9"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"11"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"14"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"10"},"_targetNode":{"$ref":"23"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"11"},"_targetNode":{"$ref":"12"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"12"},"_targetNode":{"$ref":"13"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"14"},"_targetNode":{"$ref":"15"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"15"},"_targetNode":{"$ref":"16"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"16"},"_targetNode":{"$ref":"17"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"17"},"_targetNode":{"$ref":"18"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"17"},"_targetNode":{"$ref":"19"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"17"},"_targetNode":{"$ref":"20"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"20"},"_targetNode":{"$ref":"21"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"20"},"_targetNode":{"$ref":"22"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"24"},"_targetNode":{"$ref":"25"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"25"},"_targetNode":{"$ref":"26"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"28"},"_targetNode":{"$ref":"29"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"30"},"_targetNode":{"$ref":"31"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"31"},"_targetNode":{"$ref":"32"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"32"},"_targetNode":{"$ref":"33"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"32"},"_targetNode":{"$ref":"38"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"33"},"_targetNode":{"$ref":"34"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"35"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"36"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"34"},"_targetNode":{"$ref":"37"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"38"},"_targetNode":{"$ref":"39"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"38"},"_targetNode":{"$ref":"41"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"39"},"_targetNode":{"$ref":"40"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"camera":{"_name":"camera","_id":"e1cfd0be-7f55-420d-bdd8-e72531fc61ba","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Transform,
|
||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}'
|
||||
_objectReferences: []
|
||||
_graphSource:
|
||||
_version: 3.31
|
||||
_category:
|
||||
_comments:
|
||||
_translation: {x: -21.80302, y: 59.90968}
|
||||
_zoomFactor: 1
|
||||
_translation: {x: 82, y: -452}
|
||||
_zoomFactor: 0.9976506
|
||||
_haltSerialization: 0
|
||||
_externalSerializationFile: {fileID: 0}
|
||||
|
||||
@@ -12,7 +12,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 7a686a47eee2fa44cb0a34b5d86e4d5e, type: 3}
|
||||
m_Name: GroundedCheckBT
|
||||
m_EditorClassIdentifier:
|
||||
_serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":476.0,"y":327.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"0"},{"_position":{"x":550.0,"y":433.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"1"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"09b3259f-8b50-439a-ab86-ea3d8a4916f1"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":458.0,"y":522.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"2"},{"_action":{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"inputVector3":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"$type":"NodeCanvas.Tasks.Actions.SetAirMovement"},"_position":{"x":396.0,"y":655.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"3"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"09b3259f-8b50-439a-ab86-ea3d8a4916f1"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":715.0,"y":523.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"4"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}'
|
||||
_serializedGraph: '{"type":"NodeCanvas.BehaviourTrees.BehaviourTree","nodes":[{"repeaterMode":2,"repeatTimes":{"_value":1},"_position":{"x":476.0,"y":327.0},"$type":"NodeCanvas.BehaviourTrees.Repeater","$id":"0"},{"_position":{"x":550.0,"y":433.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"1"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"09b3259f-8b50-439a-ab86-ea3d8a4916f1"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":458.0,"y":522.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"2"},{"_position":{"x":522.0,"y":632.0},"$type":"NodeCanvas.BehaviourTrees.Sequencer","$id":"3"},{"_action":{"airMoveDirection":{"_name":"airMoveDirection","_targetVariableID":"2fc91db6-09dd-4a1f-9195-426a0c44de31"},"inputVector3":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"$type":"NodeCanvas.Tasks.Actions.SetAirMovement"},"_position":{"x":399.0,"y":775.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"4"},{"_action":{"airMoveDirection":{"_name":"groundMoveDirection","_targetVariableID":"a2c4fe25-9549-4bdd-8cec-2dbfc4a8856f"},"inputVector3":{},"$type":"NodeCanvas.Tasks.Actions.SetAirMovement"},"_position":{"x":576.0,"y":776.0},"$type":"NodeCanvas.BehaviourTrees.ActionNode","$id":"5"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"09b3259f-8b50-439a-ab86-ea3d8a4916f1"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_position":{"x":715.0,"y":523.0},"$type":"NodeCanvas.BehaviourTrees.WaitUntil","$id":"6"}],"connections":[{"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"6"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"},{"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"5"},"$type":"NodeCanvas.BehaviourTrees.BTConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{}},"derivedData":{"repeat":true,"$type":"NodeCanvas.BehaviourTrees.BehaviourTree+DerivedSerializationData"}}'
|
||||
_objectReferences: []
|
||||
_graphSource:
|
||||
_version: 3.31
|
||||
|
||||
@@ -12,16 +12,19 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: f945e777233a59f4aba40aeca29093a6, type: 3}
|
||||
m_Name: PlayerLocomotionFSM
|
||||
m_EditorClassIdentifier:
|
||||
_serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":10.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":0.3},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":559.9924,"y":711.7622},"$type":"NodeCanvas.StateMachines.ActionState","$id":"0"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":15.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":0.2},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":1161.288,"y":522.152},"$type":"NodeCanvas.StateMachines.ActionState","$id":"1"},{"_position":{"x":430.6569,"y":381.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"2"},{"_position":{"x":465.0,"y":561.0},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"3"}],"connections":[{"_condition":{"actionName":{"_value":"Sprint"},"actionValue":{"_value":""},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"desiredVector3":{"_value":{"z":1.0}},"tolerance":{"_value":0.5},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"321e55c7-f93e-4667-a0dc-559eb61c6898","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
|
||||
_serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":12.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":10.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"},{"valueA":{"_name":"facingDirection","_targetVariableID":"c713d622-aafb-43e7-ae0e-ac0b86a85a37"},"valueB":{"_value":1},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[Reset.Player.Movement.PlayerFacingDirection,
|
||||
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":559.9924,"y":711.7622},"$type":"NodeCanvas.StateMachines.ActionState","$id":"0"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":30.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":1.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"},{"valueA":{"_name":"facingDirection","_targetVariableID":"c713d622-aafb-43e7-ae0e-ac0b86a85a37"},"valueB":{"_value":2},"$type":"NodeCanvas.Tasks.Actions.SetVariable`1[[Reset.Player.Movement.PlayerFacingDirection,
|
||||
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":916.0607,"y":852.7302},"$type":"NodeCanvas.StateMachines.ActionState","$id":"1"},{"_actionList":{"executionMode":1,"actions":[{"moveSpeed":{"_value":20.0},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.CalculateGroundedLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":2.0},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":1161.288,"y":522.152},"$type":"NodeCanvas.StateMachines.ActionState","$id":"2"},{"_position":{"x":383.6569,"y":483.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"3"},{"_position":{"x":419.0,"y":609.0},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"4"}],"connections":[{"_condition":{"actionName":{"_value":"Sprint"},"actionPhase":{"_value":3},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"timeout":{"_value":0.1},"$type":"NodeCanvas.Tasks.Conditions.Timeout"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"2"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"checkAgainst":2,"checkAgainstValue":{"_value":{"z":1.0}},"desiredValue":{"_value":1.0},"tolerance":{"_value":0.32},"considerCameraRotation":{},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"4"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"4"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"321e55c7-f93e-4667-a0dc-559eb61c6898","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
|
||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"rotationSpeed":{"_name":"rotationSpeed","_id":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[System.Single,
|
||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}}}}'
|
||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"facingDirection":{"_name":"facingDirection","_id":"c713d622-aafb-43e7-ae0e-ac0b86a85a37","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[Reset.Player.Movement.PlayerFacingDirection,
|
||||
Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"}}}}'
|
||||
_objectReferences: []
|
||||
_graphSource:
|
||||
_version: 3.31
|
||||
_category:
|
||||
_comments:
|
||||
_translation: {x: 1, y: -175}
|
||||
_zoomFactor: 0.9967056
|
||||
_translation: {x: -258, y: -69}
|
||||
_zoomFactor: 1
|
||||
_haltSerialization: 0
|
||||
_externalSerializationFile: {fileID: 0}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 1726182683, guid: a4865f1ab4504ed8a368670db22f409c, type: 3}
|
||||
m_Name: AOTGenerationConfig
|
||||
m_EditorClassIdentifier:
|
||||
automateBeforeBuilds: 0
|
||||
deleteDllAfterBuilds: 1
|
||||
AutomateForAllAOTPlatforms: 1
|
||||
automateForPlatforms: 0900000014000000
|
||||
supportSerializedTypes: []
|
||||
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8cf4e72d60c563f44b838b832e931b33
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
guid: 516c69467762d38429c69cc7107c0555
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,136 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 772478971, guid: a4865f1ab4504ed8a368670db22f409c, type: 3}
|
||||
m_Name: ColorPaletteManager
|
||||
m_EditorClassIdentifier:
|
||||
colorPalettes:
|
||||
- name: Country
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.776, g: 0.651, b: 0.349, a: 1}
|
||||
- {r: 0.863, g: 0.761, b: 0.631, a: 1}
|
||||
- {r: 0.91, g: 0.831, b: 0.686, a: 1}
|
||||
- {r: 0.961, g: 0.902, b: 0.788, a: 1}
|
||||
- {r: 0.753, g: 0.714, b: 0.667, a: 1}
|
||||
- {r: 0.478, g: 0.573, b: 0.431, a: 1}
|
||||
- {r: 0.314, g: 0.427, b: 0.31, a: 1}
|
||||
- {r: 0.596, g: 0.345, b: 0.235, a: 1}
|
||||
- {r: 0.545, g: 0.329, b: 0.318, a: 1}
|
||||
- {r: 0.647, g: 0.204, b: 0.227, a: 1}
|
||||
- {r: 0.435, g: 0.161, b: 0.063, a: 1}
|
||||
- {r: 0.357, g: 0.333, b: 0.278, a: 1}
|
||||
- {r: 0.976, g: 0.98, b: 0.961, a: 1}
|
||||
- {r: 0.165, g: 0.271, b: 0.11, a: 1}
|
||||
- name: Beach
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.996, g: 0.906, b: 0.459, a: 1}
|
||||
- {r: 0.314, g: 0.592, b: 0.035, a: 1}
|
||||
- {r: 0.486, g: 0.953, b: 0.875, a: 1}
|
||||
- {r: 0.996, g: 0.82, b: 0.212, a: 1}
|
||||
- {r: 1, g: 0.769, b: 0.165, a: 1}
|
||||
- {r: 0.804, g: 0.835, b: 0.753, a: 1}
|
||||
- {r: 1, g: 0.769, b: 0.165, a: 1}
|
||||
- {r: 1, g: 0.702, b: 0.063, a: 1}
|
||||
- {r: 1, g: 0.898, b: 0.569, a: 1}
|
||||
- name: Fall
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.82, g: 0.722, b: 0.318, a: 1}
|
||||
- {r: 0.537, g: 0.192, b: 0.153, a: 1}
|
||||
- {r: 0.996, g: 0.812, b: 0.012, a: 1}
|
||||
- {r: 1, g: 0.431, b: 0.02, a: 1}
|
||||
- {r: 0.937, g: 0.267, b: 0.094, a: 1}
|
||||
- {r: 0.42, g: 0.212, b: 0.18, a: 1}
|
||||
- {r: 0.992, g: 0.651, b: 0.004, a: 1}
|
||||
- {r: 0.89, g: 0.353, b: 0.086, a: 1}
|
||||
- {r: 1, g: 0.443, b: 0.004, a: 1}
|
||||
- {r: 0.682, g: 0.275, b: 0.137, a: 1}
|
||||
- {r: 0.306, g: 0.231, b: 0.114, a: 1}
|
||||
- {r: 0.384, g: 0.416, b: 0.082, a: 1}
|
||||
- {r: 0.165, g: 0.157, b: 0.008, a: 1}
|
||||
- {r: 0.906, g: 0.635, b: 0.227, a: 1}
|
||||
- {r: 0.82, g: 0.722, b: 0.318, a: 1}
|
||||
- {r: 0.745, g: 0.435, b: 0.031, a: 1}
|
||||
- {r: 0.765, g: 0.682, b: 0.569, a: 1}
|
||||
- {r: 0.18, g: 0.149, b: 0.075, a: 1}
|
||||
- {r: 0.702, g: 0.451, b: 0.059, a: 1}
|
||||
- name: Passion
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.925, g: 0.682, b: 0.624, a: 1}
|
||||
- {r: 0.188, g: 0.114, b: 0.224, a: 1}
|
||||
- {r: 0.349, g: 0.11, b: 0.231, a: 1}
|
||||
- {r: 0.435, g: 0.267, b: 0.357, a: 1}
|
||||
- name: Sepia
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.353, g: 0.098, b: 0.02, a: 1}
|
||||
- {r: 0.663, g: 0.188, b: 0.114, a: 1}
|
||||
- {r: 0.906, g: 0.643, b: 0.082, a: 1}
|
||||
- {r: 0.996, g: 0.839, b: 0.322, a: 1}
|
||||
- {r: 0.486, g: 0.392, b: 0.02, a: 1}
|
||||
- {r: 0.294, g: 0.235, b: 0.012, a: 1}
|
||||
- name: Floral
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.855, g: 0.518, b: 0.412, a: 1}
|
||||
- {r: 0.827, g: 0.294, b: 0.333, a: 1}
|
||||
- {r: 0.737, g: 0.118, b: 0.208, a: 1}
|
||||
- {r: 0.549, g: 0.149, b: 0.235, a: 1}
|
||||
- {r: 0.949, g: 0.925, b: 0.784, a: 1}
|
||||
- {r: 0.945, g: 0.882, b: 0.69, a: 1}
|
||||
- {r: 0.871, g: 0.812, b: 0.698, a: 1}
|
||||
- {r: 0.4, g: 0.196, b: 0.243, a: 1}
|
||||
- {r: 0.271, g: 0.157, b: 0.227, a: 1}
|
||||
- name: Underwater
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.663, g: 0.416, b: 0.733, a: 1}
|
||||
- {r: 0.2, g: 0.6, b: 0.698, a: 1}
|
||||
- {r: 0.11, g: 0.49, b: 0.698, a: 1}
|
||||
- {r: 0.439, g: 0.627, b: 0.227, a: 1}
|
||||
- {r: 0, g: 0.357, b: 0.604, a: 1}
|
||||
- {r: 0.067, g: 0.271, b: 0.353, a: 1}
|
||||
- name: Breeze
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.706, g: 1, b: 0, a: 1}
|
||||
- {r: 0.651, g: 1, b: 0.404, a: 1}
|
||||
- {r: 0.122, g: 1, b: 0.514, a: 1}
|
||||
- {r: 0.216, g: 0.894, b: 0.961, a: 1}
|
||||
- {r: 0.4, g: 1, b: 0.882, a: 1}
|
||||
- {r: 0.027, g: 0.792, b: 0.8, a: 1}
|
||||
- name: Clovers
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.431, g: 0.549, b: 0.102, a: 1}
|
||||
- {r: 0.671, g: 0.714, b: 0.071, a: 1}
|
||||
- {r: 0.969, g: 0.949, b: 0.831, a: 1}
|
||||
- {r: 0.886, g: 0.902, b: 0.702, a: 1}
|
||||
- {r: 0.753, g: 0.824, b: 0.627, a: 1}
|
||||
- {r: 0.404, g: 0.6, b: 0.4, a: 1}
|
||||
- name: Tropical
|
||||
showAlpha: 0
|
||||
colors:
|
||||
- {r: 0.953, g: 0.647, b: 0.804, a: 1}
|
||||
- {r: 0.965, g: 0.741, b: 0.871, a: 1}
|
||||
- {r: 0.949, g: 0.549, b: 0.643, a: 1}
|
||||
- {r: 0.992, g: 0.659, b: 0.498, a: 1}
|
||||
- {r: 0.976, g: 0.792, b: 0.729, a: 1}
|
||||
- {r: 0.984, g: 0.855, b: 0.725, a: 1}
|
||||
- {r: 0.259, g: 0.882, b: 0.663, a: 1}
|
||||
- {r: 0.349, g: 0.753, b: 0.78, a: 1}
|
||||
- {r: 0.725, g: 0.976, b: 0.91, a: 1}
|
||||
- {r: 0.647, g: 0.745, b: 0.957, a: 1}
|
||||
- {r: 0.725, g: 0.863, b: 0.973, a: 1}
|
||||
- {r: 0.89, g: 0.945, b: 0.996, a: 1}
|
||||
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2c435e76ec72da4d9ee1f6d45f8374b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
guid: d6a3216c4fd1c1a499b50f354c57f048
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 188390376, guid: a4865f1ab4504ed8a368670db22f409c, type: 3}
|
||||
m_Name: ImportSettingsConfig
|
||||
m_EditorClassIdentifier:
|
||||
automateBeforeBuild: 1
|
||||
@@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15e2cde26c94921429fb7c3b52aa1a2a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
guid: f6e0f897646bbb54b8306b7d6c6d955d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
Assets/Resources/InputSignal.asset
Normal file
21
Assets/Resources/InputSignal.asset
Normal file
@@ -0,0 +1,21 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b8d78c77b27bcee4792dedf004b44012, type: 3}
|
||||
m_Name: InputSignal
|
||||
m_EditorClassIdentifier:
|
||||
_parameters:
|
||||
- _ID: e1c42702-42ed-4f84-b52d-4e72b42a7de5
|
||||
_name: action
|
||||
_type: UnityEngine.InputSystem.InputAction
|
||||
- _ID: 95540415-c9c3-4b53-87b6-97dcfb13cf6e
|
||||
_name: phase
|
||||
_type: UnityEngine.InputSystem.InputActionPhase
|
||||
8
Assets/Resources/InputSignal.asset.meta
Normal file
8
Assets/Resources/InputSignal.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69b5f370da7b862439a366000ea6e230
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because one or more lines are too long
1937
Assets/Scenes/WordlGeneration.unity
Normal file
1937
Assets/Scenes/WordlGeneration.unity
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a821f9bc27797d940b5963e05313b936
|
||||
guid: 59b93f2adad13734a8942e8d5a1ad672
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
@@ -10,19 +10,21 @@ using Reset.Player.Movement;
|
||||
namespace NodeCanvas.Tasks.Actions {
|
||||
[Category("Reset/Movement")]
|
||||
public class AddJump : ActionTask<CharacterController> {
|
||||
public BBParameter<float> jumpStrength;
|
||||
public BBParameter<Vector3> airMoveDirection;
|
||||
|
||||
public BBParameter<PlayerFacingDirection> playerFacingDirection;
|
||||
public BBParameter<float> jumpPower;
|
||||
|
||||
[Range(0f, 1f)]
|
||||
[Space(5)]
|
||||
public BBParameter<float> jumpStrength;
|
||||
|
||||
[SliderField(0, 1)]
|
||||
public BBParameter<float> standStillJumpStrength;
|
||||
|
||||
public BBParameter<float> jumpPower;
|
||||
[Tooltip("Determines how much current movement vectors into jump direction")]
|
||||
[SliderField(0, 1)]
|
||||
public BBParameter<float> currentVelocityInheritence;
|
||||
public BBParameter<Vector3> directionalForce;
|
||||
|
||||
[SliderField(0, 1)]
|
||||
public BBParameter<float> directionalForceStrength;
|
||||
|
||||
protected override string info {
|
||||
@@ -72,9 +74,12 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
// Check threshold of current XZ velocity- if it's too close to zero, use the jumpStrength for jumping velocity. If it's not, use the current velocity
|
||||
float velocityThreshold = 4f;
|
||||
float magnitudeZeroDifference = Mathf.Clamp(currentVelocityVector3.magnitude - velocityThreshold, 0f, Mathf.Infinity) / velocityThreshold; // Divided by maximum to return a 0-1 value. Clamping not required.
|
||||
float outputVelocity = Mathf.Lerp(jumpStrength.value, currentVelocityVector3.magnitude, Math.Clamp(magnitudeZeroDifference, 0f, 1f));
|
||||
float outputHoritontalVelocity = Mathf.Lerp(jumpStrength.value, currentVelocityVector3.magnitude, Math.Clamp(magnitudeZeroDifference, 0f, 1f));
|
||||
|
||||
outputHoritontalVelocity = Mathf.Min(outputHoritontalVelocity, Mathf.Lerp(standStillJumpStrength.value * jumpStrength.value, jumpStrength.value * .4f, magnitudeZeroDifference));
|
||||
|
||||
outputVelocity = Mathf.Min(outputVelocity, Mathf.Lerp(standStillJumpStrength.value * jumpStrength.value, jumpStrength.value * .4f, magnitudeZeroDifference));
|
||||
// Do the same for directional jump strength
|
||||
outputHoritontalVelocity = Mathf.Lerp(outputHoritontalVelocity, jumpStrength.value, directionalForceStrength.value);
|
||||
|
||||
// Remap the dot to set -1 (opposing direction) to -.5f, and 1 (same direciton) to 1.2f
|
||||
// This is done to allow some sideways jumping direction change, but none backwards, and all forwards
|
||||
@@ -94,7 +99,7 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
outputDirection = Camera.main.transform.rotation.Flatten(0, null, 0) * outputDirection;
|
||||
|
||||
// Set air move direction
|
||||
airMoveDirection.value += outputDirection * outputVelocity;
|
||||
airMoveDirection.value += outputDirection * outputHoritontalVelocity;
|
||||
}
|
||||
EndAction(true);
|
||||
}
|
||||
|
||||
@@ -3,16 +3,13 @@ using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
using Reset.Player.Movement;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions {
|
||||
|
||||
[Category("Reset/Movement")]
|
||||
public class CalculateAirMovement : ActionTask<Transform>{
|
||||
public BBParameter<Vector3> airMoveDirection;
|
||||
public BBParameter<Vector3> groundMoveDirection;
|
||||
public BBParameter<Vector3> groundMoveDirection; // Unused on 7/29/25, delete if still unusued later
|
||||
|
||||
public BBParameter<PlayerFacingDirection> playerFacingDirection;
|
||||
|
||||
private float airControlPower = 1f;
|
||||
|
||||
//Use for initialization. This is called only once in the lifetime of the task.
|
||||
@@ -25,7 +22,7 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute(){
|
||||
|
||||
airControlPower = 1f;
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
@@ -34,7 +31,7 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
airMoveDirection.value = Vector3.Lerp(airMoveDirection.value, Vector3.zero, .7f * Time.deltaTime);
|
||||
|
||||
// Decay Air Control power
|
||||
airControlPower = Mathf.Lerp(airControlPower, 0f, 3f * Time.deltaTime);
|
||||
airControlPower = Mathf.Lerp(airControlPower, 0f, 2f * Time.deltaTime);
|
||||
|
||||
// Add air control
|
||||
Vector3 inputVector3 = new(agent.GetComponent<PlayerControls>().rawMoveInput.x, 0f, agent.GetComponent<PlayerControls>().rawMoveInput.y);
|
||||
@@ -47,7 +44,7 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
|
||||
//Called when the task is disabled.
|
||||
protected override void OnStop() {
|
||||
groundMoveDirection.value = agent.GetComponent<CharacterController>().velocity;
|
||||
// groundMoveDirection.value = agent.GetComponent<CharacterController>().velocity;
|
||||
EndAction(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions {
|
||||
|
||||
[Category("Core/Input")]
|
||||
[Description("Returns a float from two Vector3s")]
|
||||
public class GetMovementInputDotProduct : ConditionTask<PlayerControls>{
|
||||
[SliderField(0f,1f)]
|
||||
public BBParameter<Vector3> desiredVector3;
|
||||
public BBParameter<float> tolerance;
|
||||
public BBParameter<bool> negate;
|
||||
|
||||
//Use for initialization. This is called only once in the lifetime of the task.
|
||||
//Return null if init was successfull. Return an error string otherwise
|
||||
protected override string OnInit(){
|
||||
return null;
|
||||
}
|
||||
|
||||
//This is called once each time the task is enabled.
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override bool OnCheck(){
|
||||
Vector3 rawInputVector3 = new(agent.rawMoveInput.x, 0f, agent.rawMoveInput.y);
|
||||
float dotProduct = Vector3.Dot(desiredVector3.value, rawInputVector3);
|
||||
|
||||
//Debug.Log(dotProduct);
|
||||
|
||||
if (dotProduct < tolerance.value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Called when the task is disabled.
|
||||
protected override void OnEnable() {
|
||||
|
||||
}
|
||||
|
||||
//Called when the task is paused.
|
||||
protected override void OnDisable() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
121
Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs
Normal file
121
Assets/Scripts/Core/Graph Tasks/ChangeAgentTransform.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using System;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using ParadoxNotion.Serialization.FullSerializer;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions {
|
||||
|
||||
[Category("Reset")]
|
||||
[Description("Update the agent's position and rotation (scale too, sure whynot) either instantly or over time.")]
|
||||
public class ChangeAgentTransform : ActionTask<CharacterController>{
|
||||
public enum TransformProperty{
|
||||
Position,
|
||||
Rotation,
|
||||
Scale
|
||||
}
|
||||
|
||||
protected override string info {
|
||||
get{
|
||||
string basicText = string.Format($"Player {targetProperty.ToString()} to {(targetValue.isPresumedDynamic ? targetValue.name : targetValue.value)}");
|
||||
basicText += relativeToSelf.value ? ", relative to Self" : "";
|
||||
|
||||
return basicText;
|
||||
}
|
||||
}
|
||||
|
||||
public TransformProperty targetProperty;
|
||||
|
||||
[ParadoxNotion.Design.ShowIf("targetProperty", 0), Space(5)]
|
||||
public BBParameter<bool> forcePositionChange;
|
||||
|
||||
public BBParameter<Vector3> targetValue;
|
||||
|
||||
public BBParameter<bool> relativeToSelf;
|
||||
|
||||
[Tooltip("Set this to the current position if you're trying to rotate by 'this much'. Keep it zero for world space values.")]
|
||||
public BBParameter<Vector3> relativeValue;
|
||||
|
||||
public BBParameter<bool> changeInstantly;
|
||||
public BBParameter<float> smoothing;
|
||||
|
||||
private Vector3 currentVel;
|
||||
|
||||
|
||||
//Use for initialization. This is called only once in the lifetime of the task.
|
||||
//Return null if init was successfull. Return an error string otherwise
|
||||
protected override string OnInit() {
|
||||
return null;
|
||||
}
|
||||
|
||||
//This is called once each time the task is enabled.
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute() {
|
||||
switch (targetProperty) {
|
||||
case TransformProperty.Position:
|
||||
Vector3 relativeUseValue = relativeValue.value;
|
||||
if (relativeToSelf.value) {
|
||||
relativeUseValue = agent.transform.position;
|
||||
}
|
||||
|
||||
if (changeInstantly.value) {
|
||||
agent.Move(agent.transform.position.DirectionTo(relativeUseValue + targetValue.value));
|
||||
}
|
||||
|
||||
break;
|
||||
case TransformProperty.Rotation:
|
||||
agent.transform.rotation = Quaternion.LookRotation(relativeValue.value) * Quaternion.Euler(targetValue.value);
|
||||
break;
|
||||
case TransformProperty.Scale:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
if (changeInstantly.value) {
|
||||
EndAction(true);
|
||||
}
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
protected override void OnUpdate() {
|
||||
switch (targetProperty) {
|
||||
case TransformProperty.Position:
|
||||
Vector3 relativeUseValue = relativeValue.value;
|
||||
if (relativeToSelf.value) {
|
||||
relativeUseValue = agent.transform.position;
|
||||
}
|
||||
|
||||
if (!changeInstantly.value) {
|
||||
Vector3 targetPosition = relativeUseValue + targetValue.value;
|
||||
// agent.transform.position = Vector3.SmoothDamp(agent.transform.position, targetPosition,
|
||||
// ref currentVel, smoothing.value * Time.deltaTime);
|
||||
|
||||
agent.Move((agent.transform.position.DirectionTo(targetPosition)).normalized * .5f * Mathf.Lerp(0, 1, Vector3.Distance(agent.transform.position, targetPosition)) * smoothing.value * Time.deltaTime);
|
||||
EndAction();
|
||||
}
|
||||
|
||||
break;
|
||||
case TransformProperty.Rotation:
|
||||
agent.transform.rotation = Quaternion.Euler(relativeValue.value) * Quaternion.Euler(targetValue.value);
|
||||
break;
|
||||
case TransformProperty.Scale:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
//Called when the task is disabled.
|
||||
protected override void OnStop() {
|
||||
|
||||
}
|
||||
|
||||
//Called when the task is paused.
|
||||
protected override void OnPause() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b77e2b9ac9aad644480508d5a86f4006
|
||||
@@ -5,7 +5,7 @@ using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
// Individual bool setting for each ring. Three of these will be used.
|
||||
public struct OrbitalFollowValueGroup{
|
||||
public struct OrbitalFollowValueGroup : ICameraValueGroup{
|
||||
public string label;
|
||||
|
||||
public CameraSettingsToggle changeHeight;
|
||||
@@ -38,7 +38,11 @@ public enum CameraSettingsToggle{
|
||||
ResetValue,
|
||||
}
|
||||
|
||||
public struct Vector3CameraValueGroup{
|
||||
public interface ICameraValueGroup{
|
||||
|
||||
}
|
||||
|
||||
public struct Vector3CameraValueGroup : ICameraValueGroup{
|
||||
public string label;
|
||||
public Vector3 newValue;
|
||||
|
||||
@@ -56,7 +60,7 @@ public struct Vector3CameraValueGroup{
|
||||
}
|
||||
}
|
||||
|
||||
public struct Vector2CameraValueGroup{
|
||||
public struct Vector2CameraValueGroup : ICameraValueGroup{
|
||||
public string label;
|
||||
public Vector2 newValue;
|
||||
|
||||
@@ -72,7 +76,7 @@ public struct Vector2CameraValueGroup{
|
||||
}
|
||||
}
|
||||
|
||||
public struct FloatCameraValueGroup{
|
||||
public struct FloatCameraValueGroup : ICameraValueGroup{
|
||||
public string label;
|
||||
public float value;
|
||||
|
||||
@@ -85,7 +89,63 @@ public struct FloatCameraValueGroup{
|
||||
}
|
||||
}
|
||||
|
||||
public struct BoolCameraValueGroup : ICameraValueGroup{
|
||||
public string label;
|
||||
public bool value;
|
||||
|
||||
public CameraSettingsToggle changeValue;
|
||||
|
||||
public BoolCameraValueGroup(string newLabel){
|
||||
label = newLabel;
|
||||
value = true;
|
||||
changeValue = CameraSettingsToggle.NoChange;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
public class BoolCameraValueGroupDrawer : ObjectDrawer<BoolCameraValueGroup> {
|
||||
public override BoolCameraValueGroup OnGUI(GUIContent content, BoolCameraValueGroup _instance){
|
||||
// Remove label for floats
|
||||
EditorGUIUtility.labelWidth = 50;
|
||||
|
||||
// Set layout options for the label and the float fields
|
||||
GUILayoutOption[] floatOptions = new GUILayoutOption[] {
|
||||
GUILayout.Width(80.0f),
|
||||
GUILayout.MinWidth(20.0f),
|
||||
GUILayout.ExpandWidth(true),
|
||||
};
|
||||
|
||||
GUILayoutOption[] labelOptions = new GUILayoutOption[]{
|
||||
GUILayout.Width(200.0f),
|
||||
};
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.ToString(), labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
_instance.changeValue = (CameraSettingsToggle)EditorGUILayout.EnumPopup("", instance.changeValue);
|
||||
|
||||
// Create the value/disabled information field
|
||||
if (_instance.changeValue == CameraSettingsToggle.NewValue){
|
||||
_instance.value = EditorGUILayout.Toggle(_instance.value, floatOptions);
|
||||
} else {
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
EditorGUILayout.TextField(_instance.changeValue == CameraSettingsToggle.NoChange ? "Unchanged" : "Reset", floatOptions);
|
||||
EditorGUI.EndDisabledGroup();
|
||||
}
|
||||
|
||||
// Close this line up
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// Reset to default so the rest of things don't get messed up
|
||||
EditorGUIUtility.labelWidth = 0;
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public class FloatCameraValueGroupDrawer : ObjectDrawer<FloatCameraValueGroup> {
|
||||
public override FloatCameraValueGroup OnGUI(GUIContent _content, FloatCameraValueGroup _instance){
|
||||
// Remove label for floats
|
||||
@@ -147,7 +207,7 @@ public class Vector3CameraValueGroupDrawer : ObjectDrawer<Vector3CameraValueGrou
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.ToString(), labelOptions);
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
@@ -220,7 +280,7 @@ public class Vector2CameraValueGroupDrawer : ObjectDrawer<Vector2CameraValueGrou
|
||||
|
||||
// Start the Vertical layout then add the label before adding a horizontal so the label will be on top of side-by-side options
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(_instance.ToString(), labelOptions);
|
||||
GUILayout.Label(_instance.label, labelOptions);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
// Create the x settings enum
|
||||
@@ -326,17 +386,26 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
public class ChangeCameraSettings : ActionTask{
|
||||
[ParadoxNotion.Design.Header("Main Settings")]
|
||||
public FloatCameraValueGroup fieldOfView = new (newLabel: "FOV");
|
||||
|
||||
[ParadoxNotion.Design.Header("Orbit Follow Ring Settings"), Space (5)]
|
||||
public Vector3CameraValueGroup orbitTargetOffset = new(newLabel: "Target Offset");
|
||||
[Space(5)]public Vector3CameraValueGroup orbitPositionDamping = new(newLabel: "Position Damping");
|
||||
|
||||
[ParadoxNotion.Design.Header("Orbit Follow Ring Settings")]
|
||||
public OrbitalFollowValueGroup orbitFollowTop = new (newLabel: "Top");
|
||||
public OrbitalFollowValueGroup orbitFollowCenter = new (newLabel: "Center");
|
||||
public OrbitalFollowValueGroup orbitFollowBottom = new (newLabel: "Bottom");
|
||||
|
||||
public BoolCameraValueGroup enableXAxis = new (newLabel: "Input Axis X Enabled");
|
||||
public BoolCameraValueGroup enableYAxis = new (newLabel: "Input Axis Y Enabled");
|
||||
|
||||
public FloatCameraValueGroup axisLookXGain = new (newLabel: "Look Orbit X Gain");
|
||||
public FloatCameraValueGroup axisLookYGain = new (newLabel: "Look Orbit Y Gain");
|
||||
|
||||
[ParadoxNotion.Design.Header("Rotation Composer Settings")]
|
||||
public Vector2CameraValueGroup screenPosition = new (newLabel: "Screen Position");
|
||||
|
||||
[ParadoxNotion.Design.Header("Camera Offset Settings")]
|
||||
public Vector3CameraValueGroup cameraOffset = new (newLabel: "Screen Position");
|
||||
public Vector3CameraValueGroup cameraOffset = new (newLabel: "Offset");
|
||||
|
||||
//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
|
||||
@@ -348,122 +417,117 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute(){
|
||||
// Switch case farm for checking if values should be changed and what to
|
||||
// Field of view
|
||||
switch (fieldOfView.changeValue) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.mainFieldOfView.targetValue = fieldOfView.value;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.mainFieldOfView.Reset();
|
||||
break;
|
||||
}
|
||||
UpdateOrbitFollowValue(orbitFollowTop, ref CameraSettingsProcessor.values.orbitFollowTopHeight, ref CameraSettingsProcessor.values.orbitFollowTopRadius);
|
||||
UpdateOrbitFollowValue(orbitFollowCenter, ref CameraSettingsProcessor.values.orbitFollowCenterHeight, ref CameraSettingsProcessor.values.orbitFollowCenterRadius);
|
||||
UpdateOrbitFollowValue(orbitFollowBottom, ref CameraSettingsProcessor.values.orbitFollowBottomHeight, ref CameraSettingsProcessor.values.orbitFollowBottomRadius);
|
||||
|
||||
// Orbit follow rings
|
||||
switch (orbitFollowTop.changeHeight) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.orbitFollowTopHeight.targetValue = orbitFollowTop.height;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.orbitFollowTopHeight.Reset();
|
||||
break;
|
||||
}
|
||||
UpdateVector3Value(cameraOffset, ref CameraSettingsProcessor.values.cameraOffsetOffset);
|
||||
|
||||
switch (orbitFollowTop.changeRadius) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.orbitFollowTopRadius.targetValue = orbitFollowTop.radius;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.orbitFollowTopRadius.Reset();
|
||||
break;
|
||||
}
|
||||
UpdateVector3Value(orbitPositionDamping, ref CameraSettingsProcessor.values.orbitPositionDamping);
|
||||
UpdateVector3Value(orbitTargetOffset, ref CameraSettingsProcessor.values.orbitTargetOffset);
|
||||
|
||||
switch (orbitFollowCenter.changeHeight) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.orbitFollowCenterHeight.targetValue = orbitFollowCenter.height;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.orbitFollowCenterHeight.Reset();
|
||||
break;
|
||||
}
|
||||
UpdateVector2Value(screenPosition, ref CameraSettingsProcessor.values.rotationComposerScreenPos);
|
||||
UpdateFloatValue(fieldOfView, ref CameraSettingsProcessor.values.mainFieldOfView);
|
||||
|
||||
switch (orbitFollowCenter.changeRadius) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.orbitFollowCenterRadius.targetValue = orbitFollowCenter.radius;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.orbitFollowCenterRadius.Reset();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (orbitFollowBottom.changeHeight) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.orbitFollowBottomHeight.targetValue = orbitFollowBottom.height;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.orbitFollowBottomHeight.Reset();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (orbitFollowBottom.changeRadius) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.orbitFollowBottomRadius.targetValue = orbitFollowBottom.radius;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.orbitFollowBottomRadius.Reset();
|
||||
break;
|
||||
}
|
||||
UpdateFloatValue(axisLookXGain, ref CameraSettingsProcessor.values.axisLookGainX);
|
||||
UpdateFloatValue(axisLookYGain, ref CameraSettingsProcessor.values.axisLookGainY);
|
||||
|
||||
// Screen Position
|
||||
switch (screenPosition.changeX) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.x = screenPosition.newValue.x;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.x = CameraSettingsProcessor.values.rotationComposerScreenPos.originalValue.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (screenPosition.changeY) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.y = screenPosition.newValue.y;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.rotationComposerScreenPos.targetValue.y = CameraSettingsProcessor.values.rotationComposerScreenPos.originalValue.y;
|
||||
break;
|
||||
}
|
||||
|
||||
// Camera Offset
|
||||
switch (cameraOffset.changeX) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.x = cameraOffset.newValue.x;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.x = CameraSettingsProcessor.values.cameraOffsetOffset.originalValue.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cameraOffset.changeY) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.y = cameraOffset.newValue.y;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.y = CameraSettingsProcessor.values.cameraOffsetOffset.originalValue.y;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (cameraOffset.changeZ) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.z = cameraOffset.newValue.z;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
CameraSettingsProcessor.values.cameraOffsetOffset.targetValue.z = CameraSettingsProcessor.values.cameraOffsetOffset.originalValue.z;
|
||||
break;
|
||||
}
|
||||
|
||||
EndAction(true);
|
||||
}
|
||||
|
||||
public void UpdateVector3Value(Vector3CameraValueGroup valueGroup, ref CameraSettingSingleValue<Vector3> targetProperty){
|
||||
switch (valueGroup.changeX) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetProperty.targetValue.x = valueGroup.newValue.x;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetProperty.targetValue.x = targetProperty.originalValue.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeY) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetProperty.targetValue.y = valueGroup.newValue.y;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetProperty.targetValue.y = targetProperty.originalValue.y;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeZ) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetProperty.targetValue.z = valueGroup.newValue.z;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetProperty.targetValue.z = targetProperty.originalValue.z;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateVector2Value(Vector2CameraValueGroup valueGroup, ref CameraSettingSingleValue<Vector2> targetProperty){
|
||||
switch (valueGroup.changeX) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetProperty.targetValue.x = valueGroup.newValue.x;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetProperty.targetValue.x = targetProperty.originalValue.x;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeY) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetProperty.targetValue.y = valueGroup.newValue.y;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetProperty.targetValue.y = targetProperty.originalValue.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateOrbitFollowValue(OrbitalFollowValueGroup valueGroup, ref CameraSettingSingleValue<float> targetHeight, ref CameraSettingSingleValue<float> targetRadius){
|
||||
switch (valueGroup.changeHeight) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetHeight.targetValue = valueGroup.height;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetHeight.targetValue = targetHeight.originalValue;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valueGroup.changeRadius) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetRadius.targetValue = valueGroup.radius;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetRadius.targetValue = targetRadius.originalValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateBoolValue(BoolCameraValueGroup valueGroup, ref CameraSettingSingleValue<bool> targetProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetProperty.targetValue = valueGroup.value;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetProperty.targetValue = targetProperty.originalValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateFloatValue(FloatCameraValueGroup valueGroup, ref CameraSettingSingleValue<float> targetProperty){
|
||||
switch (valueGroup.changeValue) {
|
||||
case CameraSettingsToggle.NewValue:
|
||||
targetProperty.targetValue = valueGroup.value;
|
||||
break;
|
||||
case CameraSettingsToggle.ResetValue:
|
||||
targetProperty.targetValue = targetProperty.originalValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
protected override void OnUpdate() {
|
||||
|
||||
|
||||
60
Assets/Scripts/Core/Graph Tasks/CheckEnvironmentObserver.cs
Normal file
60
Assets/Scripts/Core/Graph Tasks/CheckEnvironmentObserver.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions {
|
||||
[Category("Reset")]
|
||||
public class CheckEnvironmentObserver : ConditionTask<PlayerEnvironmentManager>{
|
||||
|
||||
public BBParameter<string> observerLabel;
|
||||
public BBParameter<RaycastHit> outputHitTo;
|
||||
|
||||
protected override string info{
|
||||
get {
|
||||
return $"Check Environment Observer, [\"{observerLabel.value}\"]";
|
||||
}
|
||||
}
|
||||
|
||||
//Use for initialization. This is called only once in the lifetime of the task.
|
||||
//Return null if init was successfull. Return an error string otherwise
|
||||
protected override string OnInit(){
|
||||
var observer = agent.FindObserverFromString(observerLabel.value);
|
||||
if (observer == null) {
|
||||
return $"An environment observer couldn't be found under the name {observerLabel.value}. Check your spelling and if it exists??";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//Called whenever the condition gets enabled.
|
||||
protected override void OnEnable() {
|
||||
agent.FindObserverFromString(observerLabel.value).active = true;
|
||||
}
|
||||
|
||||
//Called whenever the condition gets disabled.
|
||||
protected override void OnDisable() {
|
||||
agent.FindObserverFromString(observerLabel.value).active = false;
|
||||
}
|
||||
|
||||
//Called once per frame while the condition is active.
|
||||
//Return whether the condition is success or failure.
|
||||
protected override bool OnCheck(){
|
||||
if (agent.EvaluateFromString(observerLabel.value) == true) {
|
||||
if (outputHitTo.isDefined) {
|
||||
EnvironmentObserver hitObserver = agent.FindObserverFromString(observerLabel.value, agent.observers);
|
||||
|
||||
if (hitObserver.hit.Equals(default(RaycastHit))) {
|
||||
Debug.LogError("You just tried to pull a RaycastHit for later use from an environment observer, but no RaycastHit is available. Don't forget that CastType.Box and CastType.Sphere CANNOT spit one out!");
|
||||
} else {
|
||||
outputHitTo.value = hitObserver.hit;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 95ad4bd047d9654478597c68a81b01a0
|
||||
110
Assets/Scripts/Core/Graph Tasks/CheckGenericObserver.cs
Normal file
110
Assets/Scripts/Core/Graph Tasks/CheckGenericObserver.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System.Drawing;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#if UNITY_EDITOR
|
||||
using NodeCanvas.Editor;
|
||||
#endif
|
||||
using UnityEditor;
|
||||
|
||||
namespace Reset {
|
||||
[Category("Reset")]
|
||||
[Description("Creates an environment observer unattached from the player, such as for checking from the Camera or another arbitray location.")]
|
||||
public class CheckGenericObserver : ConditionTask<Transform>{
|
||||
[Space(5)]
|
||||
public BBParameter<EnvironmentObserver.CastType> castType;
|
||||
|
||||
public BBParameter<float> length;
|
||||
public BBParameter<Vector3> direction;
|
||||
public BBParameter<Vector3> offset;
|
||||
public BBParameter<LayerMask> ignoreLayers;
|
||||
|
||||
public BBParameter<float> width;
|
||||
|
||||
public BBParameter<Vector3> size;
|
||||
|
||||
public BBParameter<Vector3> rotation;
|
||||
|
||||
public bool drawGizmos;
|
||||
public bool drawGizmosOnlyWhenActive;
|
||||
|
||||
private EnvironmentObserver observer;
|
||||
|
||||
public BBParameter<RaycastHit> outputHit;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
protected override void OnTaskInspectorGUI(){
|
||||
BBParameterEditor.ParameterField("Cast Type", castType);
|
||||
|
||||
BBParameterEditor.ParameterField("Length", length);
|
||||
BBParameterEditor.ParameterField("Direction", direction);
|
||||
BBParameterEditor.ParameterField("Offset", offset);
|
||||
BBParameterEditor.ParameterField("Ignore Layers", ignoreLayers);
|
||||
|
||||
if (castType.value == EnvironmentObserver.CastType.SphereCast || castType.value == EnvironmentObserver.CastType.SphereOverlap) {
|
||||
BBParameterEditor.ParameterField("Width", width);
|
||||
}
|
||||
|
||||
if (castType.value == EnvironmentObserver.CastType.BoxCast || castType.value == EnvironmentObserver.CastType.BoxOverlap) {
|
||||
BBParameterEditor.ParameterField("Size", size);
|
||||
}
|
||||
|
||||
if (castType.value != EnvironmentObserver.CastType.Ray) {
|
||||
BBParameterEditor.ParameterField("Rotation", rotation);
|
||||
}
|
||||
|
||||
drawGizmos = EditorGUILayout.Toggle("Draw Gizmos", drawGizmos);
|
||||
|
||||
if (drawGizmos) {
|
||||
drawGizmosOnlyWhenActive = EditorGUILayout.Toggle("Draw Gizmos Only When Active", drawGizmosOnlyWhenActive);
|
||||
}
|
||||
|
||||
BBParameterEditor.ParameterField("Output Hit", outputHit);
|
||||
}
|
||||
#endif
|
||||
|
||||
//Return null if init was successfull. Return an error string otherwise
|
||||
protected override string OnInit(){
|
||||
return null;
|
||||
}
|
||||
|
||||
//Called whenever the condition gets enabled.
|
||||
protected override void OnEnable() {
|
||||
observer = new EnvironmentObserver(){
|
||||
castType = castType.value,
|
||||
active = true,
|
||||
|
||||
length = length.value,
|
||||
direction = direction.value,
|
||||
offset = offset.value,
|
||||
ignoreLayers = ignoreLayers.value,
|
||||
|
||||
width = width.value,
|
||||
|
||||
size = size.value,
|
||||
rotation = rotation.value
|
||||
};
|
||||
}
|
||||
|
||||
//Called whenever the condition gets disabled.
|
||||
protected override void OnDisable() {
|
||||
|
||||
}
|
||||
|
||||
//Called once per frame while the condition is active.
|
||||
//Return whether the condition is success or failure.
|
||||
protected override bool OnCheck() {
|
||||
bool check = observer.Evaluate(agent.gameObject);
|
||||
|
||||
if (drawGizmos) {
|
||||
observer.DrawObserverGizmo(agent.gameObject, true);
|
||||
}
|
||||
|
||||
return check;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb4b5bf056649ca48b1b14dbe499de46
|
||||
@@ -1,49 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions {
|
||||
|
||||
[Category("Reset/Input")]
|
||||
[Description("Check if input condition was matched this frame")]
|
||||
[Description("Check if input condition was matched this frame by phase.")]
|
||||
public class CheckInput : ConditionTask<Transform>{
|
||||
public BBParameter<string> actionName;
|
||||
public BBParameter<string> actionValue;
|
||||
|
||||
public BBParameter<InputActionPhase> actionPhase;
|
||||
|
||||
private SignalDefinition signalDefinition;
|
||||
protected override string info {
|
||||
get { return "Player Input"; }
|
||||
get { return $"Input <b>{actionName.value}</b> was <b>{actionPhase.value}</b>"; }
|
||||
}
|
||||
|
||||
private InputAction action;
|
||||
|
||||
//Use for initialization. This is called only once in the lifetime of the task.
|
||||
//Return null if init was successfull. Return an error string otherwise
|
||||
|
||||
protected override string OnInit(){
|
||||
try {
|
||||
signalDefinition = Resources.Load<SignalDefinition>("InputSignal");
|
||||
} catch (Exception e) {
|
||||
Debug.LogError($"Error finding the Input Signal defintion: {e.Message}");
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
//Called whenever the condition gets enabled.
|
||||
protected override void OnEnable(){
|
||||
action = agent.GetComponent<PlayerInput>().actions.FindAction(actionName.value);
|
||||
protected override void OnEnable() {
|
||||
signalDefinition.onInvoke -= OnSignalInvoke;
|
||||
signalDefinition.onInvoke += OnSignalInvoke;
|
||||
}
|
||||
|
||||
//Called whenever the condition gets disabled.
|
||||
protected override void OnDisable() {
|
||||
|
||||
signalDefinition.onInvoke -= OnSignalInvoke;
|
||||
}
|
||||
|
||||
//Called once per frame while the condition is active.
|
||||
//Return whether the condition is success or failure.
|
||||
protected override bool OnCheck() {
|
||||
// if (action.type == InputActionType.Button){
|
||||
if (action.WasPressedThisFrame()) { return true; }
|
||||
// } else if (action.type == InputActionType.Value) {
|
||||
//
|
||||
// }
|
||||
|
||||
return false;
|
||||
|
||||
void OnSignalInvoke(Transform sender, Transform receiver, bool isGlobal, params object[] args){
|
||||
// Take the input arguments as objects and convert them to InputAction & Phases
|
||||
InputAction thisAction = (InputAction)args[0];
|
||||
InputActionPhase thisActionPhase = (InputActionPhase)args[1];
|
||||
|
||||
if (actionName.value == thisAction.name && actionPhase.value == thisActionPhase) {
|
||||
YieldReturn(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnCheck() { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
42
Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs
Normal file
42
Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions {
|
||||
[Category("Reset/Input")]
|
||||
[Description("Check if input condition was matched this frame by phase.")]
|
||||
public class CheckInputValue<T> : ActionTask<PlayerInput> where T : struct{
|
||||
public BBParameter<string> actionName;
|
||||
public BBParameter<T> outputTo;
|
||||
|
||||
private T value;
|
||||
|
||||
private SignalDefinition signalDefinition;
|
||||
protected override string info {
|
||||
get { return $"Get Value of <b>Input:</b> \"{actionName.value}\""; }
|
||||
}
|
||||
|
||||
protected override string OnInit(){
|
||||
try {
|
||||
signalDefinition = Resources.Load<SignalDefinition>("InputSignal");
|
||||
} catch (Exception e) {
|
||||
Debug.LogError($"Error finding the Input Signal defintion: {e.Message}");
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void OnExecute(){
|
||||
Debug.Log($"{outputTo.value}, {agent.actions[actionName.value].ReadValue<T>()}");
|
||||
|
||||
outputTo.value = agent.actions[actionName.value].ReadValue<T>();
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs.meta
Normal file
2
Assets/Scripts/Core/Graph Tasks/CheckInputValue.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 055df0fbf696a3149a2d49a8a5392aba
|
||||
55
Assets/Scripts/Core/Graph Tasks/DecomposeRaycastHit.cs
Normal file
55
Assets/Scripts/Core/Graph Tasks/DecomposeRaycastHit.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion.Design;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace NodeCanvas.Tasks.Actions {
|
||||
|
||||
[Category("Reset")]
|
||||
[Description("Breaks down an incoming RaycastHit into it's constituent parts for later use.")]
|
||||
public class DecomposeRaycastHit : ActionTask{
|
||||
public BBParameter<RaycastHit> raycastHit;
|
||||
|
||||
public BBParameter<Transform> transform;
|
||||
public BBParameter<Collider> collider;
|
||||
public BBParameter<GameObject> gameObject;
|
||||
public BBParameter<float> distance;
|
||||
public BBParameter<Vector3> normal;
|
||||
public BBParameter<Vector3> point;
|
||||
|
||||
//Use for initialization. This is called only once in the lifetime of the task.
|
||||
//Return null if init was successfull. Return an error string otherwise
|
||||
protected override string OnInit() {
|
||||
return null;
|
||||
}
|
||||
|
||||
//This is called once each time the task is enabled.
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute(){
|
||||
if (transform.isDefined){ transform.value = raycastHit.value.transform; }
|
||||
if (collider.isDefined){ collider.value = raycastHit.value.collider; }
|
||||
if (gameObject.isDefined){ gameObject.value = raycastHit.value.transform.gameObject; }
|
||||
if (distance.isDefined){ distance.value = raycastHit.value.distance; }
|
||||
if (normal.isDefined){ normal.value = raycastHit.value.normal; }
|
||||
if (point.isDefined){ point.value = raycastHit.value.point; }
|
||||
|
||||
EndAction(true);
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
protected override void OnUpdate() {
|
||||
|
||||
}
|
||||
|
||||
//Called when the task is disabled.
|
||||
protected override void OnStop() {
|
||||
|
||||
}
|
||||
|
||||
//Called when the task is paused.
|
||||
protected override void OnPause() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79f7cbb75d876f84b8edfae676ba324c
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using NodeCanvas.Framework;
|
||||
using NUnit.Framework.Constraints;
|
||||
using ParadoxNotion.Design;
|
||||
using ParadoxNotion.Serialization.FullSerializer;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NodeCanvas.Tasks.Conditions {
|
||||
|
||||
[Category("Reset/Input")]
|
||||
[Description("Returns a float from two Vector3s")]
|
||||
public class GetMovementInputDotProduct : ConditionTask<PlayerControls>{
|
||||
enum CheckDotProductAgainst{
|
||||
ForwardDirection,
|
||||
CameraDirection,
|
||||
InputVector3
|
||||
}
|
||||
|
||||
[ExposeField, fsSerializeAs] CheckDotProductAgainst checkAgainst;
|
||||
[ParadoxNotion.Design.ShowIf("checkAgainst", 2)] public BBParameter<Vector3> checkAgainstValue;
|
||||
[SliderField(-1f, 1f)] public BBParameter<float> desiredValue;
|
||||
public BBParameter<float> tolerance;
|
||||
|
||||
public BBParameter<bool> considerCameraRotation;
|
||||
public BBParameter<bool> negate;
|
||||
|
||||
//Use for initialization. This is called only once in the lifetime of the task.
|
||||
//Return null if init was successfull. Return an error string otherwise
|
||||
protected override string OnInit(){
|
||||
return null;
|
||||
}
|
||||
|
||||
//This is called once each time the task is enabled.
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override bool OnCheck(){
|
||||
// Switch what the dot product is checked against
|
||||
Vector3 valueToCheck;
|
||||
|
||||
switch (checkAgainst) {
|
||||
case CheckDotProductAgainst.ForwardDirection:
|
||||
Debug.Log(agent.transform.forward);
|
||||
valueToCheck = agent.transform.forward;
|
||||
break;
|
||||
case CheckDotProductAgainst.CameraDirection:
|
||||
valueToCheck = Camera.main.transform.forward;
|
||||
break;
|
||||
case CheckDotProductAgainst.InputVector3:
|
||||
valueToCheck = checkAgainstValue.value.normalized;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
// Get the input as a Vector3
|
||||
Vector3 rawInputVector3 = new Vector3(agent.rawMoveInput.x, 0f, agent.rawMoveInput.y);
|
||||
if (considerCameraRotation.value) {
|
||||
rawInputVector3 = Camera.main.transform.rotation * rawInputVector3;
|
||||
}
|
||||
|
||||
// Calculate dor product
|
||||
float dotProduct = Vector3.Dot(valueToCheck, rawInputVector3);
|
||||
|
||||
Debug.Log(dotProduct);
|
||||
|
||||
// Compare against the desired tolerance and output result
|
||||
if (tolerance.value > Mathf.Abs(dotProduct - tolerance.value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Called when the task is disabled.
|
||||
protected override void OnEnable() {
|
||||
|
||||
}
|
||||
|
||||
//Called when the task is paused.
|
||||
protected override void OnDisable() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,8 @@ namespace Reset.Player.Movement{
|
||||
public enum PlayerFacingDirection{
|
||||
Target = 0,
|
||||
Movement,
|
||||
MatchCamera
|
||||
MatchCamera,
|
||||
Static
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +44,7 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
private float currentRotSpeed;
|
||||
private float lastLookMagnitude;
|
||||
private Quaternion targetRotation;
|
||||
private Vector3 currentMoveDir;
|
||||
|
||||
// References
|
||||
private PlayerControls controls;
|
||||
@@ -55,7 +57,7 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
// Append the late update method to actually happen on late update
|
||||
MonoManager.current.onLateUpdate += LateUpdate;
|
||||
|
||||
// What
|
||||
// Set ingitial rotation power
|
||||
currentRotSpeed = rotationSpeed.value;
|
||||
|
||||
// Reference to controls
|
||||
@@ -67,8 +69,8 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
//This is called once each time the task is enabled.
|
||||
//Call EndAction() to mark the action as finished, either in success or failure.
|
||||
//EndAction can be called from anywhere.
|
||||
protected override void OnExecute() {
|
||||
|
||||
protected override void OnExecute(){
|
||||
currentMoveDir = groundMoveDirection.value;
|
||||
}
|
||||
|
||||
//Called once per frame while the action is active.
|
||||
@@ -88,26 +90,39 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
break;
|
||||
case PlayerFacingDirection.Movement:
|
||||
// Check magnitude to avoid the "Look rotation viewing vector is zero" debug
|
||||
if (controls.rawMoveInput.magnitude == 0) { break; }
|
||||
|
||||
// Set desired rotation to input direction, with respect to camera rotation
|
||||
targetRotation = Quaternion.LookRotation(new Vector3(controls.rawMoveInput.x, 0, controls.rawMoveInput.y)) *
|
||||
Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f));
|
||||
if (agent.isGrounded){
|
||||
if (controls.rawMoveInput.magnitude == 0) { break; }
|
||||
|
||||
targetRotation = Quaternion.LookRotation(currentMoveDir) *
|
||||
Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0f, null, 0f));
|
||||
} else {
|
||||
if (airMoveDirection.value.magnitude == 0) { break; }
|
||||
|
||||
targetRotation = Quaternion.LookRotation(airMoveDirection.value);
|
||||
}
|
||||
break;
|
||||
case PlayerFacingDirection.MatchCamera:
|
||||
// Craft a new rotation that flattens the camera's rotation to the ground
|
||||
// Needed to keep the character from inheriting the camera's height-rotation
|
||||
targetRotation = Quaternion.Euler(Camera.main.transform.rotation.eulerAngles.Flatten(0, null, 0));
|
||||
break;
|
||||
case PlayerFacingDirection.Static:
|
||||
targetRotation = agent.transform.rotation;
|
||||
break;
|
||||
}
|
||||
|
||||
// Construct move direction
|
||||
Vector3 finalMoveDir = Vector3.zero;
|
||||
Vector3 gravityMoveDirection;
|
||||
|
||||
// Change how input is managed based on facing state
|
||||
currentMoveDir = Vector3.Slerp(currentMoveDir, groundMoveDirection.value, currentRotSpeed * Time.deltaTime);
|
||||
|
||||
// Add input movement
|
||||
if (agent.isGrounded){
|
||||
finalMoveDir += groundMoveDirection.value + Vector3.down * .03f;
|
||||
finalMoveDir += currentMoveDir + Vector3.down * .03f;
|
||||
gravityMoveDirection = new(0f, jumpPower.value + (Physics.gravity.y *.3f), 0f);
|
||||
} else {
|
||||
finalMoveDir += airMoveDirection.value;
|
||||
@@ -127,7 +142,7 @@ namespace NodeCanvas.Tasks.Actions {
|
||||
}
|
||||
|
||||
// Set final rotation
|
||||
agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime);
|
||||
agent.transform.rotation = Quaternion.Lerp(agent.transform.rotation, targetRotation, 10f * Time.deltaTime).Flatten(0, null, 0);
|
||||
|
||||
// ???? Moved this above but don't remember if this needs to be here still
|
||||
if (agent.isGrounded) {
|
||||
|
||||
@@ -5,91 +5,143 @@ using System.Numerics;
|
||||
using Sirenix.OdinInspector;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UIElements;
|
||||
using Vector2 = UnityEngine.Vector2;
|
||||
using Vector3 = UnityEngine.Vector3;
|
||||
|
||||
public class LockOnManager : MonoBehaviour{
|
||||
|
||||
private CinemachineTargetGroup.Target playerTarget;
|
||||
|
||||
// Lock On settings
|
||||
[Space(5)]
|
||||
public float lockOnRange = 40f;
|
||||
public float lockOnMaxAngle = 70f;
|
||||
class ReferencedTarget{
|
||||
public GameObject gameObject;
|
||||
public float targetWeight;
|
||||
public float refVelocity;
|
||||
public CinemachineTargetGroup.Target cinemachineTarget;
|
||||
}
|
||||
|
||||
// Lock On settings
|
||||
[Space(5)] public float lockOnRange = 40f;
|
||||
public float lockOnMaxAngle = 70f;
|
||||
[Range(0,1)] public float mainTargetWeight = .15f;
|
||||
[FormerlySerializedAs("smoothing")] public float smoothTime = 1f;
|
||||
|
||||
// Lock On Tracking
|
||||
[Space(10)] public GameObject lockonGameObject; // Needed because nulling the Target below doesn't actually empty it out
|
||||
[Space(10)]
|
||||
|
||||
[ShowInInspector]
|
||||
ReferencedTarget mainTarget;
|
||||
|
||||
[ShowInInspector]
|
||||
List<ReferencedTarget> activeTargets = new List<ReferencedTarget>();
|
||||
|
||||
[ReadOnly] public CinemachineTargetGroup.Target lockonTarget;
|
||||
public CinemachineTargetGroup targetGroup;
|
||||
|
||||
[Space(5)]
|
||||
public List<GameObject> lockOnTargets = new List<GameObject>();
|
||||
|
||||
private List<GameObject> acceptedTargets = new List<GameObject>();
|
||||
|
||||
// UI
|
||||
[ShowInInspector]
|
||||
public UIDocument lockOnDocument;
|
||||
[ShowInInspector] public UIDocument lockOnDocument;
|
||||
private Label elementLabelName;
|
||||
private VisualElement elementRoot;
|
||||
|
||||
private VisualElement elementRoot;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start(){
|
||||
// Save the player target object to track later
|
||||
playerTarget = targetGroup.Targets[0];
|
||||
|
||||
|
||||
// Quick check for things in lock-on target that aren't lock-onable
|
||||
if (lockonGameObject != null && lockonTarget.Object.GetComponent<ILockOnTarget>() == null) {
|
||||
Debug.LogError($"Game Object {lockonTarget.Object.name} does not implement the ILockOnTarget interface!");
|
||||
if (mainTarget != null && mainTarget.gameObject.GetComponent<ILockOnTarget>() == null) {
|
||||
Debug.LogError($"Game Object {mainTarget.gameObject.name} does not implement the ILockOnTarget interface!");
|
||||
}
|
||||
|
||||
|
||||
elementRoot = lockOnDocument.rootVisualElement.Query<VisualElement>("LockOnGroup");
|
||||
elementLabelName = lockOnDocument.rootVisualElement.Query<Label>("LockOnName").First();
|
||||
|
||||
|
||||
// Add all nearby game objects to lock-on eligible list
|
||||
GameObject[] allGameObjects = GameObject.FindObjectsByType<GameObject>(0, 0);
|
||||
|
||||
foreach (GameObject thisObject in allGameObjects)
|
||||
{
|
||||
if (Vector3.Distance(transform.position, thisObject.transform.position) < lockOnRange) {
|
||||
if (thisObject.GetComponent<ILockOnTarget>() != null) {
|
||||
lockOnTargets.Add(thisObject);
|
||||
}
|
||||
|
||||
foreach (GameObject thisObject in allGameObjects) {
|
||||
if (thisObject.GetComponent<ILockOnTarget>() != null) {
|
||||
acceptedTargets.Add(thisObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update(){
|
||||
if (lockonGameObject && lockonTarget.Object.GetComponent<ILockOnTarget>() == null) {
|
||||
Debug.LogError($"Game Object {lockonTarget.Object.name} does not implement the ILockOnTarget interface!");
|
||||
if (mainTarget != null && mainTarget.gameObject.GetComponent<ILockOnTarget>() == null) {
|
||||
Debug.LogError($"Game Object {mainTarget.gameObject.name} does not implement the ILockOnTarget interface!");
|
||||
}
|
||||
|
||||
// Iterate through targets, pushing their Target Group weight towards their goal weight, or removing them if they get too low.
|
||||
for (int i = 0; i < activeTargets.Count; i++) {
|
||||
if (activeTargets[i].gameObject == this.gameObject) {
|
||||
continue;
|
||||
}
|
||||
|
||||
activeTargets[i].cinemachineTarget.Weight =
|
||||
Mathf.SmoothDamp(
|
||||
activeTargets[i].cinemachineTarget.Weight,
|
||||
activeTargets[i].targetWeight,
|
||||
ref activeTargets[i].refVelocity,
|
||||
smoothTime * Time.deltaTime);
|
||||
|
||||
if (activeTargets[i].cinemachineTarget.Weight < 0.0001f) {
|
||||
StartCoroutine(RemoveFromTargetAtFrameEnd(activeTargets[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator RemoveFromTargetAtFrameEnd(ReferencedTarget target){
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
||||
activeTargets.Remove(target);
|
||||
targetGroup.Targets.Remove(target.cinemachineTarget);
|
||||
}
|
||||
|
||||
public void AddNewTarget(GameObject targetObject, float targetWeight, bool isMain = false){
|
||||
// Check that the target doesn't already exist- if it does, just change it's weight/make it main
|
||||
foreach (ReferencedTarget target in activeTargets) {
|
||||
if (target.gameObject == targetObject) {
|
||||
target.targetWeight = targetWeight;
|
||||
|
||||
if (isMain) {
|
||||
mainTarget = target;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Find the current lock-on target and increase it's weight to the .15f max slowly
|
||||
// They start at 0 weight when the lock-on adds them to the group
|
||||
if (lockonGameObject) {
|
||||
CinemachineTargetGroup.Target currentTarget = targetGroup.Targets.Find(target => target == lockonTarget);
|
||||
currentTarget.Weight = Mathf.MoveTowards(currentTarget.Weight, .15f, .5f * Time.deltaTime);
|
||||
// If it doesn't exist in the list of targets, add it
|
||||
ReferencedTarget newTarget = new ReferencedTarget{
|
||||
gameObject = targetObject,
|
||||
targetWeight = mainTargetWeight,
|
||||
cinemachineTarget = new CinemachineTargetGroup.Target{
|
||||
Object = targetObject.transform,
|
||||
Radius = 1f,
|
||||
Weight = 0f
|
||||
}
|
||||
};
|
||||
|
||||
//Set as main
|
||||
if (isMain) {
|
||||
mainTarget = newTarget;
|
||||
}
|
||||
|
||||
// If a target is not the current lock on target, lower their targeting weight. When low enough to not cause a sharp jitter, remove them.
|
||||
for (int i = 1; i < targetGroup.Targets.Count; i++) {
|
||||
if (targetGroup.Targets[i] == lockonTarget || targetGroup.Targets[i] == playerTarget){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (targetGroup.Targets[i].Weight < 0.001f) {
|
||||
StartCoroutine(RemoveFromTargetAtFrameEnd(targetGroup.Targets[i]));
|
||||
continue;
|
||||
}
|
||||
// Finalize
|
||||
activeTargets.Add(newTarget);
|
||||
targetGroup.Targets.Add(newTarget.cinemachineTarget);
|
||||
}
|
||||
|
||||
targetGroup.Targets[i].Weight = Mathf.MoveTowards(targetGroup.Targets[i].Weight, 0f, 1f * Time.deltaTime);
|
||||
public void QueueTargetRemoval(GameObject targetObject){
|
||||
// Ostensibly removes targest by setting their target weight to 0. Update loop finds targets with no weight and reduces their impact on the camera
|
||||
// After it smooths their current weight to 0, it removes them
|
||||
activeTargets.Find(target => target.gameObject == targetObject).targetWeight = 0f;
|
||||
|
||||
// Remove as main target if it is
|
||||
if (mainTarget == activeTargets.Find(target => target.gameObject == targetObject)) {
|
||||
mainTarget = null;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator RemoveFromTargetAtFrameEnd(CinemachineTargetGroup.Target indexOf){
|
||||
yield return new WaitForEndOfFrame();
|
||||
targetGroup.Targets.Remove(indexOf);
|
||||
}
|
||||
|
||||
|
||||
public void ChangeLockOnTarget(){
|
||||
Transform cameraTransform = Camera.main.transform;
|
||||
|
||||
@@ -97,9 +149,9 @@ public class LockOnManager : MonoBehaviour{
|
||||
GameObject closestTarget = null;
|
||||
float lowestDistanceToCenter = Mathf.Infinity;
|
||||
|
||||
foreach (GameObject target in lockOnTargets) {
|
||||
foreach (GameObject target in acceptedTargets) {
|
||||
// Skip the current target if one exists
|
||||
if (lockonGameObject != null && lockonTarget.Object.gameObject == target) {
|
||||
if (mainTarget != null && mainTarget.gameObject == target) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -110,7 +162,12 @@ public class LockOnManager : MonoBehaviour{
|
||||
if (hit.transform != target.transform) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Skips targets too far
|
||||
if (Vector3.Distance(transform.position, target.transform.position) > lockOnRange) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip targets outside lock on angle
|
||||
float angleFromCameraForward = Vector3.Angle(cameraTransform.forward, cameraTransform.position.DirectionTo(target.transform.position));
|
||||
if (angleFromCameraForward > lockOnMaxAngle) {
|
||||
@@ -137,37 +194,31 @@ public class LockOnManager : MonoBehaviour{
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a new Target for the Target Group
|
||||
var newTarget = new CinemachineTargetGroup.Target{
|
||||
Object = closestTarget.transform,
|
||||
Radius = 1f,
|
||||
Weight = 0f
|
||||
};
|
||||
// Remove the main target that currently exists, if there is one.
|
||||
if (mainTarget != null) {
|
||||
QueueTargetRemoval(mainTarget.gameObject);
|
||||
}
|
||||
|
||||
// Set the new target variables
|
||||
lockonTarget = newTarget;
|
||||
lockonGameObject = closestTarget.gameObject;
|
||||
|
||||
targetGroup.Targets.Add(newTarget);
|
||||
// Begin tracking target, set as main
|
||||
AddNewTarget(closestTarget.gameObject, mainTargetWeight, true);
|
||||
}
|
||||
|
||||
public void RemoveLockOnTarget(){
|
||||
lockonTarget = null;
|
||||
lockonGameObject = null;
|
||||
QueueTargetRemoval(mainTarget.gameObject);
|
||||
}
|
||||
|
||||
void LateUpdate(){
|
||||
if (lockonGameObject) {
|
||||
if (mainTarget != null) {
|
||||
// This is just test logic to get an image above a lock on.
|
||||
// TODO: Replace with something less silly
|
||||
Vector2 screenPos = RuntimePanelUtils.CameraTransformWorldToPanel(
|
||||
lockOnDocument.rootVisualElement.panel,
|
||||
lockonTarget.Object.GetComponent<ILockOnTarget>().GetReticlePosition(),
|
||||
mainTarget.gameObject.GetComponent<ILockOnTarget>().GetReticlePosition(),
|
||||
Camera.main
|
||||
);
|
||||
|
||||
// Set name
|
||||
elementLabelName.text = lockonTarget.Object.name;
|
||||
elementLabelName.text = mainTarget.gameObject.name;
|
||||
|
||||
// Set position (add the width/height of the element)
|
||||
elementRoot.style.top = new StyleLength(screenPos.y - 25f); // Was elementRoot.resolvedStyle.height * .7f
|
||||
|
||||
@@ -13,4 +13,7 @@ public static class MathExtensions{
|
||||
return (to - origin).normalized;
|
||||
}
|
||||
|
||||
public static Color Alpha(this Color input, float newAlpha){
|
||||
return new Color(input.r, input.g, input.b, newAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,15 @@ public struct CameraSettingSingleValue<T>{
|
||||
|
||||
public struct CameraSettingValues{
|
||||
public CameraSettingSingleValue<float> mainFieldOfView;
|
||||
|
||||
public CameraSettingSingleValue<Vector3> orbitPositionDamping;
|
||||
public CameraSettingSingleValue<Vector3> orbitTargetOffset;
|
||||
|
||||
public CameraSettingSingleValue<bool> axisLookEnabledX;
|
||||
public CameraSettingSingleValue<bool> axisLookEnabledY;
|
||||
|
||||
public CameraSettingSingleValue<float> axisLookGainX;
|
||||
public CameraSettingSingleValue<float> axisLookGainY;
|
||||
|
||||
public CameraSettingSingleValue<float> orbitFollowTopHeight;
|
||||
public CameraSettingSingleValue<float> orbitFollowTopRadius;
|
||||
@@ -43,6 +52,15 @@ public struct CameraSettingValues{
|
||||
public CameraSettingValues(float defaultSmoothing){
|
||||
mainFieldOfView = new CameraSettingSingleValue<float>(defaultSmoothing);
|
||||
|
||||
orbitPositionDamping = new CameraSettingSingleValue<Vector3>(defaultSmoothing);
|
||||
orbitTargetOffset = new CameraSettingSingleValue<Vector3>(defaultSmoothing);
|
||||
|
||||
axisLookEnabledX = new CameraSettingSingleValue<bool>();
|
||||
axisLookEnabledY = new CameraSettingSingleValue<bool>();
|
||||
|
||||
axisLookGainX = new CameraSettingSingleValue<float>(defaultSmoothing);
|
||||
axisLookGainY = new CameraSettingSingleValue<float>(defaultSmoothing);
|
||||
|
||||
orbitFollowTopHeight = new CameraSettingSingleValue<float>(defaultSmoothing);
|
||||
orbitFollowTopRadius = new CameraSettingSingleValue<float>(defaultSmoothing);
|
||||
orbitFollowCenterHeight = new CameraSettingSingleValue<float>(defaultSmoothing);
|
||||
@@ -66,6 +84,7 @@ public class CameraSettingsProcessor : MonoBehaviour{
|
||||
private CinemachineOrbitalFollow orbit;
|
||||
private CinemachineRotationComposer rotComp;
|
||||
private CinemachineCameraOffset offset;
|
||||
private CinemachineInputAxisController axisCont;
|
||||
|
||||
public void Awake(){
|
||||
// Singleton management
|
||||
@@ -81,11 +100,17 @@ public class CameraSettingsProcessor : MonoBehaviour{
|
||||
orbit = mainCamera.GetComponent<CinemachineOrbitalFollow>();
|
||||
rotComp = mainCamera.GetComponent<CinemachineRotationComposer>();
|
||||
offset = mainCamera.GetComponent<CinemachineCameraOffset>();
|
||||
axisCont = mainCamera.GetComponent<CinemachineInputAxisController>();
|
||||
|
||||
// Initialize camera settings values
|
||||
values = new CameraSettingValues{
|
||||
cameraOffsetOffset = new CameraSettingSingleValue<Vector3>(defaultSmoothing: .2f, offset.Offset),
|
||||
mainFieldOfView = new CameraSettingSingleValue<float>(defaultSmoothing: .2f, main.Lens.FieldOfView),
|
||||
axisLookEnabledX = new CameraSettingSingleValue<bool>(0f, axisCont.Controllers[0].Enabled),
|
||||
axisLookEnabledY = new CameraSettingSingleValue<bool>(0f, axisCont.Controllers[1].Enabled),
|
||||
axisLookGainX = new CameraSettingSingleValue<float>(defaultSmoothing: .2f, axisCont.Controllers[0].Input.Gain),
|
||||
axisLookGainY = new CameraSettingSingleValue<float>(defaultSmoothing: .2f, axisCont.Controllers[1].Input.Gain),
|
||||
orbitPositionDamping = new CameraSettingSingleValue<Vector3>(defaultSmoothing: .2f, orbit.TrackerSettings.PositionDamping),
|
||||
orbitFollowTopHeight = new CameraSettingSingleValue<float>(defaultSmoothing: .2f, orbit.Orbits.Top.Height),
|
||||
orbitFollowTopRadius = new CameraSettingSingleValue<float>(defaultSmoothing: .2f, orbit.Orbits.Top.Radius),
|
||||
orbitFollowCenterHeight = new CameraSettingSingleValue<float>(defaultSmoothing: .2f, orbit.Orbits.Center.Height),
|
||||
@@ -100,6 +125,26 @@ public class CameraSettingsProcessor : MonoBehaviour{
|
||||
main.Lens.FieldOfView = Mathf.SmoothDamp(main.Lens.FieldOfView,
|
||||
values.mainFieldOfView.targetValue, ref values.mainFieldOfView.velocityRef,
|
||||
values.mainFieldOfView.smoothing);
|
||||
|
||||
axisCont.Controllers[0].Enabled = values.axisLookEnabledX.targetValue;
|
||||
|
||||
axisCont.Controllers[1].Enabled = values.axisLookEnabledY.targetValue;
|
||||
|
||||
axisCont.Controllers[0].Input.Gain = Mathf.SmoothDamp(axisCont.Controllers[0].Input.Gain,
|
||||
values.axisLookGainX.targetValue, ref values.axisLookGainX.velocityRef,
|
||||
values.axisLookGainX.smoothing);
|
||||
|
||||
axisCont.Controllers[1].Input.Gain = Mathf.SmoothDamp(axisCont.Controllers[1].Input.Gain,
|
||||
values.axisLookGainY.targetValue, ref values.axisLookGainY.velocityRef,
|
||||
values.axisLookGainY.smoothing);
|
||||
|
||||
orbit.TargetOffset = Vector3.SmoothDamp(orbit.TargetOffset,
|
||||
values.orbitTargetOffset.targetValue, ref values.orbitTargetOffset.velocityRefV3,
|
||||
values.orbitTargetOffset.smoothing);
|
||||
|
||||
orbit.TrackerSettings.PositionDamping = Vector3.SmoothDamp(orbit.TrackerSettings.PositionDamping,
|
||||
values.orbitPositionDamping.targetValue, ref values.orbitPositionDamping.velocityRefV3,
|
||||
values.orbitPositionDamping.smoothing);
|
||||
|
||||
orbit.Orbits.Top.Height = Mathf.SmoothDamp(orbit.Orbits.Top.Height,
|
||||
values.orbitFollowTopHeight.targetValue, ref values.orbitFollowTopHeight.velocityRef,
|
||||
@@ -132,6 +177,8 @@ public class CameraSettingsProcessor : MonoBehaviour{
|
||||
offset.Offset = Vector3.SmoothDamp(offset.Offset,
|
||||
values.cameraOffsetOffset.targetValue, ref values.cameraOffsetOffset.velocityRefV3,
|
||||
values.cameraOffsetOffset.smoothing);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Update(){
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
@@ -6,11 +7,15 @@ using UnityEngine.UIElements;
|
||||
using NodeCanvas;
|
||||
using NodeCanvas.Framework;
|
||||
using ParadoxNotion;
|
||||
using Sirenix.OdinInspector;
|
||||
|
||||
public class PlayerControls : MonoBehaviour{
|
||||
// References
|
||||
private Player thisPlayer;
|
||||
|
||||
private PlayerInput input;
|
||||
public SignalDefinition inputSignal;
|
||||
|
||||
// TODO: Turn these into accessors
|
||||
public Vector2 rawMoveInput;
|
||||
public Vector2 rawLookInput;
|
||||
@@ -20,6 +25,31 @@ public class PlayerControls : MonoBehaviour{
|
||||
void Awake(){
|
||||
thisPlayer = GetComponent<Player>();
|
||||
graph = GetComponent<GraphOwner>();
|
||||
input = GetComponent<PlayerInput>();
|
||||
|
||||
// Add the delegates for each method
|
||||
foreach (InputAction action in input.actions) {
|
||||
action.started += SendToGraph;
|
||||
action.canceled += SendToGraph;
|
||||
action.performed += SendToGraph;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the delegates for each method
|
||||
void OnDisable(){
|
||||
foreach (InputAction action in input.actions) {
|
||||
action.started -= SendToGraph;
|
||||
action.canceled -= SendToGraph;
|
||||
action.performed -= SendToGraph;
|
||||
}
|
||||
}
|
||||
|
||||
// This will call the OnSignalInvoke for this type of Signal Defintion. CheckInput is the recieving end.
|
||||
public void SendToGraph(InputAction.CallbackContext ctx){
|
||||
inputSignal.Invoke(transform, transform, false, new object[]{
|
||||
ctx.action,
|
||||
ctx.phase
|
||||
});
|
||||
}
|
||||
|
||||
public void OnMove(InputValue value){
|
||||
|
||||
356
Assets/Scripts/Player/PlayerEnvironmentManager.cs
Normal file
356
Assets/Scripts/Player/PlayerEnvironmentManager.cs
Normal file
@@ -0,0 +1,356 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Drawing;
|
||||
using Sirenix.OdinInspector;
|
||||
using Sirenix.Serialization;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
[Serializable]
|
||||
public class EnvironmentObserver{
|
||||
enum LabelDrawingLocation{
|
||||
PlayerOffset,
|
||||
HitLocation,
|
||||
IntersectingLength,
|
||||
}
|
||||
|
||||
enum ObserverGizmoDrawingCondition{
|
||||
Always,
|
||||
OnlyActive,
|
||||
Never
|
||||
}
|
||||
|
||||
public enum CastType{
|
||||
Ray,
|
||||
BoxOverlap,
|
||||
SphereOverlap,
|
||||
BoxCast,
|
||||
SphereCast
|
||||
}
|
||||
|
||||
[PropertySpace(0, 5), LabelWidth(60)]
|
||||
public string label;
|
||||
[PropertySpace(0, 10), LabelWidth(60)]
|
||||
public CastType castType;
|
||||
|
||||
[Button(ButtonSizes.Large), GUIColor("@GetObserverStatusColorStatic(active, hit)"), PropertyOrder(-1), PropertySpace(5, 5)]
|
||||
public void Active(){
|
||||
active = !active;
|
||||
}
|
||||
|
||||
[HideInInspector]
|
||||
public bool active;
|
||||
|
||||
// Parameters for Cast cast types
|
||||
[FoldoutGroup("Settings")] public float length;
|
||||
[FoldoutGroup("Settings")] public Vector3 direction;
|
||||
[FoldoutGroup("Settings")] public Vector3 offset;
|
||||
[PropertySpace(0, 5), FoldoutGroup("Settings")] public LayerMask ignoreLayers = ~0;
|
||||
|
||||
[ShowIfGroup("Settings/CastsOnly", VisibleIf = "@castType == CastType.SphereCast || castType == CastType.SphereOverlap")]
|
||||
[FoldoutGroup("Settings")] public float width;
|
||||
|
||||
// Parameters for Overlap cast types
|
||||
[ShowIfGroup("Settings/3DOnly", VisibleIf = "@castType == CastType.BoxCast && castType != CastType.BoxOverlap")] [FoldoutGroup("Settings")]
|
||||
public Vector3 size;
|
||||
|
||||
[ShowIfGroup("Settings/3DOnly")]
|
||||
public Vector3 rotation;
|
||||
|
||||
[HideInInspector]
|
||||
public RaycastHit hit;
|
||||
|
||||
[HideInInspector]
|
||||
public Collider[] overlapHits;
|
||||
|
||||
[FoldoutGroup("Text")]
|
||||
[BoxGroup("Text/Label")] public bool drawLabel;
|
||||
[ShowInInspector, SerializeField] [BoxGroup("Text/Label")] LabelDrawingLocation labelTextLocation;
|
||||
[BoxGroup("Text/Label")] public float labelSize;
|
||||
[BoxGroup("Text/Label")] public Vector3 labelLocationOffset;
|
||||
[BoxGroup("Text/Label")] public Vector3 labelRotationOffset;
|
||||
|
||||
[BoxGroup("Text/Hit")] public bool drawHitName;
|
||||
[ShowInInspector, SerializeField] [BoxGroup("Text/Hit")] LabelDrawingLocation hitTextLocation;
|
||||
[BoxGroup("Text/Hit")] public float hitTextSize;
|
||||
[BoxGroup("Text/Hit")] public Vector3 hitLocationOffset;
|
||||
[BoxGroup("Text/Hit")] public Vector3 hitRotationOffset;
|
||||
[FoldoutGroup("Text"), SerializeField, ShowInInspector] ObserverGizmoDrawingCondition gizmoDrawingCondition;
|
||||
|
||||
[SerializeReference, PropertySpace(5, 5)]
|
||||
public List<EnvironmentObserver> children;
|
||||
|
||||
// NOTE: I had a ref for a RaycastHit here that would correspond to hit but idk if it's needed.
|
||||
public bool Evaluate(GameObject source){
|
||||
if (active) {
|
||||
// Remove player's layer from LayerMask.
|
||||
ignoreLayers -= source.layer;
|
||||
|
||||
// Set some of the variables used later during casting
|
||||
Vector3 relativeStart = source.transform.position + offset;
|
||||
Vector3 relativeStartWithRotation = source.transform.position + source.transform.rotation * offset ;
|
||||
|
||||
switch (castType) {
|
||||
case CastType.Ray:
|
||||
Physics.Raycast(relativeStart, source.transform.rotation * direction, out hit, length, ignoreLayers);
|
||||
break;
|
||||
case CastType.BoxOverlap:
|
||||
overlapHits = Physics.OverlapBox(relativeStartWithRotation, size / 2f,
|
||||
source.transform.rotation * Quaternion.Euler(rotation), ignoreLayers);
|
||||
|
||||
if (overlapHits.Length > 0) {
|
||||
return true;
|
||||
};
|
||||
|
||||
break;
|
||||
case CastType.SphereOverlap:
|
||||
break;
|
||||
case CastType.BoxCast:
|
||||
// TODO: Make this not an if statement. Check that it works with NodeCanvas first
|
||||
if (Physics.BoxCast(relativeStartWithRotation, size / 2f,
|
||||
source.transform.rotation * Quaternion.Euler(rotation) * direction,
|
||||
out hit, source.transform.rotation * Quaternion.Euler(rotation), length,
|
||||
ignoreLayers)
|
||||
) {
|
||||
};
|
||||
break;
|
||||
case CastType.SphereCast:
|
||||
// TODO: Make this not an if statement. Check that it works with NodeCanvas first
|
||||
if (Physics.SphereCast(relativeStartWithRotation, width / 2f,
|
||||
source.transform.rotation * Quaternion.Euler(rotation) * direction,
|
||||
out hit, length,
|
||||
ignoreLayers)
|
||||
) {
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
if (hit.transform != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DrawObserverGizmo(GameObject source, bool drawAnyways = false){
|
||||
if (!drawAnyways){
|
||||
if (gizmoDrawingCondition == ObserverGizmoDrawingCondition.Never || (gizmoDrawingCondition == ObserverGizmoDrawingCondition.OnlyActive ! & active)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3 relativeStart = source.transform.position + offset;
|
||||
Vector3 relativeStartWithRotation = source.transform.position + source.transform.rotation * (offset);
|
||||
|
||||
// Setup the variables for boxcast, spherecast, etc
|
||||
// Create an offset start point for the center of the wirebox, since gizmos are drawn with their pivot in the center.
|
||||
Vector3 offsetWithRotationAndLength = (Quaternion.LookRotation(direction) * Quaternion.Euler(rotation)) * (Vector3.forward * (length / 2));
|
||||
Vector3 offsetFromCenter = relativeStartWithRotation + source.transform.rotation * offsetWithRotationAndLength;
|
||||
|
||||
// Also create a rotation for use with the gizmos. Mainly just to shorten the lines
|
||||
Quaternion gizmosRotation = source.transform.rotation * Quaternion.LookRotation(direction) * Quaternion.Euler(rotation);
|
||||
Vector3 firstBoxOffset = gizmosRotation * (Vector3.forward * size.z);
|
||||
|
||||
Color gizmoColor = Evaluate(source) ? Color.green : Color.red;
|
||||
gizmoColor = active ? gizmoColor : Color.gray;
|
||||
|
||||
using (Draw.ingame.WithColor(gizmoColor)){
|
||||
switch (castType) {
|
||||
case CastType.Ray:
|
||||
Draw.ingame.Line(relativeStart, relativeStart + (source.transform.rotation * direction.normalized) * length);
|
||||
break;
|
||||
case CastType.BoxOverlap:
|
||||
Draw.ingame.WireBox(relativeStartWithRotation, source.transform.rotation * Quaternion.Euler(rotation), size);
|
||||
break;
|
||||
case CastType.SphereCast:
|
||||
Draw.ingame.SolidCircle(relativeStartWithRotation, relativeStartWithRotation - Camera.main.transform.position, width * 1, gizmoColor.Alpha(.5f));
|
||||
Draw.ingame.WireCapsule(relativeStartWithRotation, relativeStartWithRotation + gizmosRotation * (Vector3.forward * (length - width / 2)), width);
|
||||
break;
|
||||
case CastType.BoxCast:
|
||||
// Draw the gizmos for the boxcast
|
||||
Draw.ingame.WireBox(offsetFromCenter, gizmosRotation, new float3(size.x, size.y, length));
|
||||
Draw.ingame.SolidBox(relativeStartWithRotation, gizmosRotation, size, gizmoColor.Alpha(.1f));
|
||||
|
||||
Draw.ingame.WireBox(relativeStartWithRotation, gizmosRotation, size);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
Draw.ingame.SolidCircle(relativeStartWithRotation, relativeStartWithRotation - Camera.main.transform.position, .4f);
|
||||
Draw.ingame.SolidCircle(hit.point, hit.point - Camera.main.transform.position, .4f);
|
||||
|
||||
// Set up variables for label (not hit name)
|
||||
Vector3 labelStartPos = Vector3.zero;
|
||||
switch (labelTextLocation) {
|
||||
case LabelDrawingLocation.PlayerOffset:
|
||||
labelStartPos = source.transform.position;
|
||||
break;
|
||||
case LabelDrawingLocation.IntersectingLength:
|
||||
labelStartPos = offsetFromCenter;
|
||||
break;
|
||||
case LabelDrawingLocation.HitLocation:{
|
||||
if (hit.transform != null) {
|
||||
labelStartPos = hit.point;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw label
|
||||
if (drawLabel) {
|
||||
Draw.ingame.Label3D(
|
||||
labelStartPos + labelLocationOffset,
|
||||
gizmosRotation * Quaternion.Euler(labelRotationOffset),
|
||||
label,
|
||||
labelSize,
|
||||
LabelAlignment.MiddleLeft,
|
||||
gizmoColor
|
||||
);
|
||||
}
|
||||
|
||||
// Set up variables for hit name
|
||||
// Since the label is already drawn just use the previous startPos
|
||||
switch (labelTextLocation) {
|
||||
case LabelDrawingLocation.PlayerOffset:
|
||||
labelStartPos = source.transform.position;
|
||||
break;
|
||||
case LabelDrawingLocation.IntersectingLength:
|
||||
labelStartPos = offsetFromCenter;
|
||||
break;
|
||||
case LabelDrawingLocation.HitLocation:{
|
||||
if (hit.transform != null) {
|
||||
labelStartPos = hit.point;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw hitname
|
||||
if (drawLabel) {
|
||||
Draw.ingame.Label3D(
|
||||
labelStartPos + labelLocationOffset,
|
||||
gizmosRotation * Quaternion.Euler(labelRotationOffset),
|
||||
label,
|
||||
hitTextSize,
|
||||
LabelAlignment.MiddleLeft,
|
||||
gizmoColor
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Color GetObserverStatusColorStatic(bool active, RaycastHit hit){
|
||||
if (active) {
|
||||
if (hit.Equals(default(RaycastHit))) {
|
||||
return Color.green;
|
||||
}
|
||||
|
||||
return Color.red;
|
||||
}
|
||||
|
||||
return Color.gray;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerEnvironmentManager : MonoBehaviour{
|
||||
[OdinSerialize]
|
||||
public List<EnvironmentObserver> observers;
|
||||
|
||||
void Start(){
|
||||
CheckDuplicateLabels(observers);
|
||||
}
|
||||
|
||||
// TODO: Not working.
|
||||
void CheckDuplicateLabels(List<EnvironmentObserver> sourceList){
|
||||
foreach (EnvironmentObserver sourceObserver in observers) {
|
||||
foreach (EnvironmentObserver observer in sourceList) {
|
||||
if (sourceObserver == observer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sourceObserver.label == observer.label) {
|
||||
Debug.LogError($"Duplicate label found in observer: {observer.label} is in use multiple times");
|
||||
}
|
||||
|
||||
if (observer.children != null && observer.children.Count > 0) {
|
||||
CheckDuplicateLabels(observer.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool EvaluateFromString(string searchLabel, List<EnvironmentObserver> observerList = null){
|
||||
List<EnvironmentObserver> listToUse = observers;
|
||||
|
||||
if (observerList != null) {
|
||||
listToUse = observerList;
|
||||
}
|
||||
|
||||
foreach (EnvironmentObserver observer in listToUse) {
|
||||
if (observer.label == searchLabel) {
|
||||
return observer.Evaluate(gameObject);
|
||||
}
|
||||
|
||||
if (observer.children != null && observer.children.Count > 0) {
|
||||
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||
EvaluateFromString(searchLabel, childObserver.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public EnvironmentObserver FindObserverFromString(string searchLabel, List<EnvironmentObserver> observerList = null){
|
||||
List<EnvironmentObserver> listToUse = observers;
|
||||
|
||||
if (observerList != null) {
|
||||
listToUse = observerList;
|
||||
}
|
||||
|
||||
foreach (EnvironmentObserver observer in listToUse) {
|
||||
if (observer.label == searchLabel) {
|
||||
return observer;
|
||||
}
|
||||
|
||||
if (observer.children != null && observer.children.Count > 0) {
|
||||
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||
FindObserverFromString(searchLabel, childObserver.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
void Update(){
|
||||
}
|
||||
|
||||
void LateUpdate(){
|
||||
// Draw Gizmos
|
||||
foreach (EnvironmentObserver observer in observers) {
|
||||
observer.DrawObserverGizmo(gameObject);
|
||||
|
||||
if (observer.children != null && observer.children.Count > 0) {
|
||||
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||
childObserver.DrawObserverGizmo(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear hit
|
||||
foreach (EnvironmentObserver observer in observers) {
|
||||
observer.hit = default;
|
||||
|
||||
if (observer.children != null && observer.children.Count > 0) {
|
||||
foreach (EnvironmentObserver childObserver in observer.children) {
|
||||
childObserver.hit = default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Player/PlayerEnvironmentManager.cs.meta
Normal file
2
Assets/Scripts/Player/PlayerEnvironmentManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a8c0593fef54844383c2f154cf8806c
|
||||
@@ -15,42 +15,42 @@ public class PlayerMovement : MonoBehaviour
|
||||
thisPlayer = GetComponent<Player>();
|
||||
}
|
||||
|
||||
void Update(){
|
||||
// Create Ray Colors
|
||||
Color forwardRayStatus = Color.red;
|
||||
Color leftRayStatus = Color.red;
|
||||
Color rightRayStatus = Color.red;
|
||||
|
||||
if (forwardRay.collider&& forwardRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ forwardRayStatus = Color.green;}
|
||||
if (leftRay.collider&& leftRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ leftRayStatus = Color.green;}
|
||||
if (rightRay.collider&& rightRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ rightRayStatus = Color.green;}
|
||||
|
||||
using (Draw.WithColor(forwardRayStatus)) {
|
||||
Draw.Line(transform.position + transform.up, transform.position + transform.forward * 2.5f + transform.up);
|
||||
}
|
||||
// void Update(){
|
||||
// // Create Ray Colors
|
||||
// Color forwardRayStatus = Color.red;
|
||||
// Color leftRayStatus = Color.red;
|
||||
// Color rightRayStatus = Color.red;
|
||||
//
|
||||
// if (forwardRay.collider&& forwardRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ forwardRayStatus = Color.green;}
|
||||
// if (leftRay.collider&& leftRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ leftRayStatus = Color.green;}
|
||||
// if (rightRay.collider&& rightRay.transform.gameObject.layer == LayerMask.NameToLayer("Environment")){ rightRayStatus = Color.green;}
|
||||
//
|
||||
// using (Draw.WithColor(forwardRayStatus)) {
|
||||
// Draw.Line(transform.position + transform.up, transform.position + transform.forward * 2.5f + transform.up);
|
||||
// }
|
||||
//
|
||||
// using (Draw.WithColor(leftRayStatus)) {
|
||||
// Draw.Line(transform.position + transform.up, transform.position + -transform.right * 2f + transform.up);
|
||||
// }
|
||||
//
|
||||
// using (Draw.WithColor(rightRayStatus)) {
|
||||
// Draw.Line(transform.position + transform.up, transform.position + transform.right * 2f + transform.up);
|
||||
// }
|
||||
// }
|
||||
|
||||
using (Draw.WithColor(leftRayStatus)) {
|
||||
Draw.Line(transform.position + transform.up, transform.position + -transform.right * 2f + transform.up);
|
||||
}
|
||||
|
||||
using (Draw.WithColor(rightRayStatus)) {
|
||||
Draw.Line(transform.position + transform.up, transform.position + transform.right * 2f + transform.up);
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
LayerMask environmentLayer = LayerMask.NameToLayer("Environment");
|
||||
|
||||
if (Physics.Raycast(transform.position + Vector3.up, transform.forward, out forwardRay, 2.5f, ~environmentLayer)){
|
||||
thisPlayer.controls.graph.SendEvent("ForwardRay", true, null);
|
||||
}
|
||||
|
||||
if (Physics.Raycast(transform.position + Vector3.up, transform.position + Vector3.left, out leftRay, maxDistance: 2f, ~environmentLayer )) {
|
||||
thisPlayer.controls.graph.SendEvent("LeftRay", true, null);
|
||||
}
|
||||
|
||||
if (Physics.Raycast(transform.position + Vector3.up, transform.position + Vector3.right, out rightRay, maxDistance: 2f, ~environmentLayer )) {
|
||||
thisPlayer.controls.graph.SendEvent("RightRay", true, null);
|
||||
}
|
||||
}
|
||||
// void FixedUpdate(){
|
||||
// LayerMask environmentLayer = LayerMask.NameToLayer("Environment");
|
||||
//
|
||||
// if (Physics.Raycast(transform.position + Vector3.up, transform.forward, out forwardRay, 2.5f, ~environmentLayer)){
|
||||
// thisPlayer.controls.graph.SendEvent("ForwardRay", true, null);
|
||||
// }
|
||||
//
|
||||
// if (Physics.Raycast(transform.position + Vector3.up, transform.position + Vector3.left, out leftRay, maxDistance: 2f, ~environmentLayer )) {
|
||||
// thisPlayer.controls.graph.SendEvent("LeftRay", true, null);
|
||||
// }
|
||||
//
|
||||
// if (Physics.Raycast(transform.position + Vector3.up, transform.position + Vector3.right, out rightRay, maxDistance: 2f, ~environmentLayer )) {
|
||||
// thisPlayer.controls.graph.SendEvent("RightRay", true, null);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"GUID:de4e6084e6d474788bb8c799d6b461ec",
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||
"GUID:4307f53044263cf4b835bd812fc161a4",
|
||||
"GUID:4099e5319e98558428028d54bc62664e",
|
||||
"GUID:e0cd26848372d4e5c891c569017e11f1",
|
||||
"GUID:1826c0224c0d048b88112c79bbb0cd85"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4be9f6fb652f19488b46fbc9bac8be5
|
||||
guid: 09610894297ae74449b37191945069ff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
116
Assets/Scripts/World/WorldGenerator.cs
Normal file
116
Assets/Scripts/World/WorldGenerator.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine.ProBuilder;
|
||||
using UnityEngine.ProBuilder.MeshOperations;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class WorldGenerator : MonoBehaviour{
|
||||
public Vector2 worldSize;
|
||||
|
||||
public int platformCount;
|
||||
|
||||
[MinMaxSlider(1f, 100f)]
|
||||
public Vector2 platformHeightRange;
|
||||
[MinMaxSlider(25f, 300f)]
|
||||
public Vector2 platformWidthRange;
|
||||
|
||||
[Header("Mega Platforms")]
|
||||
public int megaPlatformCount;
|
||||
[MinMaxSlider(30f, 100f)]
|
||||
public Vector2 megaPlatformtHeightRange = new Vector2(20, 20);
|
||||
[MinMaxSlider(250f, 500f)]
|
||||
public Vector2 megaPlatformWidthRange = new Vector2(50, 50);
|
||||
|
||||
private List<GameObject> allPlatforms = new List<GameObject>();
|
||||
private List<GameObject> megaPlatforms = new List<GameObject>();
|
||||
|
||||
void Start(){
|
||||
GenerateWorld();
|
||||
}
|
||||
|
||||
[Button]
|
||||
public void RegenerateWorld(){
|
||||
ClearWorld();
|
||||
GenerateWorld();
|
||||
}
|
||||
|
||||
void ClearWorld(){
|
||||
allPlatforms.ForEach(Destroy);
|
||||
}
|
||||
|
||||
void GenerateWorld(){
|
||||
GenerateMegaPlatforms();
|
||||
GenerateStandardPlatforms();
|
||||
}
|
||||
|
||||
void GenerateMegaPlatforms(){
|
||||
for (int i = 0; i < megaPlatformCount; i++) {
|
||||
Vector3 newPlatformSize = new Vector3(
|
||||
Random.Range(megaPlatformWidthRange.x, megaPlatformWidthRange.y),
|
||||
Random.Range(megaPlatformtHeightRange.x, megaPlatformtHeightRange.y),
|
||||
Random.Range(megaPlatformWidthRange.x, megaPlatformWidthRange.y)
|
||||
);
|
||||
|
||||
var newPlatform = ShapeGenerator.GenerateCube(PivotLocation.Center, newPlatformSize);
|
||||
|
||||
newPlatform.SetMaterial(newPlatform.faces, BuiltinMaterials.defaultMaterial);
|
||||
newPlatform.gameObject.AddComponent<BoxCollider>();
|
||||
|
||||
newPlatform.transform.position = new Vector3(
|
||||
Random.Range(-worldSize.x, worldSize.x),
|
||||
newPlatformSize.y / 2f,
|
||||
Random.Range(-worldSize.y, worldSize.y)
|
||||
);
|
||||
|
||||
newPlatform.gameObject.name = "Megaplatform";
|
||||
|
||||
megaPlatforms.Add(newPlatform.gameObject);
|
||||
allPlatforms.Add(newPlatform.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateStandardPlatforms(){
|
||||
for (int i = 0; i < platformCount; i++) {
|
||||
Vector3 newPlatformSize = new Vector3(
|
||||
Random.Range(platformWidthRange.x, platformWidthRange.y),
|
||||
Random.Range(platformHeightRange.x, platformHeightRange.y),
|
||||
Random.Range(platformWidthRange.x, platformWidthRange.y)
|
||||
);
|
||||
|
||||
var newPlatform = ShapeGenerator.GenerateCube(PivotLocation.Center, newPlatformSize);
|
||||
newPlatform.gameObject.layer = 2;
|
||||
|
||||
newPlatform.SetMaterial(newPlatform.faces, BuiltinMaterials.defaultMaterial);
|
||||
|
||||
Vector3 newPlatformPosXZ = new Vector3(
|
||||
Random.Range(-worldSize.x, worldSize.x),
|
||||
350f,
|
||||
Random.Range(-worldSize.y, worldSize.y)
|
||||
);
|
||||
|
||||
|
||||
Physics.Raycast(newPlatformPosXZ, Vector3.down, out RaycastHit hit, Mathf.Infinity, LayerMask.GetMask("Default"));
|
||||
|
||||
Debug.Log(hit.collider.name);
|
||||
|
||||
newPlatform.transform.position = new Vector3(
|
||||
newPlatformPosXZ.x,
|
||||
hit.point.y + newPlatformSize.y /2f,
|
||||
newPlatformPosXZ.z
|
||||
);
|
||||
|
||||
newPlatform.gameObject.name = "Platform";
|
||||
|
||||
// newPlatform.gameObject.AddComponent<BoxCollider>();
|
||||
allPlatforms.Add(newPlatform.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/World/WorldGenerator.cs.meta
Normal file
2
Assets/Scripts/World/WorldGenerator.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f48f68f001ea2ca4b89207ff5b4960a9
|
||||
@@ -17,7 +17,7 @@ MonoBehaviour:
|
||||
lineOpacity: 1
|
||||
solidOpacity: 0.55
|
||||
textOpacity: 1
|
||||
lineOpacityBehindObjects: 0.12
|
||||
solidOpacityBehindObjects: 0.45
|
||||
textOpacityBehindObjects: 0.9
|
||||
lineOpacityBehindObjects: 0.3186
|
||||
solidOpacityBehindObjects: 0.1286
|
||||
textOpacityBehindObjects: 0.0881
|
||||
curveResolution: 1
|
||||
|
||||
@@ -1,252 +0,0 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 0
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 2
|
||||
m_BakeResolution: 40
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 0
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 1
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 2
|
||||
m_BakeBackend: 1
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 512
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 256
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRDenoiserTypeDirect: 1
|
||||
m_PVRDenoiserTypeIndirect: 1
|
||||
m_PVRDenoiserTypeAO: 1
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 1
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666667
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &869075708
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 869075710}
|
||||
- component: {fileID: 869075709}
|
||||
m_Layer: 0
|
||||
m_Name: Example
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &869075709
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 869075708}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f0f4fc589d3160f4197a6ec70bab0925, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
info: Hover over slider to see tooltip
|
||||
floatTest: {x: 2, y: 8}
|
||||
intTest: {x: 0, y: 0}
|
||||
--- !u!4 &869075710
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 869075708}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1410662703
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1410662706}
|
||||
- component: {fileID: 1410662705}
|
||||
- component: {fileID: 1410662704}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &1410662704
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1410662703}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &1410662705
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1410662703}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.58219117, g: 0.8396226, b: 0.82838553, a: 0}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 1
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 1
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &1410662706
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1410662703}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b58f02022de16354ba42b835bcc79d57
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,108 +0,0 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using GD.MinMaxSlider;
|
||||
|
||||
[CustomPropertyDrawer(typeof(MinMaxSliderAttribute))]
|
||||
public class MinMaxSliderDrawer : PropertyDrawer {
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label){
|
||||
|
||||
var minMaxAttribute = (MinMaxSliderAttribute)attribute;
|
||||
var propertyType = property.propertyType;
|
||||
|
||||
label.tooltip = minMaxAttribute.min.ToString("F2") + " to " + minMaxAttribute.max.ToString("F2");
|
||||
|
||||
//PrefixLabel returns the rect of the right part of the control. It leaves out the label section. We don't have to worry about it. Nice!
|
||||
Rect controlRect = EditorGUI.PrefixLabel(position, label);
|
||||
|
||||
Rect[] splittedRect = SplitRect(controlRect,3);
|
||||
|
||||
if(propertyType == SerializedPropertyType.Vector2){
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
Vector2 vector = property.vector2Value;
|
||||
float minVal = vector.x;
|
||||
float maxVal = vector.y;
|
||||
|
||||
//F2 limits the float to two decimal places (0.00).
|
||||
minVal = EditorGUI.FloatField(splittedRect[0], float.Parse(minVal.ToString("F2")));
|
||||
maxVal = EditorGUI.FloatField(splittedRect[2], float.Parse(maxVal.ToString("F2")));
|
||||
|
||||
EditorGUI.MinMaxSlider(splittedRect[1], ref minVal, ref maxVal,
|
||||
minMaxAttribute.min,minMaxAttribute.max);
|
||||
|
||||
if(minVal < minMaxAttribute.min){
|
||||
minVal = minMaxAttribute.min;
|
||||
}
|
||||
|
||||
if(maxVal > minMaxAttribute.max){
|
||||
maxVal = minMaxAttribute.max;
|
||||
}
|
||||
|
||||
vector = new Vector2(minVal > maxVal ? maxVal : minVal, maxVal);
|
||||
|
||||
if(EditorGUI.EndChangeCheck()){
|
||||
property.vector2Value = vector;
|
||||
}
|
||||
|
||||
}else if(propertyType == SerializedPropertyType.Vector2Int){
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
Vector2Int vector = property.vector2IntValue;
|
||||
float minVal = vector.x;
|
||||
float maxVal = vector.y;
|
||||
|
||||
minVal = EditorGUI.FloatField(splittedRect[0], minVal);
|
||||
maxVal = EditorGUI.FloatField(splittedRect[2], maxVal);
|
||||
|
||||
EditorGUI.MinMaxSlider(splittedRect[1], ref minVal, ref maxVal,
|
||||
minMaxAttribute.min,minMaxAttribute.max);
|
||||
|
||||
if(minVal < minMaxAttribute.min){
|
||||
maxVal = minMaxAttribute.min;
|
||||
}
|
||||
|
||||
if(minVal > minMaxAttribute.max){
|
||||
maxVal = minMaxAttribute.max;
|
||||
}
|
||||
|
||||
vector = new Vector2Int(Mathf.FloorToInt(minVal > maxVal ? maxVal : minVal), Mathf.FloorToInt(maxVal));
|
||||
|
||||
if(EditorGUI.EndChangeCheck()){
|
||||
property.vector2IntValue = vector;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rect[] SplitRect(Rect rectToSplit, int n){
|
||||
|
||||
|
||||
Rect[] rects = new Rect[n];
|
||||
|
||||
for(int i = 0; i < n; i++){
|
||||
|
||||
rects[i] = new Rect(rectToSplit.position.x + (i * rectToSplit.width / n), rectToSplit.position.y, rectToSplit.width / n, rectToSplit.height);
|
||||
|
||||
}
|
||||
|
||||
int padding = (int)rects[0].width - 40;
|
||||
int space = 5;
|
||||
|
||||
rects[0].width -= padding + space;
|
||||
rects[2].width -= padding + space;
|
||||
|
||||
rects[1].x -= padding;
|
||||
rects[1].width += padding * 2;
|
||||
|
||||
rects[2].x += padding + space;
|
||||
|
||||
|
||||
return rects;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6b53f69308943e499e344adc5adee79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace GD.MinMaxSlider
|
||||
{
|
||||
using UnityEngine;
|
||||
|
||||
public class MinMaxSliderAttribute : PropertyAttribute{
|
||||
|
||||
public float min;
|
||||
public float max;
|
||||
|
||||
public MinMaxSliderAttribute(float min, float max)
|
||||
{
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a090d8b694abe7141af9c000b8cf42ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,16 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using GD.MinMaxSlider;
|
||||
|
||||
public class MinMaxSliderExample : MonoBehaviour
|
||||
{
|
||||
|
||||
public string info = "Hover over a slider to see a tooltip";
|
||||
|
||||
[MinMaxSlider(0,10)]
|
||||
public Vector2 floatRange = new Vector2(2,8);
|
||||
[MinMaxSlider(0,10)]
|
||||
public Vector2Int intRange = new Vector2Int(1,5);
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 212a7a761531d4b48ae374e583db2389
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"name": "SimpleMinMaxSlider"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4099e5319e98558428028d54bc62664e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"name": "com.guciodevs.simple-min-max-slider",
|
||||
"displayName": "Simple MinMax Slider",
|
||||
"description": "Handy small package that adds a simple MinMaxSlider attribute.",
|
||||
"version": "1.1.2",
|
||||
"unity": "2018.3",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
},
|
||||
|
||||
"samples": [
|
||||
|
||||
{
|
||||
|
||||
"displayName": "Example Scene",
|
||||
|
||||
"description": "",
|
||||
|
||||
"path": "Samples~/SimpleMinMaxSlider Example"
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 783853a57374ff540b56fa85ce900da7
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/SinMovement.cs
Normal file
20
Assets/SinMovement.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SinMovement : MonoBehaviour{
|
||||
private float originalY;
|
||||
|
||||
public float speed;
|
||||
public float scale;
|
||||
|
||||
public float offset;
|
||||
|
||||
void Start(){
|
||||
originalY = transform.position.y;
|
||||
offset += Random.Range(-1, 1);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
transform.position = transform.position.Flatten(null, originalY + Mathf.Sin((Time.time + offset) * speed) * scale, null);
|
||||
}
|
||||
}
|
||||
2
Assets/SinMovement.cs.meta
Normal file
2
Assets/SinMovement.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e33277577aa379a41a747f01aade9c96
|
||||
25
Assets/SwayMovement.cs
Normal file
25
Assets/SwayMovement.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SwayMovement : MonoBehaviour{
|
||||
Vector3 originalRot;
|
||||
public Vector3 swayAmount;
|
||||
public Vector3 swaySpeed;
|
||||
|
||||
private Vector3 offset;
|
||||
|
||||
void Start(){
|
||||
originalRot = transform.rotation.eulerAngles;
|
||||
offset = new Vector3(Random.Range(-5, 1), Random.Range(-1, 5), Random.Range(-3, 1));
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
Vector3 sway = new Vector3(
|
||||
originalRot.x + Mathf.Sin((Time.time + offset.x) * swaySpeed.x) * swayAmount.x,
|
||||
originalRot.y + Mathf.Sin((Time.time + offset.y) * swaySpeed.y) * swayAmount.y,
|
||||
originalRot.z + Mathf.Sin((Time.time + offset.z) * swaySpeed.z) * swayAmount.z
|
||||
);
|
||||
|
||||
transform.rotation = Quaternion.Euler(sway);
|
||||
}
|
||||
}
|
||||
2
Assets/SwayMovement.cs.meta
Normal file
2
Assets/SwayMovement.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57870c7b66535c74688188df7e771ce7
|
||||
BIN
Documents/Graphics/UI/Icons.afdesign
Normal file
BIN
Documents/Graphics/UI/Icons.afdesign
Normal file
Binary file not shown.
@@ -124,7 +124,7 @@
|
||||
{
|
||||
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||
"key": "ShapeBuilder.LastSize.Cube",
|
||||
"value": "{\"m_Value\":{\"x\":20.036033630371095,\"y\":1.0208016633987427,\"z\":-17.9393310546875}}"
|
||||
"value": "{\"m_Value\":{\"x\":53.82322311401367,\"y\":3.7740979194641115,\"z\":159.09600830078126}}"
|
||||
},
|
||||
{
|
||||
"type": "UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
|
||||
|
||||
Reference in New Issue
Block a user