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

public class GoalLine : MonoBehaviour {
    public GameManager gm;
    public bool collidedWithHoneyJar = false;
    public bool advancingLevel = false;

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if(!collidedWithHoneyJar && collision.name == "HoneyJar")
        {
            collidedWithHoneyJar = true;

            if (name == "RightGoalLine")
            {
                gm.isLeftSideWinner = true;
            }
            else if (name == "TableReset")
            {
                if (!advancingLevel)
                {
                    advancingLevel = true;
                    gm.ProcessWinCondition();
                }

                gm.am.PlayClip("Jar Glass Break");
            }
        }
    }
}
