Hello guys, how are you all?
My project is a little different from the one presented in the classes since I’m doing a survival game. Here is a little video showing more or less what it is about:
In my game, I want to be able to interact in many different ways with each kind of agent, for example, my “enemies” are wild animals, and I want to be able to 1: inspect, 2: befriend, 3: attack, 4: cut it after it’s dead, 5: drag and more. I could add those behaviors to the player instead as kind of abilities that check for conditions and maintain the layer structure, but it would throw me in a deep rabbit hole of if/else chains which I feel that wouldn’t work very well.
This is the reason why I’m thinking about changing the CameraRaycast structure for an “Interactable class” structure(which every object that I want to interact with would have a component inheriting from interactable), where I RaycastAll or use OverlapSphere at every layer, find all interactable objects that have been hit and then decide what to do accordingly to the returned objects and their possible interactions.
I want to be able to show an interaction wheel upon Right click, using a layer structure would mean that I would have to repeat a lot of code to find which interactions I could do, using the interactable class I can retrieve an array of interactions and choose from there
I could use many interfaces, but feels that interactions + interactable could work better since it can hold more information, may require less code and “interactions” does seem connected between them (all are activable, all rely on something interacting, all requires sprites to be identified in the interactions wheels, and I can populate the interactions list with new options to meet certain situations).
is this approach very horrible?