From 34a329ad02b4f5f6fc6ec36bdc521185573a1ec7 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 14 May 2026 01:07:37 +0200 Subject: [PATCH] refactor: controllers use ITileView port, not TileViewAdapter directly --- Assets/Scripts/Core/Ports/ITileView.cs | 1 + Assets/Scripts/Infrastructure/Unity/HunterNpcController.cs | 5 +++-- Assets/Scripts/Infrastructure/Unity/NpcController.cs | 5 +++-- Assets/Scripts/Infrastructure/Unity/PlayerController.cs | 5 +++-- Assets/Scripts/Infrastructure/Unity/TileViewAdapter.cs | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Core/Ports/ITileView.cs b/Assets/Scripts/Core/Ports/ITileView.cs index 3b06525..d20d286 100644 --- a/Assets/Scripts/Core/Ports/ITileView.cs +++ b/Assets/Scripts/Core/Ports/ITileView.cs @@ -9,5 +9,6 @@ namespace Core.Ports void SetVisualState(TileState state); void DropPhysics(); void Dispose(); + void StepOn(); } } \ No newline at end of file diff --git a/Assets/Scripts/Infrastructure/Unity/HunterNpcController.cs b/Assets/Scripts/Infrastructure/Unity/HunterNpcController.cs index a0d9b34..cbcae2f 100644 --- a/Assets/Scripts/Infrastructure/Unity/HunterNpcController.cs +++ b/Assets/Scripts/Infrastructure/Unity/HunterNpcController.cs @@ -1,4 +1,5 @@ using System; +using Core.Ports; using UnityEngine; using KBCore.Refs; @@ -37,9 +38,9 @@ namespace Infrastructure.Unity if (Physics.Raycast(transform.position, Vector3.down, out var hit, 2f, tileLayer)) { - if (hit.collider.TryGetComponent(out var tile)) + if (hit.collider.TryGetComponent(out var tileView)) { - tile.OnPlayerStep(); + tileView.StepOn(); } } } diff --git a/Assets/Scripts/Infrastructure/Unity/NpcController.cs b/Assets/Scripts/Infrastructure/Unity/NpcController.cs index 2db2cee..949aff1 100644 --- a/Assets/Scripts/Infrastructure/Unity/NpcController.cs +++ b/Assets/Scripts/Infrastructure/Unity/NpcController.cs @@ -1,4 +1,5 @@ using System; +using Core.Ports; using KBCore.Refs; using UnityEngine; using UnityEngine.AI; @@ -49,9 +50,9 @@ namespace Infrastructure.Unity if (Physics.Raycast(transform.position, Vector3.down, out var hit, 2.0f, tileLayer)) { - if (hit.collider.TryGetComponent(out var tile)) + if (hit.collider.TryGetComponent(out var tileView)) { - tile.OnPlayerStep(); + tileView.StepOn(); } } } diff --git a/Assets/Scripts/Infrastructure/Unity/PlayerController.cs b/Assets/Scripts/Infrastructure/Unity/PlayerController.cs index 0162b13..eb088c3 100644 --- a/Assets/Scripts/Infrastructure/Unity/PlayerController.cs +++ b/Assets/Scripts/Infrastructure/Unity/PlayerController.cs @@ -1,6 +1,7 @@ using System; using Core.Domain.Status; using Core.Domain.Status.Effects; +using Core.Ports; using KBCore.Refs; using UnityEngine; using UnityEngine.InputSystem; @@ -244,9 +245,9 @@ namespace Infrastructure.Unity { if (Physics.SphereCast(transform.position, 0.3f, Vector3.down, out var hit, groundCheckDistance, tileLayer)) { - if (hit.collider.TryGetComponent(out var tileAdapter)) + if (hit.collider.TryGetComponent(out var tileView)) { - tileAdapter.OnPlayerStep(); + tileView.StepOn(); } } } diff --git a/Assets/Scripts/Infrastructure/Unity/TileViewAdapter.cs b/Assets/Scripts/Infrastructure/Unity/TileViewAdapter.cs index 4094548..53fafda 100644 --- a/Assets/Scripts/Infrastructure/Unity/TileViewAdapter.cs +++ b/Assets/Scripts/Infrastructure/Unity/TileViewAdapter.cs @@ -106,7 +106,7 @@ namespace Infrastructure.Unity StartCoroutine(ShrinkAndDestroy()); } - public void OnPlayerStep() + public void StepOn() { _linkedTile?.StepOn(); }