Hi, currently I’m completely new to unity. As I am new to gamedevelopment at all (having 8y exp in “SOLID” OOP-Programming), I’m looking for methods to handle situations individually and have a better separation of concerns.
May be I got the concept slightly wrong, but I’m looking for a way to get independent materials and prefabs that respond (or not respond) to some messages send to them on hit.
Say I have a gun and shoot on a stone-wall. This should have another cause like shooting on grass. In the first case, some kind of white and yellow particles should appear, in the other case, some green particles should spray around. This applies to sound as well. Shooting gras should sound differently than shooting, say, water, stone or wood.
I don’t want to have a central controller to be updated for every material introduced while progressing. It would be nice to have non-visible materials or material-prefab-like things to ship their own behavior on different hit-types. The hit-types are kind of predefined: Two kinds of Footsteps, three kind of weapon-hit-types (bullet, rocket/grenade, knife/sword).
So my idea was to listen for certain message-types and do something independently. Gras will spray on bullet-hit, an enemy will receive damage, may be show some red particles on hit and disappear when health is gone. Enemies also would have a dedicated receiver to handle the hit-damage and have a material to handle material-hits (robots) or flesh-hits (say, zombies).
Is there any tutorial to show how go work with this kind of encapsulated behavior, or is this even far away from whats usual or even possible with unity? I hope I could describe what I meant.