Game Development Reference
In-Depth Information
If you add the script to the individual
Pickup
instances in the scene you
will have to do it many times (and also you have remember to add it
to any other pickups you add in the scene). If you add it to the
Pickup
Prefab
, then all instances of that prefab will automatically be updated!
Now our cunning cubes will race to assault the intruder once the alarm fires, so now
we need the actual alarm.
The Alarm plates
Again, we'll keep things simple. For the alarm trigger, we will just add some
pressure plates to the floor that when the hero runs over them, they will mark
themselves as triggered.
First add a new
Plane
(
Create
|
3D Object
|
Plane
) to the scene, reset its position
(using the cog icon in the top-right hand corner of the
Transform
component in the
Inspector
window) and scale it down to a reasonable size (such as
0.15
on the
X
,
Y
and
Z
Transform
Scale
properties). Name the new
Plane
Alarm
and also set its
Mesh
Collider
to a Trigger by checking the
Is Trigger
property, as shown in the following
screenshot (leave all the other options as per their defaults):