I am building a simple top down rouge-like game using unity. I have development experience, but am a beginner to both unity framework and c#. Is there a clean and graceful way of handling player object interactions with other various types of objects in the scene?
For example, the scene would be full of walls, enemies and other objects that block the path and the player can interact with by attempting to move in their direction. Standing near a chest and moving in it's direction would not move the player, but open the chest. If moving into a wall, it would damage it, etc.
At the moment i'm using raycast2d to get hold of the object blocking the path, but can't find a solution of how to interact with it without having to check what type of object it is (is a Wall; is a Chest; etc..). I made an interface which all interactable objects implement with a method interact(), but different types of objects require different information. A wall would require the amount of damage it should take (depends on player stats which are in the player class), chest would take none. Therefore it's difficult for all of them to implement the same interface. Having the wall ask the player what's his damage is also poor programming practice.
I've found a similar question on this posted a while ago on stackowerflow. It suggests using an observer pattern, but I can't imagine every single object on the scene being subscribed to player movement event and after each move checking weather it was hit or not.
Is there a standard solution to this kind of interaction? One which would be loosely coupled, clean and follow good programming practices?