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

public class BridgeEnd : MonoBehaviour
{

    [Header("Setup")]
    [SerializeField] private PizzaMinigameHandler pizzaMinigame;
    [SerializeField] private Rigidbody2D playerRigidbody;
    [SerializeField] private SimpleCharacter player;

    [Header("Trigger Enter Settings")]
    [SerializeField] private SimpleCharacter.HeadDirection lookDirection;
    [SerializeField] private Vector2 moveDirection;
    [SerializeField] private float velocity;


    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.attachedRigidbody == playerRigidbody)
        {
            player.SetSpeed(moveDirection, velocity);
            player.SetDirection(lookDirection);
            pizzaMinigame.StopPlayers();
            pizzaMinigame.WinMinigame();
            return;
        }
        
    }
}
