Adding the new Mage unit and ranged attack
It is time to start adding more characters to our RTS game. We already have our Warrior character, and now we are going to use everything we have made so far to add a Mage character. We are going to expand the UnitComponent script to add the ranged attack as well, which will be a fireball cast by the Mage.
Now that we have built many support systems in our RTS game, we can define a clear path to use when we need to include and configure new units in the project. This is what we need to do:
- Create a new UnitData Scriptable Object and configure all the base attributes and animation states. We can always use another unit as a reference for the value and tweak it.
- Create a new message that will be sent when we need to spawn a unit.
- Create a new spawner script and a new object pool, adding the reference to UnitData and the Prefab.
That covers the basics of adding a new unit. However, in the case of the Mage, we are also...