Skip to content

Commit cfe13da

Browse files
player
's actions converted
1 parent f253378 commit cfe13da

File tree

5 files changed

+195
-67
lines changed

5 files changed

+195
-67
lines changed

Assets/InputSystem/PlayerActions.inputactions

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"name": "Attack",
2828
"type": "Button",
2929
"id": "6c2ab1b8-8984-453a-af3d-a3c78ae1679a",
30-
"expectedControlType": "Button",
30+
"expectedControlType": "",
3131
"processors": "",
3232
"interactions": "",
3333
"initialStateCheck": false
@@ -36,7 +36,7 @@
3636
"name": "Interact",
3737
"type": "Button",
3838
"id": "852140f2-7766-474d-8707-702459ba45f3",
39-
"expectedControlType": "Button",
39+
"expectedControlType": "",
4040
"processors": "",
4141
"interactions": "Hold",
4242
"initialStateCheck": false
@@ -45,7 +45,7 @@
4545
"name": "Crouch",
4646
"type": "Button",
4747
"id": "27c5f898-bc57-4ee1-8800-db469aca5fe3",
48-
"expectedControlType": "Button",
48+
"expectedControlType": "",
4949
"processors": "",
5050
"interactions": "",
5151
"initialStateCheck": false
@@ -54,7 +54,7 @@
5454
"name": "Jump",
5555
"type": "Button",
5656
"id": "f1ba0d36-48eb-4cd5-b651-1c94a6531f70",
57-
"expectedControlType": "Button",
57+
"expectedControlType": "",
5858
"processors": "",
5959
"interactions": "",
6060
"initialStateCheck": false
@@ -63,7 +63,7 @@
6363
"name": "Previous",
6464
"type": "Button",
6565
"id": "2776c80d-3c14-4091-8c56-d04ced07a2b0",
66-
"expectedControlType": "Button",
66+
"expectedControlType": "",
6767
"processors": "",
6868
"interactions": "",
6969
"initialStateCheck": false
@@ -72,7 +72,7 @@
7272
"name": "Next",
7373
"type": "Button",
7474
"id": "b7230bb6-fc9b-4f52-8b25-f5e19cb2c2ba",
75-
"expectedControlType": "Button",
75+
"expectedControlType": "",
7676
"processors": "",
7777
"interactions": "",
7878
"initialStateCheck": false
@@ -81,7 +81,7 @@
8181
"name": "Sprint",
8282
"type": "Button",
8383
"id": "641cd816-40e6-41b4-8c3d-04687c349290",
84-
"expectedControlType": "Button",
84+
"expectedControlType": "",
8585
"processors": "",
8686
"interactions": "",
8787
"initialStateCheck": false
@@ -193,6 +193,33 @@
193193
"processors": "",
194194
"interactions": "",
195195
"initialStateCheck": false
196+
},
197+
{
198+
"name": "Target",
199+
"type": "Button",
200+
"id": "43b99b7b-ca7a-4ef6-9d13-2751c2d2b3aa",
201+
"expectedControlType": "",
202+
"processors": "",
203+
"interactions": "",
204+
"initialStateCheck": false
205+
},
206+
{
207+
"name": "Skill1",
208+
"type": "Button",
209+
"id": "b97db0db-4f74-415d-99bf-8b754bfa6827",
210+
"expectedControlType": "",
211+
"processors": "",
212+
"interactions": "",
213+
"initialStateCheck": false
214+
},
215+
{
216+
"name": "Point",
217+
"type": "PassThrough",
218+
"id": "577651e7-bedb-409c-bba8-513e74e03e3b",
219+
"expectedControlType": "Vector2",
220+
"processors": "",
221+
"interactions": "",
222+
"initialStateCheck": true
196223
}
197224
],
198225
"bindings": [
@@ -734,6 +761,50 @@
734761
"action": "ToggleCheats",
735762
"isComposite": false,
736763
"isPartOfComposite": false
764+
},
765+
{
766+
"name": "",
767+
"id": "571fb49b-094d-4788-b76c-68863ac01164",
768+
"path": "<Mouse>/leftButton",
769+
"interactions": "",
770+
"processors": "",
771+
"groups": ";Keyboard&Mouse",
772+
"action": "Target",
773+
"isComposite": false,
774+
"isPartOfComposite": false
775+
},
776+
{
777+
"name": "",
778+
"id": "8817849f-00f0-4640-a383-abfd3a812ade",
779+
"path": "<Touchscreen>/primaryTouch/tap",
780+
"interactions": "",
781+
"processors": "",
782+
"groups": ";Touch",
783+
"action": "Target",
784+
"isComposite": false,
785+
"isPartOfComposite": false
786+
},
787+
{
788+
"name": "",
789+
"id": "03468fd1-8d67-488b-ba05-2dd82ef9c830",
790+
"path": "<Mouse>/rightButton",
791+
"interactions": "",
792+
"processors": "",
793+
"groups": ";Keyboard&Mouse",
794+
"action": "Skill1",
795+
"isComposite": false,
796+
"isPartOfComposite": false
797+
},
798+
{
799+
"name": "",
800+
"id": "de7a02bc-5cc4-4d3e-b7f7-3b6ea4e56a69",
801+
"path": "<Mouse>/position",
802+
"interactions": "",
803+
"processors": "",
804+
"groups": "",
805+
"action": "Point",
806+
"isComposite": false,
807+
"isPartOfComposite": false
737808
}
738809
]
739810
},
@@ -754,7 +825,7 @@
754825
"name": "Submit",
755826
"type": "Button",
756827
"id": "7607c7b6-cd76-4816-beef-bd0341cfe950",
757-
"expectedControlType": "Button",
828+
"expectedControlType": "",
758829
"processors": "",
759830
"interactions": "",
760831
"initialStateCheck": false
@@ -763,7 +834,7 @@
763834
"name": "Cancel",
764835
"type": "Button",
765836
"id": "15cef263-9014-4fd5-94d9-4e4a6234a6ef",
766-
"expectedControlType": "Button",
837+
"expectedControlType": "",
767838
"processors": "",
768839
"interactions": "",
769840
"initialStateCheck": false

Assets/Prefabs/Actions/ClientAoeInput.prefab

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ Transform:
2424
m_PrefabInstance: {fileID: 0}
2525
m_PrefabAsset: {fileID: 0}
2626
m_GameObject: {fileID: 2317072454108786653}
27+
serializedVersion: 2
2728
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
2829
m_LocalPosition: {x: 0, y: 0, z: 0}
2930
m_LocalScale: {x: 1, y: 1, z: 1}
31+
m_ConstrainProportionsScale: 0
3032
m_Children:
3133
- {fileID: 519043390440476}
3234
- {fileID: 7786310081837396287}
3335
m_Father: {fileID: 0}
34-
m_RootOrder: 0
3536
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
3637
--- !u!114 &8447158110562487606
3738
MonoBehaviour:
@@ -47,6 +48,8 @@ MonoBehaviour:
4748
m_EditorClassIdentifier:
4849
m_InRangeVisualization: {fileID: 4372974839826446078}
4950
m_OutOfRangeVisualization: {fileID: 3023808054957408081}
51+
m_PointAction: {fileID: -1959881153152325168, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
52+
m_TargetAction: {fileID: -2762237389118783121, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
5053
--- !u!1 &3023808054957408081
5154
GameObject:
5255
m_ObjectHideFlags: 0
@@ -72,12 +75,13 @@ Transform:
7275
m_PrefabInstance: {fileID: 0}
7376
m_PrefabAsset: {fileID: 0}
7477
m_GameObject: {fileID: 3023808054957408081}
78+
serializedVersion: 2
7579
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
7680
m_LocalPosition: {x: 0, y: 0.025, z: 0}
7781
m_LocalScale: {x: 0.125, y: 0.125, z: 0.125}
82+
m_ConstrainProportionsScale: 0
7883
m_Children: []
7984
m_Father: {fileID: 6459207307567452869}
80-
m_RootOrder: 0
8185
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
8286
--- !u!33 &2938808106645325272
8387
MeshFilter:
@@ -98,11 +102,15 @@ MeshRenderer:
98102
m_CastShadows: 0
99103
m_ReceiveShadows: 1
100104
m_DynamicOccludee: 1
105+
m_StaticShadowCaster: 0
101106
m_MotionVectors: 1
102107
m_LightProbeUsage: 1
103108
m_ReflectionProbeUsage: 1
104109
m_RayTracingMode: 2
105110
m_RayTraceProcedural: 0
111+
m_RayTracingAccelStructBuildFlagsOverride: 0
112+
m_RayTracingAccelStructBuildFlags: 1
113+
m_SmallMeshCulling: 1
106114
m_RenderingLayerMask: 1
107115
m_RendererPriority: 0
108116
m_Materials:
@@ -153,12 +161,13 @@ Transform:
153161
m_PrefabInstance: {fileID: 0}
154162
m_PrefabAsset: {fileID: 0}
155163
m_GameObject: {fileID: 4372974839826446078}
164+
serializedVersion: 2
156165
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
157166
m_LocalPosition: {x: 0, y: 0.025, z: 0}
158167
m_LocalScale: {x: 0.125, y: 0.125, z: 0.125}
168+
m_ConstrainProportionsScale: 0
159169
m_Children: []
160170
m_Father: {fileID: 6459207307567452869}
161-
m_RootOrder: 1
162171
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
163172
--- !u!33 &5292373250812076600
164173
MeshFilter:
@@ -179,11 +188,15 @@ MeshRenderer:
179188
m_CastShadows: 0
180189
m_ReceiveShadows: 1
181190
m_DynamicOccludee: 1
191+
m_StaticShadowCaster: 0
182192
m_MotionVectors: 1
183193
m_LightProbeUsage: 1
184194
m_ReflectionProbeUsage: 1
185195
m_RayTracingMode: 2
186196
m_RayTraceProcedural: 0
197+
m_RayTracingAccelStructBuildFlagsOverride: 0
198+
m_RayTracingAccelStructBuildFlags: 1
199+
m_SmallMeshCulling: 1
187200
m_RenderingLayerMask: 1
188201
m_RendererPriority: 0
189202
m_Materials:

Assets/Prefabs/Character/PlayerAvatar.prefab

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,12 @@ MonoBehaviour:
292292
m_EditorClassIdentifier:
293293
ShowTopMostFoldoutHeaderGroup: 1
294294
m_ServerCharacter: {fileID: 741733315856861890}
295+
m_TargetAction: {fileID: -2762237389118783121, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
296+
m_Skill1Action: {fileID: 2701198716142841280, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
297+
m_PointAction: {fileID: -1959881153152325168, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
295298
m_Action1: {fileID: 916937064669491580, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
296299
m_Action2: {fileID: 2288820758043559878, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
297300
m_Action3: {fileID: 6071755229503605740, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
298-
m_Action4: {fileID: -4952775069611586389, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
299301
m_Action5: {fileID: -1289729065238941167, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
300302
m_Action6: {fileID: -1072022056946843674, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}
301303
m_Action7: {fileID: 5111210855846757706, guid: add476edce0d24d26bcdaf1681449ecf, type: 3}

Assets/Scripts/Gameplay/Action/Input/AoeActionInput.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Unity.BossRoom.Gameplay.GameplayObjects;
22
using UnityEngine;
33
using UnityEngine.AI;
4+
using UnityEngine.InputSystem;
45

56
namespace Unity.BossRoom.Gameplay.Actions
67
{
@@ -18,6 +19,12 @@ public class AoeActionInput : BaseActionInput
1819

1920
[SerializeField]
2021
GameObject m_OutOfRangeVisualization;
22+
23+
[SerializeField]
24+
InputActionReference m_PointAction;
25+
26+
[SerializeField]
27+
InputActionReference m_TargetAction;
2128

2229
Camera m_Camera;
2330

@@ -45,24 +52,24 @@ void Start()
4552
void Update()
4653
{
4754
// TODO: convert to mouse position using new input system
48-
/*if (PlaneRaycast(k_Plane, m_Camera.ScreenPointToRay(Input.mousePosition), out Vector3 pointOnPlane) &&
55+
if (PlaneRaycast(k_Plane, m_Camera.ScreenPointToRay(m_PointAction.action.ReadValue<Vector2>()), out Vector3 pointOnPlane) &&
4956
NavMesh.SamplePosition(pointOnPlane, out m_NavMeshHit, 2f, NavMesh.AllAreas))
5057
{
5158
transform.position = m_NavMeshHit.position;
52-
}*/
59+
}
5360

5461
float range = GameDataSource.Instance.GetActionPrototypeByID(m_ActionPrototypeID).Config.Range;
5562
bool isInRange = (m_Origin - transform.position).sqrMagnitude <= range * range;
5663
m_InRangeVisualization.SetActive(isInRange);
5764
m_OutOfRangeVisualization.SetActive(!isInRange);
5865

5966
// wait for the player to click down and then release the mouse button before actually taking the input
60-
if (Input.GetMouseButtonDown(0))
67+
if (m_TargetAction.action.WasPressedThisFrame())
6168
{
6269
m_ReceivedMouseDownEvent = true;
6370
}
6471

65-
if (Input.GetMouseButtonUp(0) && m_ReceivedMouseDownEvent)
72+
if (m_TargetAction.action.WasReleasedThisFrame() && m_ReceivedMouseDownEvent)
6673
{
6774
if (isInRange)
6875
{

0 commit comments

Comments
 (0)