Collection: Paudric Smith - GD4 Portfolio

Other Work

 

Home

During the year I've helped out doing some UI jobs as well as working on a pulse shader for objects the player will interact with such as levers, crystal ball and pickups. Below I go into more detail.

UI

Implemented a system that updates and displays the players health icon and displays a blood splatter effect when hit. Added ammo icon that updates and displays when bullets are used or picked up. Added a crosshair for with and without the gun being equipped. Implemented a fortune teller card for the Zoltan clues.


           A blood splatter effect shows on screen when damage is taken from any damageable object with the alpha                value increasing for each event.

                                         wrrxE-.gif

           Blood splatter alpha decreases for each damage event and disappears once the heart is full again.
                                         nuRs-P.gif

 

 
I created a new event called "RaycastHitEventSO" that takes a "RaycastHit" as a parameter because the other event Class I had could only take in a C# data type like and "int" or "string" etc. 
Screenshot 2022-03-20 160258.png

To be able to listen for this event I needed to make an event listener called "RaycastHitGameEventListenerSO".
Screenshot 2022-03-20 160509.png

I created the RaycastHit game event data.
Screenshot (22222).png

Then made a RaycastHit game event listener component on each Zoltan and dragged the newly made event data to it.
After that we choose the "ActivateZoltar" method so it will be called when the player interacts with it.
Screenshot 2022-03-20 160824.png

I changed the private "ActivateZoltan" method to public and to take in a RaycastHit as a parameter from the players "InteractionHandler" script.
With this info it checks which Zoltan machine the player interacted with and starts the corresponding IEnumerator method.
The IEnumerator method "DisplayZoltanClue" uses "LeanTween" to ease in and out the Zoltan card for a few seconds. 
Screenshot 2022-03-20 155545.png

Once that is set up we can drag the event data into the "InteractionHandler" script which is a component of the Player.
Zoltan's tag is "Interactable" so if the player interacts with an object with that tag we raise an event with the hitInfo,  "OnZoltanInteraction.Raise(hitInfo)" that is sent to Zoltan's "GiveHInt" script and the "ActivateZoltar(RaycastHit hitInfo)" is called.
Screenshot 2022-03-20 155910.png

I created two fortune teller cards, one for each Zoltan machine using Photoshop and added them to Zoltan's Canvas, disabled and out of screen view from the user.
Screenshot 2022-03-20 161633.png

           A clip of what it looks like finished. The card shows longer but shortened it here to save space.
                                         Ym7Kfh.gif

Updated the Player HUD so that the blood splatter faded away after a while.
Fade out blood splatter effect on Player HUD after a few seconds to not annoy the user.
A coroutine is started using this IEnumerator method every time the player gets damaged.
This method basically uses a for loop to reduce the alpha of the blood splatter until it's at zero.
Screenshot 2022-04-19 163655.png

                                         SK_U5o.gif

Pulse Shader

We needed a shader material that could be applied to any object's Mesh Renderer to show a pulsating outline around it if we wanted to tell the user that this object can do something or be interactable.


Unity Shader Graph image below shows all the parts of the shader.

Shader.png

           Added a shader to health, ammo, mini game items and signs, Zoltar's crystal ball, keys, locks and levers.
                                         epj-Wd.gif

The levers used colliders to activate and deactivate their pulse shader with the "PulseShaderTrigger" script attached.
Screenshot 2022-04-19 102731.png

First you select the layer that can trigger the shader and the shader material you want to be applied to the object. I choose the Player as the layer and pulse shader I made for interactables.
If the Player enters the objects box collider and with his layer set to "Player" the block inside the if statement will be processed.
A local material array is created with the size of the objects current materials array plus one to make space for the new shader material.
The current material array is copied to the local material array at index zero.
Then the pulse shader is added to the last element of the local array.
Finally the current materials array will be assigned the local array with the shader.
Screenshot 2022-04-19 100459.png

When the Player exits the box collider if he has the "Player" layer then we must delete the shader.
A new material array is made called "materialsArray" with the size of the current materials array minus one because the shader material will be deleted.
A for loop iterates through the current material array not including the last element with the shader in it, adding the rest to the new material array just made.
Then assigning the new material array to the current material array now without the shader material. 
Screenshot 2022-04-19 101042.png

The shader will only activate when the Player will pass by the tent when he could realistically see it anyway.
Screenshot 2022-04-19 102444.png

Here's what the shader looks like on one of the levers.
                                         leverpulsing.gif