Merge remote-tracking branch 'origin/Over' into Syntriax

This commit is contained in:
2022-02-22 19:51:05 +03:00
9 changed files with 638 additions and 207 deletions

View File

@@ -46,6 +46,15 @@ namespace Input
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Interact"",
""type"": ""Button"",
""id"": ""a0a57f7b-062d-458c-a85a-d6030c412835"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@@ -136,6 +145,28 @@ namespace Input
""action"": ""Jump"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""4eb9a209-b978-4daf-927a-2f013348d294"",
""path"": ""<Keyboard>/z"",
""interactions"": """",
""processors"": """",
""groups"": ""KeyBoard"",
""action"": ""Interact"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""c2dc0361-1191-4641-97e6-d105f64ee7ff"",
""path"": ""<Gamepad>/buttonEast"",
""interactions"": """",
""processors"": """",
""groups"": ""Controller"",
""action"": ""Interact"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@@ -169,6 +200,7 @@ namespace Input
m_PlayerControl = asset.FindActionMap("PlayerControl", throwIfNotFound: true);
m_PlayerControl_Move = m_PlayerControl.FindAction("Move", throwIfNotFound: true);
m_PlayerControl_Jump = m_PlayerControl.FindAction("Jump", throwIfNotFound: true);
m_PlayerControl_Interact = m_PlayerControl.FindAction("Interact", throwIfNotFound: true);
}
public void Dispose()
@@ -230,12 +262,14 @@ namespace Input
private IPlayerControlActions m_PlayerControlActionsCallbackInterface;
private readonly InputAction m_PlayerControl_Move;
private readonly InputAction m_PlayerControl_Jump;
private readonly InputAction m_PlayerControl_Interact;
public struct PlayerControlActions
{
private @PlayerInput m_Wrapper;
public PlayerControlActions(@PlayerInput wrapper) { m_Wrapper = wrapper; }
public InputAction @Move => m_Wrapper.m_PlayerControl_Move;
public InputAction @Jump => m_Wrapper.m_PlayerControl_Jump;
public InputAction @Interact => m_Wrapper.m_PlayerControl_Interact;
public InputActionMap Get() { return m_Wrapper.m_PlayerControl; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@@ -251,6 +285,9 @@ namespace Input
@Jump.started -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnJump;
@Jump.performed -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnJump;
@Jump.canceled -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnJump;
@Interact.started -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnInteract;
@Interact.performed -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnInteract;
@Interact.canceled -= m_Wrapper.m_PlayerControlActionsCallbackInterface.OnInteract;
}
m_Wrapper.m_PlayerControlActionsCallbackInterface = instance;
if (instance != null)
@@ -261,6 +298,9 @@ namespace Input
@Jump.started += instance.OnJump;
@Jump.performed += instance.OnJump;
@Jump.canceled += instance.OnJump;
@Interact.started += instance.OnInteract;
@Interact.performed += instance.OnInteract;
@Interact.canceled += instance.OnInteract;
}
}
}
@@ -287,6 +327,7 @@ namespace Input
{
void OnMove(InputAction.CallbackContext context);
void OnJump(InputAction.CallbackContext context);
void OnInteract(InputAction.CallbackContext context);
}
}
}

View File

@@ -22,6 +22,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Interact",
"type": "Button",
"id": "a0a57f7b-062d-458c-a85a-d6030c412835",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@@ -112,6 +121,28 @@
"action": "Jump",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "4eb9a209-b978-4daf-927a-2f013348d294",
"path": "<Keyboard>/z",
"interactions": "",
"processors": "",
"groups": "KeyBoard",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "c2dc0361-1191-4641-97e6-d105f64ee7ff",
"path": "<Gamepad>/buttonEast",
"interactions": "",
"processors": "",
"groups": "Controller",
"action": "Interact",
"isComposite": false,
"isPartOfComposite": false
}
]
}

View File

@@ -29,10 +29,11 @@ Transform:
m_GameObject: {fileID: 7008207192594766305}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -4.55, y: 0.41, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalScale: {x: 1, y: 2, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7008207193600475140}
- {fileID: 3507368432553107122}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -117,10 +118,10 @@ Rigidbody2D:
m_AngularDrag: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_Interpolate: 0
m_Interpolate: 1
m_SleepingMode: 1
m_CollisionDetection: 1
m_Constraints: 0
m_Constraints: 4
--- !u!61 &7008207192594766308
BoxCollider2D:
m_ObjectHideFlags: 0
@@ -172,7 +173,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7008207193600475141}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.005, y: -0.48, z: 0}
m_LocalPosition: {x: -0.005, y: -0.491, z: 0}
m_LocalScale: {x: 0.95, y: 0.05, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -194,3 +195,50 @@ MonoBehaviour:
layerMask:
serializedVersion: 2
m_Bits: 4294967048
--- !u!1 &7353493454494059090
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3507368432553107122}
- component: {fileID: 5720529389170152932}
m_Layer: 6
m_Name: PlayerInteractableTrigger
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3507368432553107122
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7353493454494059090}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.72, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1.5, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7008207192594766311}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5720529389170152932
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7353493454494059090}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7000c8c0eb91b2d4cb9a0e3ee1b609a7, type: 3}
m_Name:
m_EditorClassIdentifier:
layerMask:
serializedVersion: 2
m_Bits: 4294967040

View File

@@ -148,7 +148,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 65152409}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.9862347, y: 2.4004586, z: -9.967962}
m_LocalPosition: {x: -24.753765, y: 2.9204586, z: -9.967962}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -178,7 +178,7 @@ MonoBehaviour:
m_Follow: {fileID: 1053905692}
m_Lens:
FieldOfView: 60
OrthographicSize: 5
OrthographicSize: 13
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
@@ -194,11 +194,255 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1483260705}
--- !u!1001 &151052495
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_RootOrder
value: 7
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalScale.x
value: 15
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.x
value: 16.55
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012094, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_Name
value: PlatformTest (4)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
--- !u!1001 &498167244
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalScale.x
value: 5
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.x
value: -4.47
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.y
value: 1.46
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012094, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_Name
value: PlatformTest (1)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
--- !u!1001 &1032596411
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalScale.x
value: 5
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.x
value: -12.01
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012094, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_Name
value: PlatformTest (2)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
--- !u!4 &1053905692 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
m_PrefabInstance: {fileID: 7008207193554258683}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1174240662
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalScale.x
value: 15
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.x
value: -24.78
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 847968262667012094, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_Name
value: PlatformTest (3)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
--- !u!1 &1448490236
GameObject:
m_ObjectHideFlags: 0
@@ -230,7 +474,7 @@ Transform:
- {fileID: 1514474963}
- {fileID: 65152410}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1483260704
GameObject:
@@ -280,10 +524,10 @@ MonoBehaviour:
m_TrackedObjectOffset: {x: 0, y: 0, z: 0}
m_LookaheadTime: 0
m_LookaheadSmoothing: 0
m_LookaheadIgnoreY: 0
m_LookaheadIgnoreY: 1
m_XDamping: 1
m_YDamping: 1
m_ZDamping: 1
m_ZDamping: 0
m_TargetMovementOnly: 1
m_ScreenX: 0.5
m_ScreenY: 0.5
@@ -374,7 +618,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
orthographic size: 13
m_Depth: -1
m_CullingMask:
serializedVersion: 2
@@ -398,7 +642,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1514474960}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 1.9862347, y: 2.4004586, z: -9.967962}
m_LocalPosition: {x: -24.753765, y: 2.9204586, z: -9.967962}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -542,19 +786,19 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_RootOrder
value: 1
value: 4
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalScale.x
value: 20
value: 5
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.x
value: -3.79
value: 3.54
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.y
value: -0.89
value: -1
objectReference: {fileID: 0}
- target: {fileID: 847968262667012088, guid: 9bff55120282d9e45a29d69eea4e6543, type: 3}
propertyPath: m_LocalPosition.z
@@ -605,21 +849,17 @@ PrefabInstance:
propertyPath: m_Name
value: Player
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766309, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_Interpolate
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalPosition.x
value: -4.55
value: -31.29
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalPosition.y
value: 0.41
value: 0.93
objectReference: {fileID: 0}
- target: {fileID: 7008207192594766311, guid: 2ed6bfce9ad3e19428cb9bef743e0fa3, type: 3}
propertyPath: m_LocalPosition.z

View File

@@ -2,47 +2,59 @@ using System;
using Movement;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using PlayerInput = Input.PlayerInput;
namespace Player
{
public class PlayerController : MonoBehaviour, IMovement, Input.PlayerInput.IPlayerControlActions
public class PlayerController : MonoBehaviour, IMovement, PlayerInput.IPlayerControlActions
{
private const float DefaultJumpForce = 784.0f;
private const float DefaultJumpForce = 25.0f;
private const float DefaultMass = 80.0f;
private const float DefaultSpeed = 500.0f;
private const float GravityScale = 1.0f;
private const float MaxSpeed = 500.0f;
private const float DefaultAirSpeed = 300.0f;
private const float GravityScale = 5.0f;
private Input.PlayerInput _controls;
private const float FallMultiplier = 4.0f;
private const float LowJumpMultiplier = 10.0f;
private PlayerInput _controls;
private Rigidbody2D _playerRigidbody2D;
private SpriteRenderer _playerSpriteRenderer;
private CollisionChecker _playerGroundTrigger;
private CollisionChecker _playerInteractableTrigger;
private bool _moveKeyPressed;
private bool _jumpKeyPressed;
private bool _isOnAir;
private float _xAxisValue;
public float speed;
private bool _isOnAir;
private bool _canJump;
private void Awake()
{
this._playerRigidbody2D = gameObject.GetComponent<Rigidbody2D>();
this._playerGroundTrigger = GameObject.Find("PlayerGroundTrigger").GetComponent<CollisionChecker>();
this._playerSpriteRenderer = gameObject.GetComponent<SpriteRenderer>();
_playerRigidbody2D = GetComponent<Rigidbody2D>();
_playerSpriteRenderer = GetComponent<SpriteRenderer>();
_playerGroundTrigger = GameObject.Find("PlayerGroundTrigger").GetComponent<CollisionChecker>();
_playerInteractableTrigger = GameObject.Find("PlayerInteractableTrigger").GetComponent<CollisionChecker>();
}
private void Start()
{
this._playerRigidbody2D.gravityScale = GravityScale;
this._playerRigidbody2D.mass = DefaultMass;
BaseSpeed = DefaultSpeed;
_playerRigidbody2D.mass = DefaultMass;
_playerRigidbody2D.gravityScale = GravityScale;
_canJump = true;
BaseSpeed = 0.0f;
}
private void OnEnable()
{
if (_controls == null)
{
_controls = new Input.PlayerInput();
_controls = new PlayerInput();
_controls.PlayerControl.SetCallbacks(this);
}
@@ -56,15 +68,43 @@ namespace Player
private void FixedUpdate()
{
/*switch (_playerRigidbody2D.velocity.y)
{
case < 0:
_playerRigidbody2D.velocity +=
Vector2.up * (Physics2D.gravity.y * (FallMultiplier - 1) * Time.fixedDeltaTime);
break;
/*case > 0 and < 3:
print("We will go down" + i);
++i;
break;
case > 0 when !_jumpKeyPressed:
_playerRigidbody2D.velocity +=
Vector2.up * (Physics2D.gravity.y * (LowJumpMultiplier - 1) * Time.fixedDeltaTime);
break;
}*/
if (_moveKeyPressed)
Move(_xAxisValue);
else
_playerRigidbody2D.velocity = new Vector2(0.0f, _playerRigidbody2D.velocity.y);
if (_jumpKeyPressed && _playerGroundTrigger.IsCollided)
if (_jumpKeyPressed && _canJump && _playerGroundTrigger.IsCollided)
Jump();
}
private void Update()
{
_isOnAir = !_playerGroundTrigger.IsCollided;
RespawnCheck();
}
private void RespawnCheck()
{
if (gameObject.transform.position.y < -100)
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
// PAUSE METHODS
public bool IsPaused { get; private set; }
@@ -72,16 +112,27 @@ namespace Player
public void Pause()
{
IsPaused = true;
_playerRigidbody2D.simulated = IsPaused;
}
public void Resume()
{
IsPaused = false;
_playerRigidbody2D.simulated = IsPaused;
}
// MOVE METHODS
public float BaseSpeed { get; set; }
public float BaseSpeed
{
get => speed;
set
{
speed = value;
if (speed > MaxSpeed)
speed = MaxSpeed;
}
}
public void Move(float value)
{
@@ -93,16 +144,27 @@ namespace Player
case > 0:
_playerSpriteRenderer.flipX = false;
break;
default:
_playerSpriteRenderer.flipX = _playerSpriteRenderer.flipX;
break;
}
if (!_isOnAir)
BaseSpeed += 40;
_playerRigidbody2D.velocity = new Vector2(BaseSpeed * _xAxisValue * Time.fixedDeltaTime,
_playerRigidbody2D.velocity.y);
}
private void DecelerationAfterMoving()
{
throw new NotImplementedException();
}
private void Jump()
{
_playerRigidbody2D.velocity = new Vector2(_playerRigidbody2D.velocity.x, 0);
_playerRigidbody2D.AddForce(Vector2.up.normalized * DefaultJumpForce, ForceMode2D.Impulse);
BaseSpeed = DefaultAirSpeed;
_playerRigidbody2D.velocity = Vector2.up.normalized * DefaultJumpForce;
_canJump = false;
}
private void Climb()
@@ -118,6 +180,7 @@ namespace Player
{
case true:
_moveKeyPressed = false;
BaseSpeed = 0;
break;
case false:
_moveKeyPressed = true;
@@ -132,11 +195,18 @@ namespace Player
{
case true:
_jumpKeyPressed = false;
_canJump = true;
break;
case false:
_jumpKeyPressed = true;
break;
}
}
public void OnInteract(InputAction.CallbackContext context)
{
if (_playerInteractableTrigger.IsCollided)
throw new NotImplementedException();
}
}
}
}