Game Development Reference
In-Depth Information
Selecting a target
Like with
CommandBar
, the player needs some visual representation to confirm whether
their actions actually have an effect in the game. To this end, let's add some selection logic
for our enemies and a nice visual effect in 2D. First, we'll create the prefab for this with a
little animation and then get ready to attach our
BattleManager
script using the vari-
able we added earlier.
The selection circle prefab
First off, I created the following selection circle with my graphics skills:
This is nothing fancy, but it will look better once we get it in the game. So, add
Selec-
tionCircle.png
to your project from the assets that accompany this title to
As-
sets\Sprites\Props
.
Next, we'll create a prefab of this sprite in our scene for later use. This simply sets up how
we want to use it visually, and since we are going to use it several times over in the scene,
using prefabs means that there will only be one instance with many copies.
Now, drag the
SelectionCircle
image on to the scene (if it doesn't work, you are
looking at the game view, which means that you need to switch to the
Scene
tab) and set
the properties as shown in the following screenshot: