diff --git a/Assets/Prefabs.meta b/Assets/Prefabs.meta
new file mode 100644
index 0000000..13d69fe
--- /dev/null
+++ b/Assets/Prefabs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c394f9af9b58ca8439cf15945c6d501c
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Prefabs/ClearCounter.prefab b/Assets/Prefabs/ClearCounter.prefab
new file mode 100644
index 0000000..e74cf89
--- /dev/null
+++ b/Assets/Prefabs/ClearCounter.prefab
@@ -0,0 +1,148 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &6869097019740516189
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 6371086230447438899}
+ - component: {fileID: 190913029279232345}
+ - component: {fileID: 7837983985068458341}
+ m_Layer: 6
+ m_Name: ClearCounter
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &6371086230447438899
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 6869097019740516189}
+ m_LocalRotation: {x: -0, y: -0.999996, z: -0, w: -0.0028347075}
+ m_LocalPosition: {x: -0.000021893527, y: 0, z: 3.0077405}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children:
+ - {fileID: 3231759315905380366}
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: -180.325, z: 0}
+--- !u!65 &190913029279232345
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 6869097019740516189}
+ m_Material: {fileID: 0}
+ m_IncludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_ExcludeLayers:
+ serializedVersion: 2
+ m_Bits: 0
+ m_LayerOverridePriority: 0
+ m_IsTrigger: 0
+ m_ProvidesContacts: 0
+ m_Enabled: 1
+ serializedVersion: 3
+ m_Size: {x: 1.5, y: 1.5, z: 1.5}
+ m_Center: {x: 0, y: 0.5, z: 0}
+--- !u!114 &7837983985068458341
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 6869097019740516189}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: bb159edc225081c408fe7a01d52732e4, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+--- !u!1001 &1398491922627355813
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ serializedVersion: 3
+ m_TransformParent: {fileID: 6371086230447438899}
+ m_Modifications:
+ - target: {fileID: 4589716710238282922, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_Name
+ value: ClearCounter_Visual
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_RemovedGameObjects: []
+ m_AddedGameObjects: []
+ m_AddedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 0004cb1e11ad014419b943c7da960724, type: 3}
+--- !u!4 &3231759315905380366 stripped
+Transform:
+ m_CorrespondingSourceObject: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
+ type: 3}
+ m_PrefabInstance: {fileID: 1398491922627355813}
+ m_PrefabAsset: {fileID: 0}
diff --git a/Assets/Prefabs/ClearCounter.prefab.meta b/Assets/Prefabs/ClearCounter.prefab.meta
new file mode 100644
index 0000000..4496f61
--- /dev/null
+++ b/Assets/Prefabs/ClearCounter.prefab.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f62bfcbfbc8097441a9fae9a02652a07
+PrefabImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scenes/GaneScene.unity b/Assets/Scenes/GaneScene.unity
index 7d48b3b..5c42f16 100644
--- a/Assets/Scenes/GaneScene.unity
+++ b/Assets/Scenes/GaneScene.unity
@@ -124,6 +124,79 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
+--- !u!1001 &295568153
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ serializedVersion: 3
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 8
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: -1.5000219
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 3.0077405
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: -0.0028347075
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: -0.999996
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: -180.325
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6869097019740516189, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_Name
+ value: ClearCounter (1)
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_RemovedGameObjects: []
+ m_AddedGameObjects: []
+ m_AddedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: f62bfcbfbc8097441a9fae9a02652a07, type: 3}
--- !u!1 &330585543
GameObject:
m_ObjectHideFlags: 0
@@ -666,6 +739,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
moveSpeed: 7
gameInput: {fileID: 721208334}
+ countersLayerMask:
+ serializedVersion: 2
+ m_Bits: 64
--- !u!1001 &1075657335
PrefabInstance:
m_ObjectHideFlags: 0
@@ -909,139 +985,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
---- !u!1001 &1262360141
-PrefabInstance:
- m_ObjectHideFlags: 0
- serializedVersion: 2
- m_Modification:
- serializedVersion: 3
- m_TransformParent: {fileID: 1573310043}
- m_Modifications:
- - target: {fileID: 4589716710238282922, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_Name
- value: ClearCounter_Visual
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_RootOrder
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalPosition.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalPosition.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalPosition.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalRotation.w
- value: 1
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalRotation.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalRotation.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalRotation.z
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalEulerAnglesHint.x
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalEulerAnglesHint.y
- value: 0
- objectReference: {fileID: 0}
- - target: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- propertyPath: m_LocalEulerAnglesHint.z
- value: 0
- objectReference: {fileID: 0}
- m_RemovedComponents: []
- m_RemovedGameObjects: []
- m_AddedGameObjects: []
- m_AddedComponents: []
- m_SourcePrefab: {fileID: 100100000, guid: 0004cb1e11ad014419b943c7da960724, type: 3}
---- !u!4 &1262360142 stripped
-Transform:
- m_CorrespondingSourceObject: {fileID: 4589716710238282923, guid: 0004cb1e11ad014419b943c7da960724,
- type: 3}
- m_PrefabInstance: {fileID: 1262360141}
- m_PrefabAsset: {fileID: 0}
---- !u!1 &1573310041
-GameObject:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- serializedVersion: 6
- m_Component:
- - component: {fileID: 1573310043}
- - component: {fileID: 1573310042}
- m_Layer: 0
- m_Name: ClearCounter
- m_TagString: Untagged
- m_Icon: {fileID: 0}
- m_NavMeshLayer: 0
- m_StaticEditorFlags: 0
- m_IsActive: 1
---- !u!65 &1573310042
-BoxCollider:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 1573310041}
- m_Material: {fileID: 0}
- m_IncludeLayers:
- serializedVersion: 2
- m_Bits: 0
- m_ExcludeLayers:
- serializedVersion: 2
- m_Bits: 0
- m_LayerOverridePriority: 0
- m_IsTrigger: 0
- m_ProvidesContacts: 0
- m_Enabled: 1
- serializedVersion: 3
- m_Size: {x: 1.5, y: 1.5, z: 1.5}
- m_Center: {x: 0, y: 0.5, z: 0}
---- !u!4 &1573310043
-Transform:
- m_ObjectHideFlags: 0
- m_CorrespondingSourceObject: {fileID: 0}
- m_PrefabInstance: {fileID: 0}
- m_PrefabAsset: {fileID: 0}
- m_GameObject: {fileID: 1573310041}
- m_LocalRotation: {x: -0, y: -0.999996, z: -0, w: -0.0028347075}
- m_LocalPosition: {x: -0.000021893527, y: 0, z: 3.0077405}
- m_LocalScale: {x: 1, y: 1, z: 1}
- m_ConstrainProportionsScale: 0
- m_Children:
- - {fileID: 1262360142}
- m_Father: {fileID: 0}
- m_RootOrder: 7
- m_LocalEulerAnglesHint: {x: 0, y: -180.325, z: 0}
--- !u!1 &2099865127
GameObject:
m_ObjectHideFlags: 0
@@ -1114,3 +1057,76 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 46, y: 0, z: 0}
+--- !u!1001 &8218183545890461205
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ serializedVersion: 3
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 7
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: -0.000021893527
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 3.0077405
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: -0.0028347075
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: -0.999996
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: -0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: -180.325
+ objectReference: {fileID: 0}
+ - target: {fileID: 6371086230447438899, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6869097019740516189, guid: f62bfcbfbc8097441a9fae9a02652a07,
+ type: 3}
+ propertyPath: m_Name
+ value: ClearCounter
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_RemovedGameObjects: []
+ m_AddedGameObjects: []
+ m_AddedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: f62bfcbfbc8097441a9fae9a02652a07, type: 3}
diff --git a/Assets/Scripts/ClearCounter.cs b/Assets/Scripts/ClearCounter.cs
new file mode 100644
index 0000000..26fdb44
--- /dev/null
+++ b/Assets/Scripts/ClearCounter.cs
@@ -0,0 +1,13 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class ClearCounter : MonoBehaviour
+{
+
+ public void Interact()
+ {
+ Debug.Log("Interacted!");
+ }
+
+}
diff --git a/Assets/Scripts/ClearCounter.cs.meta b/Assets/Scripts/ClearCounter.cs.meta
new file mode 100644
index 0000000..38e3e8b
--- /dev/null
+++ b/Assets/Scripts/ClearCounter.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bb159edc225081c408fe7a01d52732e4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs
index e6e9e94..09e8542 100644
--- a/Assets/Scripts/Player.cs
+++ b/Assets/Scripts/Player.cs
@@ -7,12 +7,15 @@ public class Player : MonoBehaviour
[SerializeField] private float moveSpeed = 7f;
[SerializeField] private GameInput gameInput;
+ [SerializeField] private LayerMask countersLayerMask;
private bool isWalking;
+ private Vector3 lastInteractDir;
private void Update()
{
HandleMovement();
+ HandleInteractions();
}
public bool IsWalking()
@@ -20,6 +23,36 @@ public class Player : MonoBehaviour
return isWalking;
}
+ ///
+ /// Handle object interactions.
+ ///
+ private void HandleInteractions()
+ {
+ Vector2 inputVector = gameInput.GetMovementVectorNormalized();
+
+ Vector3 moveDir = new Vector3(inputVector.x, 0f, inputVector.y);
+
+ // Kepp a constantly updating record of the last move direction.
+ // This means you can interact without holding down a direction.
+ if (moveDir != Vector3.zero)
+ {
+ lastInteractDir = moveDir;
+ }
+
+ float interactDistance = 2f;
+ if (Physics.Raycast(transform.position, lastInteractDir, out RaycastHit raycastHit, interactDistance, countersLayerMask))
+ {
+ if (raycastHit.transform.TryGetComponent(out ClearCounter clearCounter))
+ {
+ // Has Clear Counter
+ clearCounter.Interact();
+ }
+ }
+ }
+
+ ///
+ /// Handle the player movement and collision.
+ ///
private void HandleMovement()
{
Vector2 inputVector = gameInput.GetMovementVectorNormalized();
diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset
index 1c92a78..4e50354 100644
--- a/ProjectSettings/TagManager.asset
+++ b/ProjectSettings/TagManager.asset
@@ -11,7 +11,7 @@ TagManager:
-
- Water
- UI
- -
+ - Counters
-
-
-