浏览代码

Camera rotation, Movement tweaks

Movement now is independent of camera rotation
/main
Ciro Continisio 4 年前
当前提交
ee2cec18
共有 14 个文件被更改,包括 476 次插入414 次删除
  1. 134
      UOP1_Project/Assets/Prefabs/Pig.prefab
  2. 367
      UOP1_Project/Assets/Scenes/CharController.unity
  3. 6
      UOP1_Project/Assets/Scripts/InputReader.cs
  4. 4
      UOP1_Project/Assets/Settings/Graphics/UniversalRP-HighQuality.asset
  5. 2
      UOP1_Project/ProjectSettings/QualitySettings.asset
  6. 30
      UOP1_Project/Assets/Scripts/CameraManager.cs
  7. 11
      UOP1_Project/Assets/Scripts/CameraManager.cs.meta
  8. 8
      UOP1_Project/Assets/Scripts/Characters.meta
  9. 118
      UOP1_Project/Assets/Scripts/Characters/Character.cs
  10. 11
      UOP1_Project/Assets/Scripts/Characters/Character.cs.meta
  11. 64
      UOP1_Project/Assets/Scripts/Characters/Protagonist.cs
  12. 135
      UOP1_Project/Assets/Scripts/Protagonist.cs
  13. 0
      /UOP1_Project/Assets/Scripts/Characters/Protagonist.cs.meta

134
UOP1_Project/Assets/Prefabs/Pig.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &847350330
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 847350331}
m_Layer: 0
m_Name: CastCentreLow
m_TagString: Untagged
m_Icon: {fileID: 7422848464349959988, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &847350331
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 847350330}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.05, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3341179906418240731}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1297158708
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1297158709}
m_Layer: 0
m_Name: CastCentreHigh
m_TagString: Untagged
m_Icon: {fileID: 7422848464349959988, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1297158709
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1297158708}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.35, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3341179906418240731}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1545926751
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1545926752}
m_Layer: 0
m_Name: CastCentreMid
m_TagString: Untagged
m_Icon: {fileID: 7422848464349959988, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1545926752
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1545926751}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.75, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3341179906418240731}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &17773284206894616
GameObject:
m_ObjectHideFlags: 0

m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: -887985806686677572, guid: 2f798bdb0fe94694f99aa4df3dafdd3c, type: 3}
- {fileID: 2100000, guid: 1d7422898f87f524194c0b5cf921fef8, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

serializedVersion: 6
m_Component:
- component: {fileID: 3341179906418240731}
- component: {fileID: 211818859182309264}
- component: {fileID: 3341179906418240730}
- component: {fileID: 3341179907149091245}
m_Layer: 0
m_Name: Pig
m_TagString: Untagged

m_Children:
- {fileID: 7666592673195723235}
- {fileID: 7707384010290273818}
- {fileID: 1297158709}
- {fileID: 1545926752}
- {fileID: 847350331}
--- !u!114 &3341179906418240708
--- !u!114 &211818859182309264
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Name:
m_EditorClassIdentifier:
inputReader: {fileID: 0}
gameplayCamera: {fileID: 0}
--- !u!114 &3341179906418240708
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3341179906418240709}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4eb0e4f8f5e39624ea81504bf968dcce, type: 3}
m_Name:
m_EditorClassIdentifier:
initialJumpForce: 8
initialJumpForce: 10
gravityComebackMultiplier: 15
gravityContributionMultiplier: 0
gravityComebackMultiplier: 15
--- !u!136 &3341179906418240730
CapsuleCollider:
--- !u!143 &3341179907149091245
CharacterController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}

m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 1.5
m_Direction: 1
m_Center: {x: 0, y: 0.75, z: 0}
serializedVersion: 2
m_Height: 1.75
m_Radius: 0.4
m_SlopeLimit: 30
m_StepOffset: 0.3
m_SkinWidth: 0.08
m_MinMoveDistance: 0.001
m_Center: {x: 0, y: 0.875, z: 0}
--- !u!1 &3791421269865525050
GameObject:
m_ObjectHideFlags: 0

367
UOP1_Project/Assets/Scenes/CharController.unity


m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!114 &135922104
MonoBehaviour:
m_ObjectHideFlags: 0

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 135922103}
m_LocalRotation: {x: 0.2439526, y: 0, z: 0, w: 0.9697872}
m_LocalPosition: {x: 0.62, y: 15.43, z: -10.46}
m_LocalRotation: {x: 0.24395259, y: 0, z: 0, w: 0.9697872}
m_LocalPosition: {x: 0.62, y: 5.737, z: -25.886}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &135922106
MonoBehaviour:

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 233317031}
m_LocalRotation: {x: 0.15430355, y: 0.8221575, z: -0.26429933, w: 0.47999302}
m_LocalRotation: {x: 0.16983052, y: -0.206076, z: 0.036342658, w: 0.9630003}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:

m_LocalScale: {x: 5.7737727, y: 1.8967, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 13
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: -3.5180001, y: 26.323002, z: -19.474}
--- !u!1 &353533559
GameObject:

m_LocalScale: {x: 4.8320527, y: 1, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 11
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &358843509
GameObject:

m_LocalScale: {x: 7.8816566, y: 6.5043144, z: 2.0265193}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 24
m_RootOrder: 25
m_LocalEulerAnglesHint: {x: 0, y: 90.00001, z: 0}
--- !u!1001 &393067907
PrefabInstance:

- target: {fileID: 7160299325435046207, guid: fe3004506b4c6cd478eb2cca639b3713,
type: 3}
propertyPath: m_RootOrder
value: 21
value: 22
objectReference: {fileID: 0}
- target: {fileID: 7160299325435046207, guid: fe3004506b4c6cd478eb2cca639b3713,
type: 3}

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &526256409
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 526256411}
- component: {fileID: 526256410}
m_Layer: 0
m_Name: CameraManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &526256410
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 526256409}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 085156cba0e34b540aeddafe12d1e2f1, type: 3}
m_Name:
m_EditorClassIdentifier:
inputReader: {fileID: 1724036687}
freeLookVCam: {fileID: 1502793901}
--- !u!4 &526256411
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 526256409}
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: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &695792052
GameObject:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &802198071
PrefabInstance:

- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}
propertyPath: m_RootOrder
value: 16
value: 17
objectReference: {fileID: 0}
- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &826602623
GameObject:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &847350330
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 847350331}
m_Layer: 0
m_Name: CastCentreLow
m_TagString: Untagged
m_Icon: {fileID: 7422848464349959988, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &847350331
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 847350330}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.05, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1961901426}
m_RootOrder: 4
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &955504286
GameObject:

m_LocalScale: {x: 4.66705, y: 1, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &982338980
GameObject:

m_LocalScale: {x: 4.66705, y: 1, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 25
m_RootOrder: 26
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 12.259001}
--- !u!1 &1057381576
GameObject:

m_LocalScale: {x: 6.068361, y: 6.5043144, z: 0.65092325}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 23
m_RootOrder: 24
m_LocalEulerAnglesHint: {x: 0, y: -34.734, z: 0}
--- !u!1 &1069143686
GameObject:

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1069947040
GameObject:

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069947040}
m_LocalRotation: {x: 0.17163742, y: 0.8120143, z: -0.29398972, w: 0.47407112}
m_LocalRotation: {x: 0.24938728, y: -0.20233645, z: 0.05336731, w: 0.9455252}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:

- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}
propertyPath: m_RootOrder
value: 17
value: 18
objectReference: {fileID: 0}
- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}

serializedVersion: 2
m_Size: {x: 4.9118204, y: 4.1104574, z: 4.8376255}
m_Center: {x: 0.3429799, y: 2.037253, z: 0.10196686}
--- !u!1 &1297158708
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1297158709}
m_Layer: 0
m_Name: CastCentreHigh
m_TagString: Untagged
m_Icon: {fileID: 7422848464349959988, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1297158709
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1297158708}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.35, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1961901426}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1303725911
GameObject:
m_ObjectHideFlags: 0

m_LocalScale: {x: 9.785265, y: 1.1941, z: 1.4703052}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 12
m_RootOrder: 13
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1424964852
GameObject:

m_LocalScale: {x: 11.689932, y: 6.5043144, z: 2.0265193}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 22
m_RootOrder: 23
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1502793900
GameObject:

m_Component:
- component: {fileID: 1502793902}
- component: {fileID: 1502793901}
- component: {fileID: 1502793903}
m_Layer: 0
m_Name: CM FreeLook1
m_TagString: Untagged

m_IsActive: 0
m_IsActive: 1
--- !u!114 &1502793901
MonoBehaviour:
m_ObjectHideFlags: 0

m_YAxis:
Value: 0.5
m_SpeedMode: 0
m_MaxSpeed: 2
m_AccelTime: 0.2
m_MaxSpeed: 100
m_AccelTime: 0.5
m_InvertInput: 0
m_InvertInput: 1
m_MinValue: 0
m_MaxValue: 1
m_Wrap: 0

m_XAxis:
Value: 0
m_SpeedMode: 0
m_MaxSpeed: 300
m_AccelTime: 0.1
m_MaxSpeed: 10000
m_AccelTime: 0.5
m_InvertInput: 1
m_InvertInput: 0
m_MinValue: -180
m_MaxValue: 180
m_Wrap: 1

m_BindingMode: 5
m_SplineCurvature: 0.2
m_Orbits:
- m_Height: 4.5
m_Radius: 1.75
- m_Height: 2.5
m_Radius: 3
- m_Height: 0.4
m_Radius: 1.3
- m_Height: 6.72
m_Radius: 9.72
- m_Height: 3.98
m_Radius: 7.02
- m_Height: 1.5
m_Radius: 4.5
m_LegacyHeadingBias: 3.4028235e+38
m_Rigs:
- {fileID: 1069947041}

m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1502793900}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.992473, y: 12.5, z: 1.1247829}
m_LocalPosition: {x: 3.4929113, y: 4.287, z: -22.181215}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1069947042}

m_RootOrder: 5
m_RootOrder: 6
--- !u!114 &1502793903
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1502793900}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e501d18bb52cf8c40b1853ca4904654f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_CollideAgainst:
serializedVersion: 2
m_Bits: 1
m_IgnoreTag:
m_TransparentLayers:
serializedVersion: 2
m_Bits: 0
m_MinimumDistanceFromTarget: 0.1
m_AvoidObstacles: 1
m_DistanceLimit: 0
m_MinimumOcclusionTime: 0
m_CameraRadius: 0.1
m_Strategy: 1
m_MaximumEffort: 4
m_SmoothingTime: 0
m_Damping: 0
m_DampingWhenOccluded: 0
m_OptimalTargetDistance: 0
--- !u!1 &1523164311
GameObject:
m_ObjectHideFlags: 0

m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 27
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1545926751
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1545926752}
m_Layer: 0
m_Name: CastCentreMid
m_TagString: Untagged
m_Icon: {fileID: 7422848464349959988, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1545926752
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1545926751}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0.75, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1961901426}
m_RootOrder: 3
m_RootOrder: 28
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1559010558
GameObject:

m_LocalScale: {x: 4.66705, y: 1, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 26
m_RootOrder: 27
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 12.259001}
--- !u!1 &1567022179
GameObject:

m_LocalScale: {x: 5.7737727, y: 1.8967, z: 4.9019}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 15
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: -3.5180001, y: 26.324001, z: 28.011002}
--- !u!1 &1724036686
GameObject:

- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}
propertyPath: m_RootOrder
value: 20
value: 21
objectReference: {fileID: 0}
- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}

- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}
propertyPath: m_RootOrder
value: 19
value: 20
objectReference: {fileID: 0}
- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}

m_Script: {fileID: 11500000, guid: f4044717213e31446939f7bd49c896ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_TrackedObjectOffset: {x: 0, y: 0, z: 0}
m_TrackedObjectOffset: {x: 0, y: 0.56, z: 0}
m_LookaheadTime: 0
m_LookaheadSmoothing: 0
m_LookaheadIgnoreY: 0

m_Name:
m_EditorClassIdentifier:
m_BindingMode: 5
m_FollowOffset: {x: 0, y: 2.5, z: -3}
m_FollowOffset: {x: 0, y: 3.98, z: -7.02}
m_XDamping: 1
m_YDamping: 1
m_ZDamping: 1

y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
near clip plane: 0.1
far clip plane: 5000
field of view: 40
orthographic: 0
orthographic size: 5
m_Depth: -1

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1961065787}
m_LocalRotation: {x: 0.2439526, y: 0, z: 0, w: 0.9697872}
m_LocalPosition: {x: 0.62, y: 15.43, z: -10.46}
m_LocalRotation: {x: 0.20238979, y: -0.20472492, z: 0.043310117, w: 0.95668715}
m_LocalPosition: {x: 3.4929113, y: 4.287, z: -22.181215}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1961065791
MonoBehaviour:

m_Script: {fileID: 11500000, guid: f4044717213e31446939f7bd49c896ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_TrackedObjectOffset: {x: 0, y: 0, z: 0}
m_TrackedObjectOffset: {x: 0, y: 0.83, z: 0}
m_LookaheadTime: 0
m_LookaheadSmoothing: 0
m_LookaheadIgnoreY: 0

m_Name:
m_EditorClassIdentifier:
m_BindingMode: 5
m_FollowOffset: {x: 0, y: 2.5, z: -3}
m_FollowOffset: {x: 0, y: 3.98, z: -7.02}
m_XDamping: 1
m_YDamping: 1
m_ZDamping: 1

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2049112419}
m_LocalRotation: {x: 0.1629859, y: 0.8172275, z: -0.27917093, w: 0.47711474}
m_LocalRotation: {x: 0.20238975, y: -0.20472495, z: 0.04331012, w: 0.95668715}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:

m_Name:
m_EditorClassIdentifier:
m_BindingMode: 5
m_FollowOffset: {x: 0, y: 2.5, z: -3}
m_FollowOffset: {x: 0, y: 3.98, z: -7.02}
m_XDamping: 1
m_YDamping: 1
m_ZDamping: 1

- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}
propertyPath: m_RootOrder
value: 14
value: 15
objectReference: {fileID: 0}
- target: {fileID: 384383464925863578, guid: 1ebb75c12ef91014e94524019e01192d,
type: 3}

m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
- target: {fileID: 211818859182309264, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: jumpStrength
value: 5
objectReference: {fileID: 0}
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: airMomentumMultiplier
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: castCentre
value:
objectReference: {fileID: 847350331}
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: castCentreLow
value:
objectReference: {fileID: 847350331}
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: castCentreHigh
value:
objectReference: {fileID: 1297158709}
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
- target: {fileID: 211818859182309264, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
propertyPath: castCentreMid
propertyPath: gameplayCamera
objectReference: {fileID: 1545926752}
- target: {fileID: 3341179906418240708, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: jumpMultiplier
value: 5
objectReference: {fileID: 0}
objectReference: {fileID: 1961065790}
- target: {fileID: 3341179906418240730, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_Material
value:
objectReference: {fileID: 13400000, guid: a16d1d43f142a5e46bd94366df8b3456,
type: 2}
- target: {fileID: 3341179906418240730, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3341179906418240730, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_Radius
value: 0.4
objectReference: {fileID: 0}
- target: {fileID: 3341179906418240731, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_LocalPosition.x

type: 3}
propertyPath: m_LocalPosition.y
value: 10
value: 0.307
value: -0.35
value: -15.776
objectReference: {fileID: 0}
- target: {fileID: 3341179906418240731, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}

- target: {fileID: 3341179906418240731, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_RootOrder
value: 28
value: 29
objectReference: {fileID: 0}
- target: {fileID: 3341179906418240731, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8355259865850373509, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 1d7422898f87f524194c0b5cf921fef8, type: 2}
--- !u!1 &3341179907149091244 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3341179906418240709, guid: 0fa393e1e37bc9e4e829c25a9452bcd3,
type: 3}
m_PrefabInstance: {fileID: 3341179907149091243}
m_PrefabAsset: {fileID: 0}
--- !u!143 &3341179907149091245
CharacterController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3341179907149091244}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Height: 1.75
m_Radius: 0.4
m_SlopeLimit: 30
m_StepOffset: 0.3
m_SkinWidth: 0.08
m_MinMoveDistance: 0.001
m_Center: {x: 0, y: 0.875, z: 0}
--- !u!1001 &6560919939139749480
PrefabInstance:
m_ObjectHideFlags: 0

- target: {fileID: 7160299325435046207, guid: fe3004506b4c6cd478eb2cca639b3713,
type: 3}
propertyPath: m_RootOrder
value: 18
value: 19
objectReference: {fileID: 0}
- target: {fileID: 7160299325435046207, guid: fe3004506b4c6cd478eb2cca639b3713,
type: 3}

6
UOP1_Project/Assets/Scripts/InputReader.cs


gameInput.Gameplay.SetCallbacks(this);
}
gameInput.Gameplay.Enable();
//Debug.Log("I'm enabled");
}
private void OnDisable()

{
if(moveEvent != null)
{
//Debug.Log("Move Event " + context.phase + " value " + context.ReadValue<Vector2>());
moveEvent.Invoke(context.ReadValue<Vector2>());
}
}

public void OnRotateCamera(InputAction.CallbackContext context)
{
if(cameraMoveEvent != null
&& context.phase == InputActionPhase.Performed)
if(cameraMoveEvent != null)
{
cameraMoveEvent.Invoke(context.ReadValue<Vector2>());
}

4
UOP1_Project/Assets/Settings/Graphics/UniversalRP-HighQuality.asset


m_RenderScale: 1
m_MainLightRenderingMode: 1
m_MainLightShadowsSupported: 1
m_MainLightShadowmapResolution: 512
m_MainLightShadowmapResolution: 2048
m_ShadowCascades: 1
m_ShadowCascades: 2
m_Cascade2Split: 0.25
m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467}
m_ShadowDepthBias: 1

2
UOP1_Project/ProjectSettings/QualitySettings.asset


skinWeights: 2
textureQuality: 0
anisotropicTextures: 1
antiAliasing: 2
antiAliasing: 0
softParticles: 0
softVegetation: 1
realtimeReflectionProbes: 1

30
UOP1_Project/Assets/Scripts/CameraManager.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
using System;
public class CameraManager : MonoBehaviour
{
public InputReader inputReader;
public CinemachineFreeLook freeLookVCam;
private void OnEnable()
{
inputReader.cameraMoveEvent += OnCameraMove;
//...
}
//Removes all listeners to the events coming from the InputReader script
private void OnDisable()
{
inputReader.cameraMoveEvent -= OnCameraMove;
//...
}
private void OnCameraMove(Vector2 cameraMovement)
{
freeLookVCam.m_XAxis.m_InputAxisValue = cameraMovement.x * Time.smoothDeltaTime;
freeLookVCam.m_YAxis.m_InputAxisValue = cameraMovement.y * Time.smoothDeltaTime;
}
}

11
UOP1_Project/Assets/Scripts/CameraManager.cs.meta


fileFormatVersion: 2
guid: 085156cba0e34b540aeddafe12d1e2f1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
UOP1_Project/Assets/Scripts/Characters.meta


fileFormatVersion: 2
guid: 3f8fcc882e723a54e84a498e2b33474e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

118
UOP1_Project/Assets/Scripts/Characters/Character.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Character : MonoBehaviour
{
private CharacterController characterController;
[Tooltip("Horizontal XZ plane speed multiplier")] public float speed = 8f;
[Tooltip("General multiplier for gravity (affects jump and freefall)")] public float gravityMultiplier = 5f;
[Tooltip("The initial upwards push when pressing jump. This is injected into verticalMovement, and gradually cancelled by gravity")] public float initialJumpForce = 10f;
[Tooltip("How long can the player hold the jump button")] public float jumpInputDuration = .4f;
[Tooltip("Represents how fast gravityContributionMultiplier will go back to 1f. The higher, the faster")] public float gravityComebackMultiplier = 15f;
[Tooltip("The maximum speed reached when falling (in units/frame)")] public float maxFallSpeed = 50f;
[Tooltip("Each frame while jumping, gravity will be multiplied by this amount in an attempt to 'cancel it' (= jump higher)")] public float gravityDivider = .6f;
private float gravityContributionMultiplier = 0f; //The factor which determines how much gravity is affecting verticalMovement
private bool isJumping = false; //If true, a jump is in effect and the player is holding the jump button
private float jumpBeginTime = -Mathf.Infinity; //Time of the last jump
private float verticalMovement = 0f; //Represents how much a player will move vertically in a frame. Affected by gravity * gravityContributionMultiplier
private Vector3 inputVector; //Initial input horizontal movement (y == 0f)
private Vector3 movementVector; //Final movement vector
private void Awake()
{
characterController = GetComponent<CharacterController>();
}
private void Update()
{
//Raises the multiplier to how much gravity will affect vertical movement when in mid-air
//This is 0f at the beginning of a jump and will raise to maximum 1f
if(!characterController.isGrounded)
{
gravityContributionMultiplier += Time.deltaTime * gravityComebackMultiplier;
}
//Reduce the influence of the gravity while holding the Jump button
if(isJumping)
{
//The player can only hold the Jump button for so long
if(Time.time >= jumpBeginTime + jumpInputDuration)
{
isJumping = false;
gravityContributionMultiplier = 1f; //Gravity influence is reset to full effect
}
else
{
gravityContributionMultiplier *= gravityDivider; //Reduce the gravity effect
}
}
//Calculate the final verticalMovement
if(!characterController.isGrounded)
{
//Less control in mid-air, conserving momentum from previous frame
movementVector = inputVector * speed;
//The character is either jumping or in freefall, so gravity will add up
gravityContributionMultiplier = Mathf.Clamp01(gravityContributionMultiplier);
verticalMovement += Physics.gravity.y * gravityMultiplier * Time.deltaTime * gravityContributionMultiplier; //Add gravity contribution
//Note that even if it's added, the above value is negative due to Physics.gravity.y
//Cap the maximum so the player doesn't reach incredible speeds when freefalling from high positions
verticalMovement = Mathf.Clamp(verticalMovement, -maxFallSpeed, 100f);
}
else
{
//Full speed ground movement
movementVector = inputVector * speed;
//Resets the verticalMovement while on the ground,
//so that regardless of whether the player landed from a high fall or not,
//if they drop off a platform they will always start with the same verticalMovement.
//-5f is a good value to make it so the player also sticks to uneven terrain/bumps without floating.
if(!isJumping)
{
verticalMovement = -5f;
gravityContributionMultiplier = 0f;
}
}
//Apply the result and move the character in space
movementVector.y = verticalMovement;
characterController.Move(movementVector * Time.deltaTime);
//Rotate to the movement direction
movementVector.y = 0f;
if(movementVector.sqrMagnitude >= .02f)
{
transform.forward = movementVector.normalized;
}
}
//---- COMMANDS ISSUED BY OTHER SCRIPTS ----
public void Move(Vector3 movement)
{
inputVector = movement;
}
public void Jump()
{
if(characterController.isGrounded)
{
isJumping = true;
jumpBeginTime = Time.time;
verticalMovement = initialJumpForce; //This is the only place where verticalMovement is set to a positive value
gravityContributionMultiplier = 0f;
}
}
public void CancelJump()
{
isJumping = false; //This will stop the reduction to the gravity, which will then quickly pull down the character
}
}

11
UOP1_Project/Assets/Scripts/Characters/Character.cs.meta


fileFormatVersion: 2
guid: 4eb0e4f8f5e39624ea81504bf968dcce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

64
UOP1_Project/Assets/Scripts/Characters/Protagonist.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Protagonist : MonoBehaviour
{
public InputReader inputReader;
public Transform gameplayCamera;
private Character charScript;
private bool controlsEnabled = true;
private void Awake()
{
charScript = GetComponent<Character>();
}
//Adds listeners for events being triggered in the InputReader script
private void OnEnable()
{
inputReader.jumpEvent += OnJumpInitiated;
inputReader.jumpCanceledEvent += OnJumpCanceled;
inputReader.moveEvent += OnMove;
//...
}
//Removes all listeners to the events coming from the InputReader script
private void OnDisable()
{
inputReader.jumpEvent -= OnJumpInitiated;
inputReader.jumpCanceledEvent -= OnJumpCanceled;
inputReader.moveEvent -= OnMove;
//...
}
//---- EVENT LISTENERS ----
private void OnMove(Vector2 movement)
{
if(controlsEnabled)
{
//Get the two axes from the camera and flatten them on the XZ plane
Vector3 cameraForward = gameplayCamera.forward;
cameraForward.y = 0f;
Vector3 cameraRight = gameplayCamera.right;
cameraRight.y = 0f;
//Use the two axes, modulated by the corresponding inputs, and construct the final vector
Vector3 adjustedMovement = cameraRight.normalized * movement.x + cameraForward.normalized * movement.y;
charScript.Move(Vector3.ClampMagnitude(adjustedMovement, 1f));
}
}
private void OnJumpInitiated()
{
if(controlsEnabled) charScript.Jump();
}
private void OnJumpCanceled()
{
if(controlsEnabled) charScript.CancelJump();
}
}

135
UOP1_Project/Assets/Scripts/Protagonist.cs


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Protagonist : MonoBehaviour
{
public InputReader inputReader;
private CharacterController characterController;
public float speed = 10f; //Horizontal plane speed multiplier
public float gravityMultiplier = 5f; //General multiplier for gravity (affects jump and freefall)
public float initialJumpForce = 10f; //The initial upwards push when pressing jump. This is injected into verticalMovement, and gradually cancelled by gravity
public float jumpInputDuration = .4f; //How long can the player hold the jump button
public float gravityComebackMultiplier = 15f; //Represents how fast gravityContributionMultiplier will go back to 1f. The higher, the faster
public float maxFallSpeed = 50f; //The maximum speed reached when falling (in units/frame)
public float gravityDivider = .6f; //Each frame while jumping, gravity will be multiplied by this amount in an attempt to "cancel it" (= jump higher)
private float gravityContributionMultiplier = 0f; //The factor which determines how much gravity is affecting verticalMovement
private bool isJumping = false; //If true, a jump is in effect and the player is holding the jump button
private float jumpBeginTime = -Mathf.Infinity; //Time of the last jump
private float verticalMovement = 0f; //Represents how much a player will move vertically in a frame. Affected by gravity * gravityContributionMultiplier
private Vector3 inputVector; //Initial input horizontal movement (y == 0f)
private Vector3 movementVector; //Final movement vector
//Adds listeners for events being triggered in the InputReader script
private void OnEnable()
{
inputReader.jumpEvent += OnJumpInitiated;
inputReader.jumpCanceledEvent += OnJumpCanceled;
inputReader.moveEvent += OnMove;
//...
}
//Removes all listeners to the events coming from the InputReader script
private void OnDisable()
{
inputReader.jumpEvent -= OnJumpInitiated;
inputReader.jumpCanceledEvent -= OnJumpCanceled;
inputReader.moveEvent -= OnMove;
//...
}
private void Awake()
{
characterController = GetComponent<CharacterController>();
}
private void Update()
{
//Raises the multiplier to how much gravity will affect vertical movement when in mid-air
//This is 0f at the beginning of a jump and will raise to maximum 1f
if(!characterController.isGrounded)
{
gravityContributionMultiplier += Time.deltaTime * gravityComebackMultiplier;
}
//Reduce the influence of the gravity while holding the Jump button
if(isJumping)
{
//The player can only hold the Jump button for so long
if(Time.time >= jumpBeginTime + jumpInputDuration)
{
isJumping = false;
gravityContributionMultiplier = 1f; //Gravity influence is reset to full effect
}
else
{
gravityContributionMultiplier *= gravityDivider; //Reduce the gravity effect
}
}
//Calculate the final verticalMovement
if(!characterController.isGrounded)
{
//Less control in mid-air, conserving momentum from previous frame
movementVector = inputVector * speed;
//The character is either jumping or in freefall, so gravity will add up
gravityContributionMultiplier = Mathf.Clamp01(gravityContributionMultiplier);
verticalMovement += Physics.gravity.y * gravityMultiplier * Time.deltaTime * gravityContributionMultiplier; //Add gravity contribution
//Note that even if it's added, the above value is negative due to Physics.gravity.y
//Cap the maximum so the player doesn't reach incredible speeds when freefalling from high positions
verticalMovement = Mathf.Clamp(verticalMovement, -maxFallSpeed, 100f);
}
else
{
//Full speed ground movement
movementVector = inputVector * speed;
//Resets the verticalMovement while on the ground,
//so that regardless of whether the player landed from a high fall or not,
//if they drop off a platform they will always start with the same verticalMovement.
//-5f is a good value to make it so the player also sticks to uneven terrain/bumps without floating.
if(!isJumping)
{
verticalMovement = -5f;
gravityContributionMultiplier = 0f;
}
}
//Apply the result and move the character in space
movementVector.y = verticalMovement;
characterController.Move(movementVector * Time.deltaTime);
//Rotate to the movement direction
movementVector.y = 0f;
if(movementVector.sqrMagnitude >= .02f)
{
transform.forward = movementVector.normalized;
}
}
private void OnMove(Vector2 movement)
{
inputVector = new Vector3(movement.x, 0f, movement.y);
}
private void OnJumpInitiated()
{
if(characterController.isGrounded)
{
isJumping = true;
jumpBeginTime = Time.time;
verticalMovement = initialJumpForce; //This is the only place where verticalMovement is set to a positive value
gravityContributionMultiplier = 0f;
}
}
private void OnJumpCanceled()
{
isJumping = false; //This will stop the reduction to the gravity, which will then quickly pull down the character
}
}

/UOP1_Project/Assets/Scripts/Protagonist.cs.meta → /UOP1_Project/Assets/Scripts/Characters/Protagonist.cs.meta

正在加载...
取消
保存