Merge branch 'main' of http://212.24.110.183:3000/IPSEITY/Unheimlich_POC
# Conflicts: # Assets/TextMesh Pro/Fonts/TMP_Assets/CourierPrime-Regular SDF.asset # Assets/TextMesh Pro/Fonts/TMP_Assets/CutiveMono-Regular SDF.asset # Assets/TextMesh Pro/Fonts/TMP_Assets/Inconsolata-VariableFont_wdth,wght SDF.asset # Assets/TextMesh Pro/Fonts/TMP_Assets/OxygenMono-Regular SDF.asset # Assets/TextMesh Pro/Fonts/TMP_Assets/ShareTechMono-Regular SDF.asset # Assets/TextMesh Pro/Fonts/TMP_Assets/SpecialElite-Regular SDF.asset # Assets/_Content/Prefabs/OctoPlayerFP.prefab # Packages/OctoCore/Runtime/Scripts/Components/OctoPlayer.cs
This commit is contained in:
@@ -82,17 +82,11 @@ namespace OctoCore.Components
|
||||
|
||||
[Header("Settings")]
|
||||
|
||||
[Tooltip("Horizontal sensitivity (Yaw).")]
|
||||
public float SensitivityX = 0.1f;
|
||||
[Tooltip("Mouse sensitivity (Yaw & Pitch).")]
|
||||
public Vector2 MouseSensitivity = new Vector2(.1f, .1f);
|
||||
|
||||
[Tooltip("Vertical sensitivity (Pitch).")]
|
||||
public float SensitivityY = 0.1f;
|
||||
|
||||
[Tooltip("Gamepad horizontal sensitivity.")]
|
||||
public float GamepadSensitivityX = 150f;
|
||||
|
||||
[Tooltip("Gamepad vertical sensitivity.")]
|
||||
public float GamepadSensitivityY = 150f;
|
||||
[Tooltip("Controller sensitivity (Yaw & Pitch).")]
|
||||
public Vector2 ControllerSensitivity = new Vector2(140, 140);
|
||||
|
||||
[Tooltip("Minimum pitch (looking down).")]
|
||||
public float MinPitch = -80f;
|
||||
@@ -193,6 +187,12 @@ namespace OctoCore.Components
|
||||
_references.Controller.enabled = true;
|
||||
}
|
||||
|
||||
public void Move(Vector3 offset)
|
||||
{
|
||||
transform.position += offset;
|
||||
Physics.SyncTransforms();
|
||||
}
|
||||
|
||||
public void Pause(bool pause)
|
||||
{
|
||||
_state.IsPaused = pause;
|
||||
@@ -352,26 +352,22 @@ namespace OctoCore.Components
|
||||
case PlayerModes.FirstPerson:
|
||||
if (cam && !_state.IsPaused)
|
||||
{
|
||||
Vector2 delta = (_state.IsPaused || !_state.IsFocussed || !_settings.AllowLook) ? Vector2.zero : _lookInput;
|
||||
Vector2 delta = (_state.IsPaused || !_state.IsFocussed) ? Vector2.zero : _lookInput;
|
||||
|
||||
if (_settings.AllowLook)
|
||||
{
|
||||
bool isGamepad = Gamepad.current != null &&
|
||||
Gamepad.current.rightStick.ReadValue().magnitude > 0.01f;
|
||||
bool isController = OctoCore.Instance.Platform.Controller;
|
||||
Vector2 sensitivity = isController ? _firstPerson.ControllerSensitivity * Time.deltaTime : _firstPerson.MouseSensitivity;
|
||||
|
||||
float sensX = isGamepad ? _firstPerson.GamepadSensitivityX : _firstPerson.SensitivityX;
|
||||
float sensY = isGamepad ? _firstPerson.GamepadSensitivityY : _firstPerson.SensitivityY;
|
||||
Vector2 look = delta * new Vector2(sensitivity.x, sensitivity.y * -1);
|
||||
|
||||
float lookX = isGamepad ? delta.x * sensX * Time.deltaTime : delta.x * sensX;
|
||||
float lookY = isGamepad ? delta.y * sensY * -1 * Time.deltaTime : delta.y * sensY * -1;
|
||||
|
||||
_state.Yaw += lookX;
|
||||
_state.Yaw += look.x;
|
||||
float halfRange = _firstPerson.RangeYaw * 0.5f;
|
||||
float deltaYaw = Mathf.DeltaAngle(_firstPerson.ReferenceYaw, _state.Yaw);
|
||||
deltaYaw = Mathf.Clamp(deltaYaw, -halfRange, halfRange);
|
||||
_state.Yaw = _firstPerson.ReferenceYaw + deltaYaw;
|
||||
|
||||
_state.Pitch = Mathf.Clamp(_state.Pitch + lookY, _firstPerson.MinPitch, _firstPerson.MaxPitch);
|
||||
_state.Pitch = Mathf.Clamp(_state.Pitch + look.y, _firstPerson.MinPitch, _firstPerson.MaxPitch);
|
||||
}
|
||||
|
||||
if (_state.Driver)
|
||||
|
||||
@@ -147,6 +147,12 @@ namespace OctoCore.Components
|
||||
EvaluateTrigger(col, false);
|
||||
}
|
||||
|
||||
public void ResetLookAt()
|
||||
{
|
||||
_lookAtTimer = 0f;
|
||||
_lookAtTriggered = false;
|
||||
}
|
||||
|
||||
void TriggerWithCondition()
|
||||
{
|
||||
switch (_condition)
|
||||
@@ -255,7 +261,7 @@ namespace OctoCore.Components
|
||||
else
|
||||
{
|
||||
_lookAtTimer = 0f;
|
||||
_lookAtTriggered = false;
|
||||
//_lookAtTriggered = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,11 +227,16 @@ namespace OctoCore.Inputs
|
||||
{
|
||||
var actionInfo = kvp.Value;
|
||||
|
||||
if (actionInfo.Reference.action.expectedControlType != "Vector2")
|
||||
continue;
|
||||
|
||||
Vector2 value = actionInfo.Reference.action.ReadValue<Vector2>();
|
||||
|
||||
// Only poll enabled actions with callbacks
|
||||
if (actionInfo.Enabled &&
|
||||
actionInfo.Reference != null &&
|
||||
(actionInfo.CallbacksList.Count > 0 || actionInfo.CallbacksVector2List.Count > 0) &&
|
||||
actionInfo.Reference.action.IsPressed())
|
||||
value.sqrMagnitude > .0001f)
|
||||
{
|
||||
// Call Action callbacks
|
||||
foreach (var callback in actionInfo.CallbacksList.ToArray())
|
||||
@@ -242,7 +247,6 @@ namespace OctoCore.Inputs
|
||||
// Call Vector2 callbacks
|
||||
foreach (var callback in actionInfo.CallbacksVector2List.ToArray())
|
||||
{
|
||||
Vector2 value = actionInfo.Reference.action.ReadValue<Vector2>();
|
||||
callback?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user