Join Dan Violet Sagmiller for an in-depth discussion in this video Shoot, part of Build a Real-Time Strategy Game with Unity 5.
- [Voiceover] Our AI is ready to attack,…but they lack the ability to harm the enemy.…We need to give them the tactical ability to shoot.…To do that, I'm gonna go into the Scripts folder,…and I'm gonna create a new folder called "Battle".…Inside of the Battle folder, I'm gonna create a…new script called "Attack In Range".…Let's edit Attack In Range.…
Inside of the Attack In Range script,…I need to add a couple of variables to the top.…The first one is, I wanna know how much time to wait…before trying to find a new target to attack.…So, I'll say, public float…FindTargetDelay,…and I'll say that = 1,…so one second to wait before trying to find a new target.…Next, I wanna know what's my attack range.…So, public float AttackRange,…and I'll say that that's 20 meters,…so units can't shoot past that distance.…
Next, I need to know the attack frequency, or attack delay,…so I'll say public float AttackFrequency,…and I'll say that's 0.25, or four shots a second.…Next, I need to know how much…damage it's going to do for every shot.…
AuthorDan Violet Sagmiller
- Adding player positions and start info
- Loading prebuilt levels
- Adding camera moves
- Adding a unit
- Supporting navigation
- Adding unit owners and player objects
- Importing and setting up a HUD map
- Adding unit info and credits
- Creating HUD actions
- Building a command base
- Adding artificial intelligence
- Adding battle actions
Skill Level Intermediate
Unity 5: 2D Essential Training (2015)with Jesse Freeman3h 22m Intermediate
1. Initial Setup
2. Adding a Unit
3. Navigation Mesh
4. Unit Owner
5. HUD Map
6. Unit Info & Credits
7. HUD Actions
8. Command Base
9. Base AI
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.