Game Development Reference
In-Depth Information
This simply means that if we want to have our custom icon image, we basically need to put
our image inside either of the folders menioned earlier. Both the paths have advantages
and disadvantages. If we want to use the image icon for every project in the same machine,
we can put it inside the Unity.app/Contents/Resources folder, but this will be difficult
when we want to move the project to another person. On the other hand, if we want to use
only the icon image in this project, we can create a Gizmos folder in the Project view and
put the icon image inside that folder, which we just did.
Engage Thrusters
Now we are ready to start the irst secion:
1. Create a new JavaScript file (we can add it to our Scripts folder to make it more
organized) by going to Assets | Create | Javascript , and name it Waypoints .
2. Double-click to open it in MonoDevelop and start creaing the necessary parameters
for this waypoint script. Let's replace the script as follows:
//Name of the icon image
public var iconName : String = "wayIcon.psd";
//Radius of each way point - use for checking the collision
detection with the enemy
public var radius : float = 1.0;
//Toggle this to make the enemy move by order from the first index
to last index (Looping)
public var orderDirection : boolean = false;
//Get all the transform of the waypoint - including the the parent
private var waypoints : Transform[];
//Current waypoint index
private var int_wayIndex : int;
//Next waypoint index
private var int_nextIndex : int;
//Length of all waypoints
private var int_wayLength : int;
//Movement direction of the enemy to next waypoint
private var v3_direction : Vector3;
//Checking if the enemy hit the waypoint
private var b_isHitRadius : boolean;
Here, we just finished implementing the necessary parameters to
use for our waypoint.
 
Search WWH ::




Custom Search