Hi all,
I'm working on my Game Development Capstone, which is a turn-based RPG in Unity.
Right now I'm prototyping; and the current stage involves generating enemy encounters.
What I'm not sure about, and where things get a little complicated, is storing each generated enemy's stats in an array.
Enemy encounters generate between 1 to 3 enemies, and for each enemy, I want to generate stats: HP, Attack, Defense, and Speed.
Arrays are confusing to me. I'm trying to wrap my head around them on the Unity documentation and other resources; but other help would be greatly appreciated.
Replies
A shot in the dark though is that you have code running that creates a random number of enemies which are all the same prefab. If this is the case you don't really need any additional arrays just add member variables for each stat to a script attached to one of the members of the prefab. Then you can just generate values for them when you create them either in the script for each enemy or in the script that creates them.
look at the List class in MSDN: http://msdn.microsoft.com/en-US/library/6sh2ey19%28v=vs.80%29.ASPX
Thank you very much.
EnemyObject Orc = new EnemyObject();
Orc.name = "Billy";
Orc.Health = 100;
Orc.Speed = 10.5f;
This creates an object that everywhere has access to.
You can store these enemies in a list and access them by name. Create a random enemy generator... so many things...
Just an idea.
Nick