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

public class MapPortal : MonoBehaviour {

    private GameController controller;

    public void PreparePortal (GameController controller) {
        this.controller = controller;
        this.DisablePortal();
    }

    public void EnablePortal () {
        this.gameObject.SetActive(true);
    }

    public void DisablePortal () {
        this.gameObject.SetActive(false);
    }


    void OnTriggerEnter(Collider other) {
        if (!this.gameObject.activeInHierarchy) {
            return;
        }

        var player = other.GetComponent<Player>();
        if (player) {
            this.controller.GameEvents.CallOnGameWon();
        }
    }
}
