S
S
st_rapon2016-06-14 11:25:56
Game development
st_rapon, 2016-06-14 11:25:56

What is the best way to design a game in Unity?

Good day, with a friend we are making a game on the Unity3d engine. In the game, the user can buy models of his enemies before starting the game. That is, the standard enemies of the player's character are oysters with their own animation. But the player can purchase, for example, a shrimp model. And now, when starting the game, the hero's enemies will appear as shrimp with their own animation.
We have an EnemyGenerator script which, as the name suggests, generates enemies.
It has a [Serialized] GameObject enemy field (default is an oyster);
And now the question is: how best to implement the substitution of enemies in this script?
We thought to use an IoC container, but then we would have to abandon prefabs and write scripts-Factories - for each enemy model. Would this be a viable solution?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2016-06-14
@st_rapon

[Serialized] GameObject enemy in this field SUBSTITUTE the desired prefab. We made 5/10/20 prefabs, loaded the required one and put it in the field for generation. And here "wrappers over behavior" to make identical. Any enemy has the same animation / attack / death.
What is the problem then generating the desired prefab?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question