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

public class BearMidEvent : MonoBehaviour {

    bool triggered;
    public GameObject kive;
    public GameObject viru;

    private void Start()
    {
        //OnTriggerEnter2D(new Collider2D());
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.name == "player")
        {
            if (triggered) return;
            print("TRIGGERED");
            triggered = true;
            Vector3 pos = transform.parent.Find("BearTriggerPutPos").transform.position;
            GameObject.Instantiate(kive, pos, Quaternion.identity);
            for (int i= 0; i < 10; i++)
            {
                GameObject.Instantiate(viru, pos + (Physs.up + Physs.right)*3*(i+1), Quaternion.identity);
            }
            Camera.main.GetComponent<CameraGravity>().StartRotation();
            GameObject.Find("BearUpTrigger").GetComponent<BoxCollider2D>().enabled = true;
            GameObject.Find("BearUpTrigger").GetComponent<SpriteRenderer>().enabled = true;
            GetComponent<SpriteRenderer>().enabled = false;
            GameObject.Find("player").GetComponent<PlayerScript>().LayEggs();
            GameObject.Find("QuestTracker").GetComponent<QuestTrackerScript>().Did(1);
        }
    }
}
