CodeBlanks Logo Icon CodeBlanks

Challenge 5: Final synthesis

Solve a mini task that combines all the chapter's concepts.

Intermediate Game Architecture Synthesis

In intermediate game development, visuals (3D meshes and materials), effects (Particle Systems), physics simulations, and user interfaces (UI) unite in a cohesive system. Clicking a character flashes its material, emits particle VFX, and updates the score.

renderer.material = activeMaterial;
particleSystem.Play();
Debug.Log("Interaction completed");

Practice Material and Particle Synthesis

Assign renderer.material = new Material("Altin"); and call ps.Play();. Print results with Debug.Log("Materyal: " + renderer.material.name); and Debug.Log("Efekt: " + ps.isPlaying); respectively.

Starter code

Player.cs
using System;

public class Material
{
    public string name;
    public Material(string name) { this.name = name; }
}

public class MeshRenderer
{
    public Material material;
}

public class ParticleSystem
{
    public bool isPlaying = false;
    public void Play() { isPlaying = true; }
}

public static class Debug
{
    public static void Log(object message) => Console.WriteLine(message);
}

public class Program
{
    public static void Main()
    {
        MeshRenderer renderer = new MeshRenderer();
        ParticleSystem ps = new ParticleSystem();
        // Materyal ata, efekti oynat ve durumlari yazdir
    }
}

Sample solution

Player.cs
using System;

public class Material
{
    public string name;
    public Material(string name) { this.name = name; }
}

public class MeshRenderer
{
    public Material material;
}

public class ParticleSystem
{
    public bool isPlaying = false;
    public void Play() { isPlaying = true; }
}

public static class Debug
{
    public static void Log(object message) => Console.WriteLine(message);
}

public class Program
{
    public static void Main()
    {
        MeshRenderer renderer = new MeshRenderer();
        ParticleSystem ps = new ParticleSystem();
        renderer.material = new Material("Altin");
        ps.Play();
        Debug.Log("Materyal: " + renderer.material.name);
        Debug.Log("Efekt: " + ps.isPlaying);
    }
}

Expected output

Materyal: Altin
Efekt: True

Practice Final State Verification

When if (canli) is met, assign renderer.material = new Material("Aktif"); and print Debug.Log("Durum: Hazir");.

Starter code

Player.cs
using System;

public class Material
{
    public string name;
    public Material(string name) { this.name = name; }
}

public class MeshRenderer
{
    public Material material;
}

public static class Debug
{
    public static void Log(object message) => Console.WriteLine(message);
}

public class Program
{
    public static void Main()
    {
        bool canli = true;
        MeshRenderer renderer = new MeshRenderer();
        // Sart dogruysa materyal ata ve durum mesajini yazdir
    }
}

Sample solution

Player.cs
using System;

public class Material
{
    public string name;
    public Material(string name) { this.name = name; }
}

public class MeshRenderer
{
    public Material material;
}

public static class Debug
{
    public static void Log(object message) => Console.WriteLine(message);
}

public class Program
{
    public static void Main()
    {
        bool canli = true;
        MeshRenderer renderer = new MeshRenderer();
        if (canli)
        {
            renderer.material = new Material("Aktif");
            Debug.Log("Durum: Hazir");
        }
    }
}

Expected output

Durum: Hazir

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which two components work together in a game scene to change an object's material color while triggering a particle burst?

  • Transform and Rigidbody
  • Camera3D and AudioSource
  • MeshRenderer and ParticleSystem Correct answer
  • BoxCollider and Light

Explanation: MeshRenderer controls visual surface rendering, while ParticleSystem drives particle VFX.

2 Play Effect

Question
efekt.____();
Answer
efekt.Play();

Explanation: The Play method is used to trigger a ParticleSystem component via code.

3 Module Concepts Matching

Term Meaning
MeshRenderer Renders surface geometry with material
ParticleSystem Controls VFX and particle emission
onClick.AddListener Method connecting action to UI button
emit_signal Emits signal in event communication

All lessons in Intermediate