From 6f2125d2cd1607b8fb70db652607adc84fd9346c Mon Sep 17 00:00:00 2001
From: miepzerino <o.skotnik@gmail.com>
Date: Fri, 22 Dec 2023 19:40:59 +0000
Subject: [PATCH] Added drilling function to player
---
Assets/Characters/Player/Player.prefab | 7
Assets/Scripts/Enums/DrillDirection.cs.meta | 11
Assets/Scripts/Managers/GameManager.cs | 21 +
Assets/Scripts/PlayerController.cs | 73 +++
Assets/Scripts/Enums/DrillDirection.cs | 14
Assets/Scenes/GameplayScene.unity | 934 ++++++++++--------------------------------------
Assets/Scripts/Events/CharacterEvents.cs | 2
Assets/Scripts/TouchingDirections.cs | 42 +
8 files changed, 356 insertions(+), 748 deletions(-)
diff --git a/Assets/Characters/Player/Player.prefab b/Assets/Characters/Player/Player.prefab
index 4b725e2..2c4a01b 100644
--- a/Assets/Characters/Player/Player.prefab
+++ b/Assets/Characters/Player/Player.prefab
@@ -241,8 +241,10 @@
maxFallSpeed: -20
maxFallSpeedDamge: -10
rotorGO: {fileID: 1519978218308964847}
+ drillingTime: 1
_isMoving: 0
_isFlying: 0
+ _isDrilling: 0
--- !u!114 &6914713383366050867
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -385,7 +387,7 @@
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.7205616, y: 0.7178567}
- m_EdgeRadius: 0.12
+ m_EdgeRadius: 0
--- !u!95 &2451348752795735853
Animator:
serializedVersion: 5
@@ -438,7 +440,8 @@
ceilingDistance: 0.05
rotorGO: {fileID: 1519978218308964847}
_isGrounded: 1
- _isAtWall: 0
+ _isAtWallLeft: 0
+ _isAtWallRight: 0
_isAtCeiling: 0
--- !u!114 &2350719025294399868
MonoBehaviour:
diff --git a/Assets/Scenes/GameplayScene.unity b/Assets/Scenes/GameplayScene.unity
index 36bc663..42df583 100644
--- a/Assets/Scenes/GameplayScene.unity
+++ b/Assets/Scenes/GameplayScene.unity
@@ -909,6 +909,67 @@
m_CorrespondingSourceObject: {fileID: 2368348636056148999, guid: c220ec455fce341408d66d880b464cad, type: 3}
m_PrefabInstance: {fileID: 257677327013671455}
m_PrefabAsset: {fileID: 0}
+--- !u!1001 &318061306
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ serializedVersion: 3
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 2563239544192693220, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_Name
+ value: AudioManager
+ objectReference: {fileID: 0}
+ - target: {fileID: 2563239544192693220, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_StaticEditorFlags
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalPosition.z
+ value: -10
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6382851984236710143, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_RemovedGameObjects: []
+ m_AddedGameObjects: []
+ m_AddedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 6b54c0762333ea34a93ec05ccbb1330f, type: 3}
--- !u!1001 &391227262
PrefabInstance:
m_ObjectHideFlags: 0
@@ -4071,6 +4132,7 @@
- component: {fileID: 1919262560}
- component: {fileID: 1919262562}
- component: {fileID: 1919262561}
+ - component: {fileID: 1919262563}
m_Layer: 6
m_Name: Tilemap
m_TagString: Untagged
@@ -4087,7 +4149,7 @@
m_GameObject: {fileID: 1919262556}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalPosition: {x: -128, y: -257, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -4150,718 +4212,152 @@
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1919262556}
m_Enabled: 1
- m_Tiles:
- - first: {x: -3, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 8
- m_TileSpriteIndex: 8
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -2, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -1, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 0, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 1, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 2, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 3, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 4, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 5, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 6, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 7, y: -5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 6
- m_TileSpriteIndex: 6
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -3, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 4
- m_TileSpriteIndex: 4
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -2, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -1, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 0, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 1, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 2, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 3, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 4, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 5, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 6, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 7, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 5
- m_TileSpriteIndex: 5
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 10, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 8
- m_TileSpriteIndex: 8
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 11, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 7
- m_TileSpriteIndex: 7
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 12, y: -4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 6
- m_TileSpriteIndex: 6
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -3, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 4
- m_TileSpriteIndex: 4
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -2, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -1, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 0, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 1, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 2, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 3, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 4, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 5, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 6, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 7, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 5
- m_TileSpriteIndex: 5
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 10, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 4
- m_TileSpriteIndex: 4
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 11, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 1
- m_TileSpriteIndex: 1
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 12, y: -3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 5
- m_TileSpriteIndex: 5
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 11
- m_TileSpriteIndex: 10
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -3, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 14
- m_TileSpriteIndex: 14
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -2, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -1, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 0, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 1, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 2, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 3, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 4, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 5, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 6, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 7, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 2
- m_TileSpriteIndex: 2
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 10, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 3
- m_TileSpriteIndex: 13
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 11, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 0
- m_TileSpriteIndex: 0
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: 12, y: -2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 2
- m_TileSpriteIndex: 2
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: -1, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 13
- m_TileSpriteIndex: 12
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: 0, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 13
- m_TileSpriteIndex: 12
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: 1, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 13
- m_TileSpriteIndex: 12
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: 2, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 13
- m_TileSpriteIndex: 12
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: 3, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 13
- m_TileSpriteIndex: 12
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: 4, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 13
- m_TileSpriteIndex: 12
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
- - first: {x: -4, y: 5, z: 0}
- second:
- serializedVersion: 2
- m_TileIndex: 12
- m_TileSpriteIndex: 11
- m_TileMatrixIndex: 0
- m_TileColorIndex: 0
- m_TileObjectToInstantiateIndex: 65535
- dummyAlignment: 0
- m_AllTileFlags: 1073741825
+ m_Tiles: {}
m_AnimatedTiles: {}
m_TileAssetArray:
- - m_RefCount: 10
- m_Data: {fileID: 11400000, guid: 4739629ac582554429a2c7712d4a7932, type: 2}
- - m_RefCount: 19
- m_Data: {fileID: 11400000, guid: 6710ea292eefe0a409010947812e5a30, type: 2}
- - m_RefCount: 2
- m_Data: {fileID: 11400000, guid: 64ff2ae85e189834b9b4c888886420ff, type: 2}
- - m_RefCount: 1
- m_Data: {fileID: 11400000, guid: 45f6756a69eb96b44ba8f63785bcf482, type: 2}
- - m_RefCount: 3
- m_Data: {fileID: 11400000, guid: 9f954b09168e28446a41aaab42edc51d, type: 2}
- - m_RefCount: 3
- m_Data: {fileID: 11400000, guid: 5ad6b588bfcb8a34a8229c9d744b26da, type: 2}
- - m_RefCount: 2
- m_Data: {fileID: 11400000, guid: 4841979de4e58dc4c89b3accf7443e63, type: 2}
- - m_RefCount: 10
- m_Data: {fileID: 11400000, guid: 18f9684c26627104ba352b92d7c5450e, type: 2}
- - m_RefCount: 2
- m_Data: {fileID: 11400000, guid: ef98d0a287bc82d4a9359dd067c16c3d, type: 2}
- m_RefCount: 0
m_Data: {fileID: 0}
- m_RefCount: 0
m_Data: {fileID: 0}
- - m_RefCount: 1
- m_Data: {fileID: 11400000, guid: 3d59b10114dd8374795cb84c123617a9, type: 2}
- - m_RefCount: 1
- m_Data: {fileID: 11400000, guid: 5c4d4b6bc091bf54f89d2cec7f234b99, type: 2}
- - m_RefCount: 6
- m_Data: {fileID: 11400000, guid: 4e9d6d19d0ce36a48980f6c99950197d, type: 2}
- - m_RefCount: 1
- m_Data: {fileID: 11400000, guid: f4366b87b66653d41951ee029322b421, type: 2}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
m_TileSpriteArray:
- - m_RefCount: 10
- m_Data: {fileID: -1554015212, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 19
- m_Data: {fileID: 68800321, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 2
- m_Data: {fileID: 952801214, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- m_RefCount: 0
m_Data: {fileID: 0}
- - m_RefCount: 3
- m_Data: {fileID: -1701200628, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 3
- m_Data: {fileID: -1608621674, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 2
- m_Data: {fileID: -1438444955, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 10
- m_Data: {fileID: -603009601, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 2
- m_Data: {fileID: 1210147125, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- m_RefCount: 0
m_Data: {fileID: 0}
- - m_RefCount: 1
- m_Data: {fileID: 663754295, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 1
- m_Data: {fileID: 1397353389, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 6
- m_Data: {fileID: -19378075, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 1
- m_Data: {fileID: -1200237691, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
- - m_RefCount: 1
- m_Data: {fileID: 1451081626, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
+ - m_RefCount: 0
+ m_Data: {fileID: 0}
m_TileMatrixArray:
- - m_RefCount: 61
+ - m_RefCount: 0
m_Data:
- e00: 1
+ e00: 0
+ e01: 0
+ e02: 5.5000076
+ e03: 5.5000076
+ e10: 0
+ e11: 0
+ e12: 6.95e-43
+ e13: 6.95e-43
+ e20: 1.1215021e-15
+ e21: 8.91894e+31
+ e22: -9.3987e-28
+ e23: -1.130028e-19
+ e30: 4.5905e-41
+ e31: 6.98e-43
+ e32: 6.95e-43
+ e33: 6.98e-43
+ - m_RefCount: 0
+ m_Data:
+ e00: 0
e01: 0
e02: 0
- e03: 0
+ e03: 8.2592184e+23
e10: 0
- e11: 1
+ e11: 0
e12: 0
- e13: 0
+ e13: 1.06e-43
e20: 0
e21: 0
- e22: 1
+ e22: 4.719261e-16
e23: 0
e30: 0
e31: 0
- e32: 0
- e33: 1
+ e32: 4.5905e-41
+ e33: 0
+ - m_RefCount: 0
+ m_Data:
+ e00: 0
+ e01: 0
+ e02: 5.5000076
+ e03: 5.5000076
+ e10: 0
+ e11: 0
+ e12: 6.95e-43
+ e13: 6.95e-43
+ e20: 1.1215021e-15
+ e21: 14.638138
+ e22: -1.3211928e-28
+ e23: -1.093541e-19
+ e30: 4.5905e-41
+ e31: 6.98e-43
+ e32: 6.95e-43
+ e33: 6.98e-43
m_TileColorArray:
- - m_RefCount: 61
- m_Data: {r: 1, g: 1, b: 1, a: 1}
+ - m_RefCount: 0
+ m_Data: {r: 4.4012e-41, g: 4.4012e-41, b: 4.4012e-41, a: 4.4012e-41}
m_TileObjectToInstantiateArray: []
m_AnimationFrameRate: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Origin: {x: -4, y: -5, z: 0}
- m_Size: {x: 17, y: 11, z: 1}
+ m_Size: {x: 145, y: 263, z: 1}
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
m_TileOrientation: 0
m_TileOrientationMatrix:
e00: 1
e01: 0
e02: 0
- e03: 0
+ e03: -128
e10: 0
e11: 1
e12: 0
- e13: 0
+ e13: -257
e20: 0
e21: 0
e22: 1
@@ -4944,66 +4440,9 @@
m_EdgeRadius: 0
m_ColliderPaths:
- m_Collider: {fileID: 1919262560}
- m_ColliderPaths:
- - - X: 80000000
- Y: -45000000
- - X: 80000000
- Y: -10000000
- - X: -30000000
- Y: -10000000
- - X: -30000000
- Y: 55625000
- - X: -35000000
- Y: 60000000
- - X: -40000000
- Y: 60000000
- - X: -40000000
- Y: -20000000
- - X: -30000000
- Y: -20000000
- - X: -30000000
- Y: -43750000
- - X: -28125000
- Y: -47500000
- - X: -23750000
- Y: -50000000
- - X: 76250000
- Y: -50000000
- - - X: 130000000
- Y: -35000000
- - X: 130000000
- Y: -10000000
- - X: 100000000
- Y: -10000000
- - X: 100000000
- Y: -33750000
- - X: 101875000
- Y: -37500000
- - X: 106250000
- Y: -40000000
- - X: 126250000
- Y: -40000000
+ m_ColliderPaths: []
m_CompositePaths:
- m_Paths:
- - - {x: 7.624987, y: -5}
- - {x: 8, y: -4.4999914}
- - {x: 7.9999704, y: -1}
- - {x: -3, y: -0.9999706}
- - {x: -3.0000088, y: 5.5625076}
- - {x: -3.5000095, y: 6}
- - {x: -4, y: 5.999971}
- - {x: -3.999971, y: -2}
- - {x: -3, y: -2.0000293}
- - {x: -2.9999971, y: -4.3750057}
- - {x: -2.8124933, y: -4.750004}
- - {x: -2.3749933, y: -5}
- - - {x: 12.624988, y: -4}
- - {x: 13, y: -3.4999917}
- - {x: 12.99997, y: -1}
- - {x: 10, y: -1.0000293}
- - {x: 10.000003, y: -3.3750057}
- - {x: 10.187507, y: -3.7500036}
- - {x: 10.625007, y: -4}
+ m_Paths: []
m_VertexDistance: 0.0005
m_OffsetDistance: 0.00005
m_UseDelaunayMesh: 0
@@ -5035,6 +4474,24 @@
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 0
+--- !u!114 &1919262563
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1919262556}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 000b2ca4a3c14d04e8c8a5c1084c700f, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ width: 256
+ height: 256
+ scale: 20
+ offsetX: 0
+ offsetY: 0
+ ruleTile: {fileID: 11400000, guid: e77c00aec3ec74f4a9ec15ef63c3f9a7, type: 2}
--- !u!1 &1990316377
GameObject:
m_ObjectHideFlags: 0
@@ -5443,6 +4900,10 @@
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6908574976455911116, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
+ propertyPath: tilemap
+ value:
+ objectReference: {fileID: 1919262559}
+ - target: {fileID: 6908574976455911116, guid: 7296d9a2424531f4ba42c0c75e9c48a0, type: 3}
propertyPath: playerUI
value:
objectReference: {fileID: 2064964502}
@@ -5551,3 +5012,4 @@
- {fileID: 1409843026}
- {fileID: 1406521045}
- {fileID: 1007461191}
+ - {fileID: 318061306}
diff --git a/Assets/Scripts/Enums/DrillDirection.cs b/Assets/Scripts/Enums/DrillDirection.cs
new file mode 100644
index 0000000..628eaa8
--- /dev/null
+++ b/Assets/Scripts/Enums/DrillDirection.cs
@@ -0,0 +1,14 @@
+using System.Reflection;
+using System;
+using UnityEditor;
+using UnityEngine;
+
+namespace Assets.Scripts.Enums
+{
+ public enum DrillDirection
+ {
+ Down = 0,
+ Left = 1,
+ Right = 2,
+ }
+}
\ No newline at end of file
diff --git a/Assets/Scripts/Enums/DrillDirection.cs.meta b/Assets/Scripts/Enums/DrillDirection.cs.meta
new file mode 100644
index 0000000..f39da89
--- /dev/null
+++ b/Assets/Scripts/Enums/DrillDirection.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a7ea500286a4ad546a302321e505e495
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Events/CharacterEvents.cs b/Assets/Scripts/Events/CharacterEvents.cs
index 616086a..5d4e7f6 100644
--- a/Assets/Scripts/Events/CharacterEvents.cs
+++ b/Assets/Scripts/Events/CharacterEvents.cs
@@ -1,3 +1,4 @@
+using Assets.Scripts.Enums;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -7,4 +8,5 @@
{
public static UnityAction<GameObject, int> characterDamaged;
public static UnityAction<GameObject, int> characterHealed;
+ public static UnityAction<ContactPoint2D, DrillDirection> characterDrill;
}
diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs
index 0347568..c7925d3 100644
--- a/Assets/Scripts/Managers/GameManager.cs
+++ b/Assets/Scripts/Managers/GameManager.cs
@@ -5,6 +5,7 @@
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
+using UnityEngine.Tilemaps;
public class GameManager : SettingsManager
{
@@ -12,6 +13,7 @@
public GameObject healthTextPrefab;
public Canvas playerUI;
public Canvas pauseMenuUI;
+ public Tilemap tilemap;
private void Awake()
{
@@ -23,6 +25,7 @@
// add listen events
CharacterEvents.characterDamaged += (CharacterTookDamange);
CharacterEvents.characterHealed += (CharacterHealed);
+ CharacterEvents.characterDrill += (CharacterDrill);
}
@@ -31,6 +34,7 @@
// remove listen events
CharacterEvents.characterDamaged -= (CharacterTookDamange);
CharacterEvents.characterHealed -= (CharacterHealed);
+ CharacterEvents.characterDrill -= (CharacterDrill);
}
public void CharacterTookDamange(GameObject character, int damageReceived)
@@ -53,6 +57,23 @@
tmpText.text = healthRestored.ToString();
}
+ public void CharacterDrill(ContactPoint2D contact, DrillDirection drillDirection)
+ {
+ Vector3Int cellCoord = tilemap.transform.GetComponentInParent<GridLayout>().WorldToCell(contact.point);
+ switch(drillDirection)
+ {
+ case DrillDirection.Left:
+ cellCoord.x = cellCoord.x - 1;
+ break;
+ case DrillDirection.Right:
+ cellCoord.x = cellCoord.x + 1;
+ break;
+ case DrillDirection.Down:
+ cellCoord.y = cellCoord.y - 1;
+ break;
+ }
+ tilemap.SetTile(cellCoord, null);
+ }
public void GameLoaded()
{
pauseMenuUI.GetComponent<Animator>().SetTrigger("GameLoaded");
diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs
index 8480803..1ab8309 100644
--- a/Assets/Scripts/PlayerController.cs
+++ b/Assets/Scripts/PlayerController.cs
@@ -1,8 +1,12 @@
+using Assets.Scripts.Enums;
using Assets.Scripts.Helpers;
using System;
+using System.Collections;
using System.ComponentModel.Design;
+using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.InputSystem;
+using UnityEngine.Tilemaps;
[RequireComponent(typeof(Rigidbody2D))]
public class PlayerController : MonoBehaviour
@@ -13,13 +17,19 @@
private float maxFallSpeedCurrent = 0f;
Vector2 moveInput;
+ [NonSerialized]
public Rigidbody2D rb;
Animator animator;
Animator animator_rotor;
public GameObject rotorGO;
TouchingDirections touchingDirections;
+ [NonSerialized]
public Damageable health;
+ // Time it takes to drill
+ public float drillingTime = 1f;
+ private float timeSinceDrill = 0f;
+
[SerializeField]
private bool _isMoving;
public bool IsMoving
@@ -44,6 +54,17 @@
animator_rotor.SetBool(AnimationStrings.Player.isFlying, value);
}
}
+ [SerializeField]
+ private bool _isDrilling;
+ public bool IsDrilling
+ {
+ get { return _isDrilling; }
+ set
+ {
+ _isDrilling = value;
+ //animator.SetBool(AnimationStrings.Player.isDrilling, value);
+ }
+ }
private bool _isFacingRight = true;
@@ -137,6 +158,35 @@
maxFallSpeedCurrent = rb.velocity.y;
}
}
+ if (touchingDirections.IsGrounded && moveInput.y < 0 && !IsDrilling)
+ {
+ //IsDrilling = true;
+ Drill(DrillDirection.Down);
+ }
+ if (touchingDirections.IsGrounded && touchingDirections.IsAtWall && moveInput.x != 0 && !IsDrilling)
+ {
+ //IsDrilling = true;
+ if (touchingDirections.IsAtWallLeft)
+ {
+ Drill(DrillDirection.Left);
+ }
+ else if (touchingDirections.IsAtWallRight)
+ {
+ Drill(DrillDirection.Right);
+ }
+ }
+ if (IsDrilling)
+ {
+ if (timeSinceDrill > drillingTime)
+ {
+ IsDrilling = false;
+ timeSinceDrill = 0;
+ }
+ else
+ {
+ timeSinceDrill += Time.deltaTime;
+ }
+ }
}
public void OnMove(InputAction.CallbackContext context)
@@ -150,6 +200,7 @@
IsFlying = (moveInput.y != 0);
SetFacingDirection(moveInput);
+
}
else
{
@@ -159,6 +210,28 @@
}
}
+ private void Drill(DrillDirection drillDirection)
+ {
+ IsDrilling = true;
+ ContactPoint2D[] contactPoints = new ContactPoint2D[1];
+ //rb.GetContacts(contactPoints);
+ if (drillDirection == DrillDirection.Down)
+ {
+ touchingDirections.groundHits[0].collider.GetContacts(contactPoints);
+ } else if (drillDirection == DrillDirection.Left || drillDirection == DrillDirection.Right)
+ {
+ touchingDirections.wallHits[0].collider.GetContacts(contactPoints);
+ }
+ CharacterEvents.characterDrill.Invoke(contactPoints[0], drillDirection);
+ }
+
+ //private void DrillLeftOrRight()
+ //{
+ // ContactPoint2D[] contactPoints = new ContactPoint2D[1];
+ // touchingDirections.wallHits[0].collider.GetContacts(contactPoints);
+ // CharacterEvents.characterDrillLeftOrRight.Invoke(contactPoints[0]);
+ //}
+
private void SetFacingDirection(Vector2 moveInput)
{
if (moveInput.x > 0 && !IsFacingRight)
diff --git a/Assets/Scripts/TouchingDirections.cs b/Assets/Scripts/TouchingDirections.cs
index 4a26280..6091f02 100644
--- a/Assets/Scripts/TouchingDirections.cs
+++ b/Assets/Scripts/TouchingDirections.cs
@@ -9,7 +9,7 @@
public float wallDistance = 0.2f;
public float ceilingDistance = 0.05f;
- private Vector2 wallCheckDirection => gameObject.transform.localScale.x > 0 ? Vector2.right : Vector2.left;
+ //private Vector2 wallCheckDirection => gameObject.transform.localScale.x > 0 ? Vector2.right : Vector2.left;
Rigidbody2D rb;
public GameObject rotorGO;
@@ -18,9 +18,9 @@
Animator animator;
Animator animator_rotor;
- RaycastHit2D[] groundHits = new RaycastHit2D[5];
- RaycastHit2D[] wallHits = new RaycastHit2D[5];
- RaycastHit2D[] ceilingHits = new RaycastHit2D[5];
+ public RaycastHit2D[] groundHits = new RaycastHit2D[5];
+ public RaycastHit2D[] wallHits = new RaycastHit2D[5];
+ public RaycastHit2D[] ceilingHits = new RaycastHit2D[5];
[SerializeField]
private bool _isGrounded;
@@ -37,14 +37,27 @@
}
[SerializeField]
- private bool _isAtWall;
+ private bool _isAtWallLeft;
- public bool IsAtWall
+ public bool IsAtWallLeft
{
- get { return _isAtWall; }
+ get { return _isAtWallLeft; }
set
{
- _isAtWall = value;
+ _isAtWallLeft = value;
+ animator.SetBool(AnimationStrings.Player.isAtWall, value);
+ animator_rotor.SetBool(AnimationStrings.Player.isAtWall, value);
+ }
+ }
+ [SerializeField]
+ private bool _isAtWallRight;
+
+ public bool IsAtWallRight
+ {
+ get { return _isAtWallRight; }
+ set
+ {
+ _isAtWallRight = value;
animator.SetBool(AnimationStrings.Player.isAtWall, value);
animator_rotor.SetBool(AnimationStrings.Player.isAtWall, value);
}
@@ -64,7 +77,13 @@
}
}
-
+ public bool IsAtWall
+ {
+ get
+ {
+ return IsAtWallLeft || IsAtWallRight;
+ }
+ }
void Awake()
{
@@ -82,7 +101,10 @@
void FixedUpdate()
{
IsGrounded = touchingCol.Cast(Vector2.down, castFilter, groundHits, groundDistance) > 0;
- IsAtWall = touchingCol.Cast(wallCheckDirection, castFilter, wallHits, wallDistance) > 0;
+ IsAtWallLeft = touchingCol.Cast(Vector2.left, castFilter, wallHits, wallDistance) > 0;
+ IsAtWallRight = touchingCol.Cast(Vector2.right, castFilter, wallHits, wallDistance) > 0;
IsAtCeiling = touchingCol.Cast(Vector2.up, castFilter, ceilingHits, ceilingDistance) > 0;
}
+
+ //TODO getTileForDrillHere?
}
--
Gitblit v1.10.0