stormtek / unity-rts-demo

A demo / foundation for an RTS game built using Unity 3d with C# scripting
420 stars 146 forks source link

Enhancement - Multiple units in queue for War Factory or Refinery? #3

Open mattsintellectualproperty opened 9 years ago

mattsintellectualproperty commented 9 years ago

This would be a big help. Also, sound effects for selection or attack commands? I really want to push this forward but am being drawn to building this out in JavaScript, not sure if that's the best route since it's a more natural language for me.

stormtek commented 9 years ago

You should be able to add multiple units to the queue for both the WarFactory and the Refinery, and you should be able to specify different types too. The next part I am working on for the tutorial is sound effects, so hopefully that will be added in the next couple of weeks (though no promises as to exactly when that will be).

mattsintellectualproperty commented 9 years ago

So to pry it out of you if I can (sorry, this is literally my first stab a C#), to add a second Tank, with exactly the same properties as the first, but to get a second tank to show on the build UI for the Warfactory, what would I need to tweak?

From what I can guess, I would hedge a bet that around line 7 of the WorldObject/Building/WarFactory/WarFactory.cs file would need to include another item for "Tank2"?

stormtek commented 9 years ago

Right, let's see if I can write this out clearly. In the Start() method in WarFactory.cs we are defining the actions to be displayed in the sidebar. So to get another build option to display you need to add a new option to this list. But for anything to display (or happen when you click the button that is created) you need to create a Prefab for the new object you want to create (so like the existing Tank prefab). This needs to include a build image (I think that is what it is called) for anything to show in the sidebar. This Prefab then needs to be added to the Units list of GameObjectList (like the current tank is). With those things in place you should be able to create a new Unit from your WarFactory.

Out of curiosity, have you actually worked through the tutorial that this project is part of? Because I am pretty sure that I go over how this process works there.