+ Ocean씬 카메라 회전각도 변경
(0, 90, 0) -> (0, 0, 0)
x, z축 반전 현상 때문에 변경
+ 카메라 변경에 맞게 Ship, 섬도 회전
+ WASD 상하좌우 조작 방식으로 변경
+ Shift로 부스트 기능 추가
This commit is contained in:
NTG 2023-12-19 21:46:06 +09:00
parent 025ac9d78e
commit eece9d718f
6 changed files with 419 additions and 29 deletions

View File

@ -1186,14 +1186,14 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 168896972}
serializedVersion: 2
m_LocalRotation: {x: 0.18301274, y: 0.6830127, z: -0.18301274, w: 0.6830127}
m_LocalPosition: {x: -71.941025, y: 21.420008, z: 0.00000399121}
m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258}
m_LocalPosition: {x: -37.3, y: 21.420004, z: -34.641014}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 263106988}
m_Father: {fileID: 649179607}
m_LocalEulerAnglesHint: {x: 30, y: 90, z: 0}
m_LocalEulerAnglesHint: {x: 30, y: 0, z: 0}
--- !u!114 &168896974
MonoBehaviour:
m_ObjectHideFlags: 0
@ -1696,8 +1696,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 200595899}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -29.63, y: 5.01, z: 59.46}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: -104.3, y: 5.01, z: 30.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -1715,7 +1715,7 @@ Transform:
- {fileID: 800408618}
- {fileID: 1389301165}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
--- !u!114 &200595901
MonoBehaviour:
m_ObjectHideFlags: 0
@ -3250,8 +3250,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 357776292}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: -17.4, y: 0, z: 47.6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -3262,7 +3262,7 @@ Transform:
- {fileID: 541711049}
- {fileID: 107190135}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
--- !u!1001 &392546456
PrefabInstance:
m_ObjectHideFlags: 0
@ -3748,10 +3748,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
autoInit: 1
maxSpeed: 10
acceleration: 4
maxSpeed: 15
acceleration: 10
deceleration: 2
turnSpeed: 1
turnSpeed: 2
cannon: {fileID: 1612917925}
cannonCooldown: 1
chargingSpeed: 1
@ -3760,6 +3760,10 @@ MonoBehaviour:
isReloading: 0
chargingGauge: 0
previousGauge: 0
boostPower: 2
boostMaxTime: 3
boostRecoveryTime: 1.5
isBoosting: 0
waterLayer:
serializedVersion: 2
m_Bits: 16
@ -3901,7 +3905,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 476261169}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -37.3, y: -1.58, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -3911,7 +3915,7 @@ Transform:
- {fileID: 1084613024}
- {fileID: 1925782815}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &476261176
BoxCollider:
m_ObjectHideFlags: 0
@ -7186,8 +7190,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 776161953}
serializedVersion: 2
m_LocalRotation: {x: 0.18301274, y: 0.6830127, z: -0.18301274, w: 0.6830127}
m_LocalPosition: {x: -71.941025, y: 21.420008, z: 0.00000399121}
m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258}
m_LocalPosition: {x: -37.3, y: 21.420004, z: -34.641014}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@ -9091,6 +9095,10 @@ MonoBehaviour:
isReloading: 0
chargingGauge: 0
previousGauge: 0
boostPower: 2
boostMaxTime: 3
boostRecoveryTime: 1.5
isBoosting: 0
waterLayer:
serializedVersion: 2
m_Bits: 0
@ -10665,6 +10673,266 @@ MonoBehaviour:
m_Calls: []
m_LegacyBlendHint: 0
m_ComponentOwner: {fileID: 1040971782}
--- !u!1001 &1446558449
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 2105062291}
m_Modifications:
- target: {fileID: 3071491898345723473, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3071491898345723473, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3071491898345723473, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3071491898345723473, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3071491898345723473, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_SizeDelta.x
value: 14.25
objectReference: {fileID: 0}
- target: {fileID: 3071491898345723473, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276924355341542, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.x
value: 0.75
objectReference: {fileID: 0}
- target: {fileID: 6935276924355341542, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6935276924355341542, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.x
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 6935276924355341542, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276924355341542, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_SizeDelta.x
value: 8
objectReference: {fileID: 0}
- target: {fileID: 6935276924355341542, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276924459582013, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.x
value: 0.75
objectReference: {fileID: 0}
- target: {fileID: 6935276924459582013, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6935276924459582013, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.x
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 6935276924459582013, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161161, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_Value
value: 0.3
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161161, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_MaxValue
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161161, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_Direction
value: 2
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161161, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_WholeNumbers
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_SizeDelta.x
value: 25
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_SizeDelta.y
value: 150
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 50
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 100
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925009161207, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_Name
value: ShipBoostSlider
objectReference: {fileID: 0}
- target: {fileID: 6935276925344686068, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925344686068, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925344686068, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925344686068, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925499279574, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925499279574, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6935276925499279574, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects:
- {fileID: 6935276925479934990, guid: 380b9020d37774c7a9f587a854c1e063, type: 3}
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 380b9020d37774c7a9f587a854c1e063, type: 3}
--- !u!224 &1446558450 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 6935276925009161206, guid: 380b9020d37774c7a9f587a854c1e063,
type: 3}
m_PrefabInstance: {fileID: 1446558449}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1464480066
GameObject:
m_ObjectHideFlags: 0
@ -10797,8 +11065,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1485085414}
serializedVersion: 2
m_LocalRotation: {x: 0.3802242, y: 0.6187545, z: -0.46297556, w: 0.5081596}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: 0.3802254, y: 0.6187532, z: -0.46297458, w: 0.50816107}
m_LocalPosition: {x: -0.00005340576, y: 0, z: -0.0002593994}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -14362,6 +14630,7 @@ RectTransform:
- {fileID: 868726320}
- {fileID: 7415601899565865879}
- {fileID: 480975273}
- {fileID: 1446558450}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -14402,8 +14671,8 @@ MonoBehaviour:
<ReloadSlider>k__BackingField: {fileID: 7415601899565865896}
<ShakeDuration>k__BackingField: 0.5
<ShakePower>k__BackingField: 10
<CannonFill>k__BackingField: {fileID: 0}
processBarOffset: {x: 0, y: 0, z: 0}
<ShipBoostSlider>k__BackingField: {fileID: 0}
--- !u!1001 &2114222814
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -170,6 +170,15 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""ShiftKey"",
""type"": ""Button"",
""id"": ""6e363e5e-d384-4b7e-a9df-91159f5523ad"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
@ -403,6 +412,17 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
""action"": ""Mouse1"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""8d33ba7e-c3f4-4c6d-bd6a-11a48f13fdb6"",
""path"": ""<Keyboard>/shift"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""ShiftKey"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
},
@ -582,6 +602,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
m_Player_UseSkill = m_Player.FindAction("UseSkill", throwIfNotFound: true);
m_Player_Mouse0 = m_Player.FindAction("Mouse0", throwIfNotFound: true);
m_Player_Mouse1 = m_Player.FindAction("Mouse1", throwIfNotFound: true);
m_Player_ShiftKey = m_Player.FindAction("ShiftKey", throwIfNotFound: true);
// Camera
m_Camera = asset.FindActionMap("Camera", throwIfNotFound: true);
m_Camera_Zoom = m_Camera.FindAction("Zoom", throwIfNotFound: true);
@ -668,6 +689,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
private readonly InputAction m_Player_UseSkill;
private readonly InputAction m_Player_Mouse0;
private readonly InputAction m_Player_Mouse1;
private readonly InputAction m_Player_ShiftKey;
public struct PlayerActions
{
private @BlueWater m_Wrapper;
@ -688,6 +710,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
public InputAction @UseSkill => m_Wrapper.m_Player_UseSkill;
public InputAction @Mouse0 => m_Wrapper.m_Player_Mouse0;
public InputAction @Mouse1 => m_Wrapper.m_Player_Mouse1;
public InputAction @ShiftKey => m_Wrapper.m_Player_ShiftKey;
public InputActionMap Get() { return m_Wrapper.m_Player; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@ -745,6 +768,9 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
@Mouse1.started += instance.OnMouse1;
@Mouse1.performed += instance.OnMouse1;
@Mouse1.canceled += instance.OnMouse1;
@ShiftKey.started += instance.OnShiftKey;
@ShiftKey.performed += instance.OnShiftKey;
@ShiftKey.canceled += instance.OnShiftKey;
}
private void UnregisterCallbacks(IPlayerActions instance)
@ -797,6 +823,9 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
@Mouse1.started -= instance.OnMouse1;
@Mouse1.performed -= instance.OnMouse1;
@Mouse1.canceled -= instance.OnMouse1;
@ShiftKey.started -= instance.OnShiftKey;
@ShiftKey.performed -= instance.OnShiftKey;
@ShiftKey.canceled -= instance.OnShiftKey;
}
public void RemoveCallbacks(IPlayerActions instance)
@ -966,6 +995,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
void OnUseSkill(InputAction.CallbackContext context);
void OnMouse0(InputAction.CallbackContext context);
void OnMouse1(InputAction.CallbackContext context);
void OnShiftKey(InputAction.CallbackContext context);
}
public interface ICameraActions
{

View File

@ -148,6 +148,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "ShiftKey",
"type": "Button",
"id": "6e363e5e-d384-4b7e-a9df-91159f5523ad",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@ -381,6 +390,17 @@
"action": "Mouse1",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "8d33ba7e-c3f4-4c6d-bd6a-11a48f13fdb6",
"path": "<Keyboard>/shift",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "ShiftKey",
"isComposite": false,
"isPartOfComposite": false
}
]
},

View File

@ -27,6 +27,12 @@ namespace BlueWaterProject
[SerializeField] private bool isReloading;
[SerializeField] private float chargingGauge;
[SerializeField] private float previousGauge;
[Title("부스트")]
[SerializeField] private float boostPower = 2f;
[SerializeField] private float boostMaxTime = 3f;
[SerializeField] private float boostRecoveryTime = 1.5f;
[SerializeField] private bool isBoosting;
private PlayerInput playerInput;
private Rigidbody rb;
@ -64,13 +70,17 @@ namespace BlueWaterProject
playerInput.actions.FindAction("Mouse0").started += _ => ChargeCannon();
playerInput.actions.FindAction("Mouse0").canceled += _ => FireCannon();
playerInput.actions.FindAction("Mouse1").started += _ => ToggleFireMode();
playerInput.actions.FindAction("ShiftKey").started += _ => ShipBoost();
playerInput.actions.FindAction("ShiftKey").canceled += _ => ShipStopBoost();
}
private void OnDisable()
{
playerInput.actions.FindAction("Mouse0").started += _ => ChargeCannon();
playerInput.actions.FindAction("Mouse0").canceled += _ => FireCannon();
playerInput.actions.FindAction("Mouse1").started += _ => ToggleFireMode();
playerInput.actions.FindAction("Mouse0").started -= _ => ChargeCannon();
playerInput.actions.FindAction("Mouse0").canceled -= _ => FireCannon();
playerInput.actions.FindAction("Mouse1").started -= _ => ToggleFireMode();
playerInput.actions.FindAction("ShiftKey").started -= _ => ShipBoost();
playerInput.actions.FindAction("ShiftKey").canceled -= _ => ShipStopBoost();
}
private void Start()
@ -86,6 +96,7 @@ namespace BlueWaterProject
private void Update()
{
HandleFireCannon();
HandleBoost();
}
#endregion
@ -94,16 +105,37 @@ namespace BlueWaterProject
private void MoveShipPlayer()
{
var desiredVelocity = transform.forward * (movementInput.y * maxSpeed);
var speedChange = (movementInput.y != 0 ? acceleration : deceleration) * Time.fixedDeltaTime;
rb.velocity = Vector3.MoveTowards(rb.velocity, desiredVelocity, speedChange);
// var desiredVelocity = transform.forward * (movementInput.y * maxSpeed);
// var speedChange = (movementInput.y != 0 ? acceleration : deceleration) * Time.fixedDeltaTime;
// rb.velocity = Vector3.MoveTowards(rb.velocity, desiredVelocity, speedChange);
var speedChange = 0f;
Vector3 targetVelocity;
if (movementInput == Vector2.zero)
{
speedChange = deceleration * Time.fixedDeltaTime;
targetVelocity = Vector3.zero;
}
else
{
var boost = isBoosting ? boostPower : 1f;
var moveDirection = new Vector3(movementInput.x, 0, movementInput.y).normalized * (maxSpeed * boost);
speedChange = acceleration * boost * Time.fixedDeltaTime;
targetVelocity = moveDirection;
}
rb.velocity = Vector3.MoveTowards(rb.velocity, targetVelocity, speedChange);
}
private void RotatePlayer()
{
var turn = movementInput.x;
var turnRotation = Quaternion.Euler(0f, turn * turnSpeed, 0f);
rb.MoveRotation(rb.rotation * turnRotation);
// var turn = movementInput.x;
// var turnRotation = Quaternion.Euler(0f, turn * turnSpeed, 0f);
// rb.MoveRotation(rb.rotation * turnRotation);
if (rb.velocity == Vector3.zero) return;
var targetRotation = Quaternion.LookRotation(rb.velocity.normalized, Vector3.up);
rb.rotation = Quaternion.Slerp(rb.rotation, targetRotation, Time.fixedDeltaTime * turnSpeed);
}
private void HandleMovement()
@ -149,6 +181,22 @@ namespace BlueWaterProject
UiManager.Inst.OceanUi.ProcessBar.SetFillAmount(chargingGauge);
}
private void HandleBoost()
{
if (isBoosting)
{
UiManager.Inst.OceanUi.ShipBoostSlider.value += Time.deltaTime * (1f / boostMaxTime);
if (UiManager.Inst.OceanUi.ShipBoostSlider.value >= 1f)
{
ShipStopBoost();
}
}
else
{
UiManager.Inst.OceanUi.ShipBoostSlider.value -= Time.deltaTime * (1f / boostRecoveryTime);
}
}
#endregion
#region Interaction Key
@ -259,6 +307,25 @@ namespace BlueWaterProject
UiManager.Inst.OceanUi.ProcessBar.SetActiveReloadSlider(false);
}
private void ShipBoost()
{
if (UiManager.Inst.OceanUi.ShipBoostSlider.value >= 1f)
{
isBoosting = false;
}
else
{
isBoosting = true;
}
}
private void ShipStopBoost()
{
if (!isBoosting) return;
isBoosting = false;
}
#endregion
#region IDamageable

View File

@ -79,9 +79,10 @@ namespace BlueWaterProject
[field: Title("UI")]
[field: SerializeField] public ProcessBar ProcessBar { get; set; }
[field: SerializeField] public Image CannonFill { get; set; }
[SerializeField] private Vector3 processBarOffset = Vector3.zero;
[field: SerializeField] public Slider ShipBoostSlider { get; set; }
private Canvas canvas;
[Button("셋팅 초기화")]
@ -100,6 +101,9 @@ namespace BlueWaterProject
var reloadSlider = canvas.transform.Find("ReloadSlider").GetComponent<Slider>();
ProcessBar = new ProcessBar(processBar, fill, previousGaugeLine, reloadSlider);
ProcessBar.SetActiveReloadSlider(false);
ShipBoostSlider = canvas.transform.Find("ShipBoostSlider").GetComponent<Slider>();
ShipBoostSlider.value = 0f;
}
private void Awake()