Join Dan Violet Sagmiller for an in-depth discussion in this video Building cost, part of Build a Real-Time Strategy Game with Unity 5.
- [Voiceover] Command Bases should be earning money,…but they also should cost.…We'll enable both of these features now.…We'll start by going into the Scripts folder,…and we're going to create a new script called Earnings.…Now let's edit Earnings.…In the Earnings script,…I'm going to create two public fields.…The first one is public float…CreditsPerSecond.…We'll say it equals one, one credit per second.…In this system, I'm using a very simply way…to increase the funding.…
I'm not putting in any timers…where suddenly we get a bulk amount of credit.…I'm simply saying that as time passes,…we will slowly build more and more money.…So, the next part I need is the player information.…Next, in the Start function, I need to get the player,…so player = GetComponent…<Player>().Info.…Now, in the Update function,…I'm going to say player.Credits…plus equals CreditsPerSecond…times Time.deltaTime.…
So now if only 1/3 of a second passes,…we will get 1/3 of a credit.…Additionally, if two seconds pass, we get two credits.…We now have a nice system…
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.