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

public class CapturePoint : MonoBehaviour
{

    public float scoreGainRate;

    private int currentPlayerID;
    bool playerInside = false;

    void OnTriggerStay2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "Player")
        {
            if (!playerInside)
            {
                currentPlayerID = coll.GetComponent<PlayerController>().playerID;
                playerInside = true;
            }
            GameController.UpdatePlayersPoints(currentPlayerID, Mathf.RoundToInt(scoreGainRate));
        }
    }

    void OnTriggerExit2D(Collider2D coll)
    {
        playerInside = false;
    }

}