From f9eb7a7ee24f420de945f45311649adcaa1d5903 Mon Sep 17 00:00:00 2001 From: kittyegg Date: Fri, 12 Jun 2026 18:33:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D1=83=D0=B4=D0=B0=D0=BB=D1=8F=D1=82=D1=8C=20=D0=BF?= =?UTF-8?q?=D1=83=D1=82=D1=8C=20=D0=B2=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D1=8F=20=D1=81=D1=82=D1=80=D0=BE=D0=B8=D1=82=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scenes/Island.unity | 81 +++++++++++++++++++++++++- Assets/Scripts/BlockDestoyReward.cs | 7 ++- Assets/Scripts/SandPathBuildService.cs | 22 ++++++- Assets/Scripts/UI/GameMenuButtons.cs | 2 - 4 files changed, 106 insertions(+), 6 deletions(-) diff --git a/Assets/Scenes/Island.unity b/Assets/Scenes/Island.unity index 01e5b13..d486460 100644 --- a/Assets/Scenes/Island.unity +++ b/Assets/Scenes/Island.unity @@ -14184,6 +14184,84 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8d6715c95501a4f49bd34c8832850f32, type: 3} m_Name: m_EditorClassIdentifier: Assembly-CSharp::BlockScript +--- !u!1001 &1522202350 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1739395622} + m_Modifications: + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalScale.x + value: 0.73 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalScale.y + value: 0.73 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalScale.z + value: 0.73 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalPosition.x + value: -1.774 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalPosition.y + value: -0.71799994 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalPosition.z + value: -0.506 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalRotation.y + value: -0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -90 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_ConstrainProportionsScale + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2282463062789957701, guid: f43f402f15b1069488b837e6f472a868, type: 3} + propertyPath: m_Name + value: door_1a (1) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: f43f402f15b1069488b837e6f472a868, type: 3} +--- !u!4 &1522202351 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} + m_PrefabInstance: {fileID: 1522202350} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1543141569 PrefabInstance: m_ObjectHideFlags: 0 @@ -15108,7 +15186,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} propertyPath: m_LocalPosition.x - value: 1.961 + value: 1.986 objectReference: {fileID: 0} - target: {fileID: 1506208594825835263, guid: f43f402f15b1069488b837e6f472a868, type: 3} propertyPath: m_LocalPosition.y @@ -15919,6 +15997,7 @@ Transform: m_Children: - {fileID: 692742697} - {fileID: 1642372930} + - {fileID: 1522202351} m_Father: {fileID: 35686721} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!54 &1739395623 diff --git a/Assets/Scripts/BlockDestoyReward.cs b/Assets/Scripts/BlockDestoyReward.cs index 8913e01..ba1c081 100644 --- a/Assets/Scripts/BlockDestoyReward.cs +++ b/Assets/Scripts/BlockDestoyReward.cs @@ -16,8 +16,11 @@ public class BlockDestoyReward : MonoBehaviour _sandPathBuildService.OnBlockDestroy -= OnBlockDestroy; } - private void OnBlockDestroy(BlockScript _) + private void OnBlockDestroy(BlockScript block) { - _wallet.AddMoney(_reward); + if (block.Type == BlockScript.BlockType.Grass) + _wallet.AddMoney(_reward); + else if (block.Type == BlockScript.BlockType.Sand) + _wallet.TakeMoney(_reward); } } \ No newline at end of file diff --git a/Assets/Scripts/SandPathBuildService.cs b/Assets/Scripts/SandPathBuildService.cs index d9be6dc..1518c9d 100644 --- a/Assets/Scripts/SandPathBuildService.cs +++ b/Assets/Scripts/SandPathBuildService.cs @@ -60,17 +60,37 @@ public class SandPathBuildService : MonoBehaviour { var block = _blocksInPath[i]; Instantiate(_grassBlockPrefab, block.transform.position, block.transform.localRotation, block.transform.parent); - Destroy(block.gameObject); + DestroyBlock(block); } _blocksInPath.Clear(); InitBlocks(); } + public void ResetLastBlock() + { + if (_predefinedBlocks.Contains(_currentBlock)) + return; + + _blocksInPath.Remove(_currentBlock); + Instantiate(_grassBlockPrefab, + _currentBlock.transform.position, + _currentBlock.transform.localRotation, + _currentBlock.transform.parent); + DestroyBlock(_currentBlock); + + _currentBlock = _blocksInPath.LastOrDefault(); + } + private void OnBlockDetected(BlockScript block) { if (_gameManager.CurrentState != GameManager.GameState.BuildingPath) return; + if (block == _currentBlock) + { + ResetLastBlock(); + return; + } if (!block.CompareTag("GrassBlock") || !_currentBlock.GetNeighbors().Contains(block) || block.GetNeighbors().Count((o) => o.Type == BlockScript.BlockType.Sand) > 1) diff --git a/Assets/Scripts/UI/GameMenuButtons.cs b/Assets/Scripts/UI/GameMenuButtons.cs index bdb9ffe..6be0b67 100644 --- a/Assets/Scripts/UI/GameMenuButtons.cs +++ b/Assets/Scripts/UI/GameMenuButtons.cs @@ -5,7 +5,6 @@ public class GameMenuButtons : MonoBehaviour { [SerializeField] private GameManager _gameManager; [SerializeField] private SandPathBuildService _sandPathBuildService; - [SerializeField] private Wallet _wallet; [SerializeField] private Button _mainMenuButton; [SerializeField] private Button _nextLevelButton; [SerializeField] private Button _resetPathButton; @@ -49,7 +48,6 @@ public class GameMenuButtons : MonoBehaviour private void OnResetButtonClick() { _sandPathBuildService.ResetPath(); - _wallet.TakeMoney(_wallet.Money); _gameManager.CurrentState = GameManager.GameState.BuildingPath; }