hi everybody uh... welcome back to the unity cookie dot com classes gabriel
williams again donna kelley brand new set of really awesome tutorials
uh... spending when you watch this
but no measure is uh... and i am opera tix edison and had to get into this new
series
now in this case we're going to be going hard start to finish on entire teller
defense game
so a lot more public evidence of their right now special
uh... morgan's instructional go all the way from start an unmanned so you can
showcase how to put it together and uh...
basically and cocaine so
to start really going through a couple things uh...
maker every morning i guess this is a bit of a learning experience myself at a
time of these before combine a predetermined idea i think
and will basically be pulling in a modules so personal build
uh... couple parrots will get those working well that will be building uh...
just the top downgrade placement system and then we'll go on to the enemies
attorney i am them
uh... manufactured correctly have sometimes gets more on lawrence
uh... and then things like damaging awaz money and such are points
uh... crispy
dingy why and audio psi
amici petrosa last
uh... linda's could all win lose and finally about some high scores in the
storm
cell something
uh... something that if you were baby just finishing uh... the
mandatory we never quite got any improper high scores in there was
something that was asked for quite a bit so we're going to have a new york for
sure
uh... on that note if you have an article to those or previous unique
proceed which showed a majority
uh...
pretty up to speed on scripting and all of our unity works uh... discovery of a
lot to go over in the setup tutorials it's gonna be uh...
uh... look a little behind in some parts uh...
you know they got a little faster than usual
uh... fled to go to watch those first two special regularly under its cut on
the good stuff in there
over the phone stuff uh... so stick with what we have here in the first story
we're going to be going over like i said just a simple starter turret something
that's an issue that that is that come by and
while nothing else
uh... disc in this together
has uh...
crucible between the records take a look at how it works for us
so for looking at the end game screen here
right regain my enemy
and adult turned place
smoot terms
and fighter
pretty simple
uh... have uh... gone a little closer you can also see
attempts on our panel happening here
and in just a nice little here where it will constantly cancer of the uh...
beard targeting so
thanks kim i'm working on the computers analyze exactly on that something will
be up to control from the script with a nice little variable
reassemble theater fine-tuning tweak exactly how all year
parents are working on for different types of such
so that's pretty much it
uh... pre simple and straightforward
uh... spill onto how this all comes together
okay so um...
and incense this tutorial is going to be a bit more advanced than previous ones
released on the little energy oreo uh... trying things a little differently here
and feel free to let me know in the comments that works for you as a defense
ambition a bus to go through these quicker and get you remember without
i've got on the basics so what are we doing has just restored and how it goes
uh... is just by the cement a reprieve but i'm going to go through how
everything comes together through the pre belt scale script everything that's
in it
thomason billing it by hand as we go also hopefully that should lead to not
having uh... at a time previously even i would be a little lines
and what i was doing while a starting point to get their constitution cell was
cancelled his
uh... we had a perfect window radio here
and got through that babbitt
okay so
first of all of course we have the now that matched your year into something i
just don't quit the quicken dream acts around the country special we were also
we having a uh... tutorial on how to do that in case you were to transit little
later maybe i've got to according to the
uh...
to the whole even be serious but good to know year on how to build your own just
right
affecting real saccades
uh...
couple perhaps
uh... in him
giving a of subject himself
unless we have um... adult in a couple parts i've just make it easier to use
and that is uh... top-level item and then we have deterred ball which is the
sanctioning amy
and then we have a base so even this doctor probably emerged into uh...
relatives who doesn't sound so cite note
i was about and then uh...
underneath each other
under their main is
the book the barrels
and this way
when the palm of scores in those rooms with it
but nothing else that's which is exactly how we want to work
and on the top level we had our script and all that appleton fact while lower
parts
uh... underneath
each of the berles heavy muscle position and all this is uh... basically an older
socket we want things to happen in this case
i described an empty game object
and then positioned it
exactly where i want people to come out for each of the perils and also i want
to be
uh... minosos works for where the
uh... a particle originator
so principal just drag-and-drop at him except
uh...
and peace are about to have some just basic simple material strapped on them
special
uh... going to look to the top level of this is world the
magic happens
uh... on here have a couple components uh... number one
uh... that's a look at not the script everything else
i have a sphere collider first of all the time of the students actually
essentially the church range so whenever
uh... in this case whenever an enemy enters that collider is going to tell dr
uh... you know zameen arranged
station yet
so this is a
quick and easy way of doing it
and you can
uh... very easily accept the range of it at the same the release of the spear
quieter
resemble
you could using even a mash or a uh...
cube coyote or something if you'd rather doesn't matter
uh... justices are really easy way to sit nice spherical range
senator so
uh... civil way to do that
uh... that was an audio source which is just
you know planned uh... the fire nice won a prize
so moving on to the complex that we have the actual transcript
uh... with the whole options as your number one the projectile and that is
just a projectile created which we take a look at your
so all this is
anticipates fear tutor cannonball perhaps split a trail render on it
and children or something i don't think we've got all reports company
missus uh... as object moves leaves the school of trail behind uh... just
package sounds i suppose
and
uh... a lot like particles if you've ever those probably just sent
because you wanted to change between basket correio dot neoline slowly fading
out
and i will do that as it moved along
treating effect
uh... very useful for things like this
you're moving around in uh... editor and i don't blame a little slow funky
could never actually and
so it's not gonna look like that
iccp play
book actually just randolph disappeared because as a script to make it moved
fossil
but you take a look at that
so in his uh... checked out the size of trail runner to be a bit behind
uh... and then we have any
the project
uh... occurred so again
we have paid very simple script
adults doing is first of all we have a speedy and arrange that we can set
and the speed is just how fast and loose ranges how part will go before
destroying itself
uh... you can also use that for us a make another another function so that
when it reaches its max distance at does an explosion
who knows what even turns around if you do if you want to
uh...
justice whenever you do that some
within your simple function update uh...
every frame responses
uh... alive so basically would require the canisters
you know expansion it on it as it stands
and instantly starts doing this
who simply do a transformer translate
along the forward axi
which is busy
i've been pretty check also that you have local are global swapped
uh... in this case and what we want to be local certainty what gets
it's transformed up for it is
for example if i
noted that surround
and then
accredited global access which is uh... basically the same things that you cuba
showing here
this is for it but that's not actually case with the subject
it's local is actually going in this direction
so be careful with that that's good too
to check it actual correction there
uh... because of the script hussein move factor three doubt forward which one
lives forward along its local z axis
you can also forces to be
uh... world space if you'd like to arm
just uh... and something for different
uh... parental consent
now useful here by nineteen eighty two there is an option for it
cinema it's moving forward at its peak times timed out of time
and i think
we live in canada so basically kind of the time has just kidding
uh... the exact amount of time has passed since the previous train
sold this allows us to move
netball
instead of being uh...
simply misguided i did have this it would be
my speed
every single frame so depending how fast the actual computers running if you do
that
hard limit the frame to exactly certain number
including the speaker wanted to know recruiting at ten french for second it's
going to move it
ten units per second
and hunter french for second spenders flyer
so isn't end of the time is really there's a way to make sure rules
per second totalling
and case uh... ten meters per second if we keep variable
and ok so second we have my distance which is a little artistic rather
bearable making private doesn't show up
uh... here in the inspector
and
uh... in this case we don't want to be seen because it simply used internally
uh... at all this does is check again kind of the time time speed janet
remember way back and or speak only a guess
uh... for some of you
uh... in high school
we have uh... time times distance equals outside time time speed it was this
fence so
this is the distance it's traveled which is of course again at the time for this
frame kind to speed
damages adding that the spa sequels ads on each and every frame
and we check if the distance is more than the rage
so if it is and of course the strata game objects
some pretty simple straightforward
mover certain speaker frame
it i'm sorry to keep going the distance up defend distances more than the range
that it should travel
destroyed so straightforward just works uh... simple
if you want to take us a little bit further you could
again going back to the letter tutorial take a look at how did the physics and
you can actually have you can and should that's where the real physics launch out
a lot he's grabbing all sorts of some things
but since we're just
you don't want to keep it simple for now especially for targeting any kind of
mobile platforms you know i a lesser and right
simpler better will be
uh... you know sale in cebu cycles for what you can in physics and heavy
just two minutes away
let's let's move on to the uh... doctor script itself
i could just delete this project comfort level
soap from a transcript things get a little more complicated but not too bad
inside of your we have a couple of variables again we have the projectile
so
kit stay here
so racing team inspector there's the projectile bulow time
terence speed fire pastime
muzzle effect
paramount
the actual target
also positions and the turbo to look for different things are making this all
work properly
uh... i'm going to reach the project obviously is that project i would just
went over and that's simply
uh... you know you create an injury to drop it in as a uh... a creek abdomen
drop it and that's a lot
thanks much
uh... the real time
is comic timing uh... along in seconds
it takes to reload the comes one before fired him
cards because how quickly you can turn
and and at object
uh... player pos time isn't just a little extra very well they had it which
makes its uh... do more realistic fires so that it
uh...
winningham
turns it will
once it fires of a pause for a second the psyche of real life of a tank was
turning expiry would turn hector ponce wildfires
and then go on to turn it this way uh... otherwise it's constantly turning while
firing it looks really
it just expect
over then the script
uh... should be
pretty straightforward
uh... the muscle factor of course is just the
sci fi
as soon as
the uh... identifiers take a look at that real quick
just a very simple
because pony particle factor goes
gloomy obviously just uh... and that was an honest right on anaheim yes i'm still
using the old
article access tom
uh... there will be at the time of the ones coming soon i promise but for now
please work they were trying to stop form instead or anything
tigert values and since there
easier in my opinion from alex
okay sonya
uh...
writes a book by muscle fibers on that and that paramount is
how much this guy was actually going to be off by cell zero parsons always track
we are
waiting
and just a higher numbers is more often saw
uh... the target that's something that actually could be a private available
itis littleton inspectors i could see and make sure that starting something
properly
uh... basically that's just whenever something interesting in that spirit
quieter
the target is twenty
picket sign
the muscle positions are both of these
left and right
and script uses those to know where to
uh... esp on the bullets and the
uh... the muscle back
sophie
insignificant other shows
anteater ball of course it is just the actual volunteer and that's because the
script
uh... doesn't want to turn our actual game object
as in the whole thing returning would be proper baseball
we just want to turn this part
okay so let's take a look at the actual script vendor
coconuts
i believe the best way to cut spending enough time for free let me know enough
arms exactly how this works i'm hoping it'll be a lot better we can go to most
likley uh... to keep things rolling
uh... individually but
uh... undergo step-by-step a-sixes from the game and to show up each of these
parts uh... later part of the script come into play and explain the through
uh... instead of
putting it together piece by piece which takes quite a bit longer account
and the first things could have done and this courses are function start this
case
nothing happening still things can happen there
uh...
then and the function update
their checking if we have a target witnesses happen every frame of course
if we have a target for and a bunch of stuff
starting in the game courses in the target discuss that they're nothing will
ever happen
to make that happen
this available may speak number-two i'm doing here is it'll always have to use
um... bullion you know to see if true or false
you can't you just check
uh... if something actually exists
in this case antec if my target
this is really saying if it's not lal
and uh... of course a star so has not because nothing out as an alternate
it'll
so it's um...
thoroughness without having that extra billion to chuck schumer faults target
so we checked
if the target you know it is currently in science
slowly do that
uh... okay so we know we need this sort of some person and happened so scroll
down a bit
uh... we have the ridicule entree renter
uh... in something we've looked at
maybe a little differently here
maybe not so much was it
uh... odu real quick is of course uh... when this function is called the says
whenever something has entered
the quieter
uh... that we have a mr so on that
in this case is the skier collider
so as soon as
the enemy
enters into that
it's going to call the on trigger enter enter our script automatically going to
do anything about it
uh...
everything actually is that
this objects
uh... terrific must have is triggered
checked i was asking me to actual uh... collided things will bounce off of which
we don't want to talk to be basically in volume then something answers
this uh... this part of the script is called suppression uh... the trigger is
checked
and the second thing is
with every doing that on trigger or on call either
uh... one of the two of the attached matter rigid body you know that you know
if it's not actually getting is excellent
something that
colonizing sometimes but just has to be that way
cell
if you take a look at the humanity
i come
that this is a simple rigid body on it
a turn-off gravity and put it on is can act that way it's not being physics and
anyway usually moved around by its transform
tum moving like this
you know being manipulated by a script
so very simple
just make sure that
uh... the enemy object or whatever's going to trigger this
has that on it
and leslie
we have a paid created paid company
and added that to it
and that's because um... next uh...
twenty get this on to enter
and here it's just uh... is taking in what centers
uh... ansi collider and this other here could actually be anything whatsoever
and that's a very long and that's
uh... ahmedabad you use other as it reminds me of that
item is the other thing that's coming into this of history here
so other is a type of collider
so i can check it other backing object outtakes checking it this objects
entering objects penny
and out and he's just entered and won dates and stuff
so my case first thing i do actually is seventeen expire time
to be caused a bit ahead
and this expired kind is uh...
decided sounds when the next time that the terror is going to go out the fire
amicus wait just a little bit first because of the lungs
the instantly that and he comes into into range
trip is going to realize that i have a target
fam
firing away
which of course doesn't work because he's not pointing
most likely happening anywhere near the target doses of vaccines sweating a
little bit of time at the front allows him
turn and face
uh... game
and then fire cell
uh... i tested the real time times point five so
half of the real time seemed to work well something you can
change around but if you if you'd rather
uh... ok so next
uh... we gets targets elitist movie script my target
which is again the miracle appear target
images they transform
uh... equals
dot came out to transform
and one little thing here we're not just grinning
uh... the game object because it always makes things a little quicker if you
don't have to step at these levels anymore than possible
so i'm directly send to transform because that means when i go to target
this object
i don't have to later say you know
target
position equals
my target
transform opposition i can simply say my target oxygen
one-time moving uh...
and i'm not sure if the technical term is
but they're moving phyllis basically saying um... rice's all those you know
get component calls and i think they are basically
conciliate an attempt on them happening an ideological pennies you might just
companies and the indians just one more thing to me performance better uh...
okay so we're targeting transforma redundant
and then i would have a target
we move on
defunct update is now so i'm going to function so next time this uh... an
extreme liberals around in the script get sr
ran through uh... workshop is going to happen due to the target
and now we're going to check a few more things
so first of all
it's time to time slot time in the caribbean
is greater than the next move time
and it's going to trying to gain
the actual turn
so
what this checks
uh... responses using this next move time here what is happening at setup
so that again is to make a little more realistic
uh...
when it rains it passes for a second and the names again so
uh...
that way and i think i went over the city a few minutes ago basically just
makes alot more realistic
and doesn't keep constantly turning
cell if we have gone past that time
uh... they're going to cocaine imposition
so this is a function
pat
uses the targets position right here
surpasses that along to take a look at
so quickly and positions right down here
answer takes in
my target dot position
pixon as a vector three
and it does have stuck to itself first recreate a suitable time for a terrible
called pinpoint and this is
exactly where point in the world
that beater is going to any yet
and that is a picture three of course it's your position
and take the target position
between you can't come up here
we take that acts
plus the emir
attack a position that why it's just a minute acquisition of z
speaking
so this way
cleared of sending you know a little bit of a random amounts onto each of the x_
y_ and z_ points
so that
uh...
you know that purchasing stepping a little differently each time and you
could take out a few gratitude exactly
uh... i think it's nice just because you can do about a year
maybe you and your upgrade options workers later on if we get a for doing
it yourself
this makes room for one of the great options to be
upgrading the accuracy each time the person i saw actually you can and
so wanting their just a and that extra
then we want to
choose a rotation for this thing is a little complex here
but uh... mattered
break it up by using these two different their most you could technically do this
and one
uh... but the desired locations where we want
terror attacks you repeat here what its
you know it's it's quite turning rotation should be
and betraying their country uh... kirk agreeing complex since then and just you
know three x_y_ and z_ reaction fourth which is a w
and also both understand at least
and my opinion
so uh...
just isn't that work
and uh... than the standard and actually the unity standard reputation system you
can complete
call you were able to that time the f
because prompter found specialties he's ask returns
uh... mission excelsior explicitly
dedication we want
equals
uh... you look rotation aim point
so all this is basically saying is
we want to be at a rotation
where we are looking at
endpoint
so we're looking at three point at which
freedom which we want to gain against i make sense
so uh...
something that
dramatic oakley came position
sickness it happening
every single frame that we have a target
and it's been long enough
since we last
uh... since we last move
going to keep ending up at target
cell or we keep getting imposition
and then here we're going to actually wrote a peter box which is saved her
ball dot rotation acceptance directly
equals attorney and uh... alert
oldest those is alert is just a gradual change from one to another
so it's going from interpretation
to the desired location which again we just figured out
in the calculate
sorry macaca in position here
and it's doing that
so we didn't have the star
that and
the uh...
the amount to do it
so here or using the kind of coming in for a little trip to the works well
uh... normally this is in the world from zero to one
and you'd want to use italy raise it
from zero to one over the course uh... of the same time or some such
when this case we don't really and time to talk to be perhaps reagan the penske
always the uh...
less than one
but dingell spokesman called his opponent of the time
into any of
really long frame befriended sticks long in a second so first of all he has a
major performances you something else is
usually dont at that point
improbable and stand on the panel always p
uh... but someone students if you multiply that by
i return speed
and it will
cosmopolitan just always be a little bit less than all the way in
so that's cute
moving closer to this desired location from the start retention
uh... ok soothing that retain toward it
and then secondly now that i can have a target sets is all happening
so after this happened peco the evenings happen
if deep and a time like in the second time is greater than the next
wiretapping so when we want to be allowed to fired
direction into player a projectile
steckel cady
player projectile
the first thing we do
is simply play the audio out
which is just whatever the default audio settings
and then we work ah... we set up this mess fire timed so we decided to hold
the script
to not be able to fire her until the amount of time has passed that is the
real on time
so pretty simple which is saying next fire time equals
time at times
cast real time
uh...
nothing more than that
d next month and we do the same thing because
uh... now that
it's firing we want to set that the coupons during player
so we say next move time make a stand and pasta
buyer pastime so that will of course be
less than the real time switches causes and keeps moving
um...
we're going to completely aim here at this point
uh... and we're doing this
right here instead of in the function update because i thought if it's
constantly resort of uh...
re finding that their amount
peter it just looks like it's bouncing around passengers absolute markers
digestive biscuits time it's going to
game which makes sense is if you were you know aiming
you know your life for something at target
game and they've been certain a remarkable fire and again and again to
get
so this is going to do it
right after firing so that we
could extend the game is commuter paramount
dysfunction take a quick look at this one
very simple which it says the emir which again is the emir that's used
we're getting that name
the senior equals
just a random that range negative fairmount fairmount
and i just make sure status here
too
three we're not
only hearing took the you know
and a positive direction that can be ended
all
you know of the completely free thier amount
just as a negative to positive of that number so that's going to be somewhere
in between
those two numbers from my case it's uh...
to to do what i have said it has to be spell group said earlier to get
somewhere between later tumhala to flow so it could be one point seven five
eight nine or it could be
uh... t
uh... wanting to refusing int
in aaron and arrange it will never equal the and about
supplies and
you know came here
as an int he calls random that range
native airmail
piles of them out
uh... iffy paramount was too
i would only get one zero or one you'll never get that and uh... the extremes
uh... that was basically said just remember
answered the phone line you'll get the lowest among but now the top routes to
get in a tatoo
right
uh... just in case you run into a problem that i have before frustrating
for hours before i figure it out
what was going on
uh... however with floats
you get the whole thing
okay so because they did that a royal now we're going to
do some more exciting things
the muzzle to muzzle positions and what this does he of course is just run
through your for a group each of the muscle positions so
here you could have been submitted to us as you were
you could even just
uh... i guess just for example the students here
i select each of these berles an enchanting
rosalind or insult
and i'm gonna copy them
now we've got
form going on here
and look at a couple more discipline
uh... so
crazy period
and
email and we don't want to just makes it easier on myself we now have two
crystalline and added to the muzzle positions
uh... c subject
the each
absolute lessons
so we have to assign each of those new muscle positions right now the sizes too
infectious go through
nature and drop in the future minimums
now assuming that have been broken anything
ideal
soap
it still works just fine and that's one thing i like to try and go into strips
is the ability to uh... adapter what's been given to them but some in this case
ships automatically goes to run through all the payroll stubs that to a certain
number sucks surgeon exact wants a hard coded in
uh... include quick things coming out of the corporate adds more barrels
permitting
uh...
that's fun stuff you can get essentially u_s_ i think a silly question
uh... okay so that's running through all of those uh...
and then just quickly first instantiate the projectile
in the project ballots here in moscow inspector
uh... drops it in at the muzzle position animals rotation into that way it's
going to be facing
right down the barrel to start with
and does the same thing for the muscle factory trigger
on quick no on this
the
muscle on to legend
make sure just seen as we did with
the uh...
uh... with the world and local rotation eating the same for peace
not just in case in my case it's
it is correct or any
problem occurred in the local but here is the is pointing
down the barrel just gonna make it
orc quickly otherwise
uh...
just for and for
rotate them
so i'm not actually pointing down is a
see the come find out countries interaction like that
you do not want us to go back chandrakant
so just make sure that uh... mother position is facing a retraction because
is spawning
the uh...
the bullets and uh... fire
in that direction
so we have that faring announce uh...
i believe that's pretty much of her how this is all working
uh... one
last thing i think i'd like to go over a little bit and i don't think we have a
uh... explain wilma
uh... is it the uh... playing time
and with this
to be creative people you know let me know
wrong i write about listing of this new methods are shown how to put things
together
uh... more quickly this way
uh... if it works well uh... let me know uh... looking to your question to keep
doing it this way or failing impact i need to redo this
uh... annually i'll prob just let me know
but hopefully this will be uh... a little less painstaking tedious uh...
especially for those of you are you going to alter tutorials which should be
i mean she go to the for getting into these they really more advanced
if you were talking about being on the firing times so just in case this
uh... democratic sense skimmed over a bit
uh... the fire times uh...
all this is doing again is
uh...
current time
adding on whenever might we want to and then wait untill
the time equals and you're not basically it's a time is
ten seconds into the game
we fire
and i my reload time it's a five seconds
it's going to la that's the census comes by unexpired time is going to be
and the time which is ten seconds history of the time which was five
so the next fire time equals fifteen seconds
so now
going to update what's going to happen is last let's say one second later and
on time which is going to be eleven because that's where time genes fifteen
don't have to do anything twelve network thirteen fourteen hours network fifteen
it will work animal and fire evidence campaign add another real-time say five
announced twenty slots going to keep going savings and loan thompson exact
concept
uh...
can have the greater than or equal because came one thing that i got stuck
on for a little while
to review more bands fifteen people she works with other things correct uh...
but for me
was a runaway anysuch use just people's seminar courses critical time but
actually a lot of cases that never will
it'll be
x you probably fifteen point two five seven or something
uh... socal
field but friends aren't exactly per second so then i'm going over so we
always want to check for greater then article to or if you're going out a
direction less than or equal to
in this case at least before time factors like this uh...
but it's one of the over that spectral quick uh...
given the ethical questions in the forms others should be really fun series to be
going through
uh... in the index that's where we're going to add and summary all day on into
the spirit
home which is something that i'm coming to work and opened a little trickier
than it seemed at first it was going to be part of this tutorial but look at the
time actually that is a good thing uh...
receiving notice uh... made
as a moving this paper is not smart two in the head of where it's moving which
pics
bit of uh...
nectar calculations pants and stuff but will get into that in the next one by
something that will be needed
uh... ok great because under this com and looking forward to the future ones
uh... let me know if you have any suggestions for
email her types of things like that but i can try and bob
clinton have serious
it's definitely doing modular uh...
you know putting things together as we go
uh... experience for a selfless willoughby as well as you guys uh...
triggered a ok thanks for watching to see you next time