using UnityEngine;
using ScrambleKit;

public class PuckCollide : MonoBehaviour
{
	public float pendulumStunTime = 0.45f;
	public float groundStunTime = 0.15f;

	public FXTrigger hitPendulumFX;
	public FXTrigger hitwallFX;

	private PuckMove puck;

	void OnCollisionEnter2D(Collision2D col)
	{
		if (col.gameObject.layer == 6)  // Pendulum Layer
		{
			puck.Stun(pendulumStunTime);
			hitPendulumFX.Trigger(transform);

			AntiFriction booster = col.transform.GetComponent<AntiFriction>();
			if(booster != null && booster.activated)
			{
				booster.Recharge();
			}
		} else if (col.gameObject.layer == 3)  // Ground Layer
		{
			puck.Stun(groundStunTime);
			hitwallFX.Trigger(transform);
		}
	}

	void Start()
    {
		puck = GetComponent<PuckMove>();
    }
}
