Design a site like this with
Get started

Development Blog #15 – Preaching System (Candle Rework)

At the current state, the preaching system has no visual guide for them to see if they are correct or not. The plan for this is to use two candles (one for each joystick), and have the intensity of the flame increase/decrease based on how correct the player is.

I already have a mesh for the candle that can be used in the game. The next step is to create the flame. I had help to create a fire particle effect that I then scaled down to make a candle flame. Below is the settings used in order to create this effect.

After creating the flame effect, I wanted to create a visual indictation as to when the player is preaching successfuly. To do this, I again had assistance in creating a ‘ring pulse’ effect that glows when the plays is correct.

This effect needed to be scripted so that when the player is correct it glows brightly and when not it glows a lot smaller and dimmer.

I made the initial adjustments to the PreachController script

public ParticleSystem candleLeft, candleRight;
public GameObject candleLeftRing, candleRightRing; 

public Transform LeftWinParticleLocation, RightWinParticleLocation;
public GameObject winPartcle;

The first 2 variables (candleLeft & candleRight) are references to the particle system that produces the pulsing rings. The next two are references to the actual GameObjects. This allows me to enable/disable the whole particle system instead of just making adjustments to the way the system looks. I later added the leftWinParticleLocation and rightWinPartcleLocation variables as a reference to where a win particle would spawn, as well as add a reference to the actual win particle

I next had to make some adjustments to the AssessPerformance() method. This method detects whether the player actually is successful or not

void AssessPerformance()
        var leftMain = candleLeft.main; 
        var rightMain = candleRight.main;

The two variables created are used to access the ‘main’ section of each particle system. As particle systems are so large, the get separated into each of their sections and I needed to make adjustments to the main section of each system.

Now that I had set up the system, I needed to actually adjust each condition of the AssessPerformance() method to display the particle differently. In the ‘correct’ condition, I adjusted the ‘Start Size’ variable that changes how big the particle system is

leftMain.startSizeMultiplier = 10;
rightMain.startSizeMultiplier = 10;

I did a similar adjustment in the ‘fail’ condition, but made the size a lot smaller

leftMain.startSizeMultiplier = 1;
rightMain.startSizeMultiplier = 1;

I needed to add another step for when the player only has one correct. In order to do this, I created a second if statement that checks which joystick is pointed in the right position.

else if (ls_v == "true" || rs_h == "true") 
    timeWhenCorrect = 0f;

    if (ls_v == "true")
         leftMain.startSizeMultiplier = 10;

    if (rs_h == "true")
        rightMain.startSizeMultiplier = 10;

    outcome = "Almost";

The last step was to indicate when the player was successful or not for each stage. I did this in two ways. The first was to add a image in the UI that displays what stage the player is on and keeps track of how many preaches they have got correct.

The images, created by Alex, light up red or green depending on whether the player was correct or not.

public Image[] stageImages;
if (timeWhenCorrect >= levelSuccessTime)
  stageImages[levelNum].color =;

I created an Image[] array that would allow me to change the colour of the current stage image and then added a line to the if statement to change to colour of the image with the level number index to green. I made a similar adjustment to the fail condition section.

if (currentTimeOnLevel >= maxTimePerLevel)
    stageImages[levelNum].color =;

The last step was to add another pulse when the player is successful for each stage of the preach. This is just to make it very clear that they were correct. For this, I just instantiated a burst particle effect at the same stage as changing the sequence colour to green.

if (timeWhenCorrect >= levelSuccessTime)
           Instantiate(winPartcle, LeftWinParticleLocation);
           Instantiate(winPartcle, RightWinParticleLocation);

Below is the system working correctly


Leave a Reply

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

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

Facebook photo

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

Connecting to %s

Blog at

Up ↑

%d bloggers like this: