CLONING COLORS QUEST: ‘Create A Win Condition’ - Solutions

Quest: Cloning Colors Quest
Challenge: Create A Win Condition

Feel free to share your solutions, ideas and creations below. If you get stuck, you can find some ideas here for completing this challenge.

Just a basic solution for my win condition:

Created a new script and attached it to the flag object with the following:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FlagWin : MonoBehaviour
{
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Block"))
        {
            if (collision.gameObject.GetComponent<SpriteRenderer>().color == this.gameObject.GetComponent<SpriteRenderer>().color && collision.gameObject.GetComponent<BlockMovement>().isActiveBool)
            {
                    Debug.Log("You Win");
            }
        }
    }
}

Privacy & Terms