Week 5

During this week I will focus on developing a shooting mechanic.

The code is formed from two parts. The first part focuses on a RayCast that has the role of detecting the layers and retain them. The ray uses a line render for visual output. This part also contains the begging of the code for an object that can be hit. The ray will stop once the maximum distance has been reached. This part is the projectile itself that is saved as a PreFab.

The second part of the code is attached to an empty GameObject, that acts as the muzzle of the gun. This is the area that calls the Projectile PreFab, to which is attached the first part of the code. What this code does is that it handles the time between rounds, creating them at a decided interval, using the Projectile Prefab

The third script that is present only contains a simple function, Destroy(), which eliminates the prefabs after an appointed time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s