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

public class Boss : MonoBehaviour {
    public BoxCollider2D bc;
    Vector3 start_position = new Vector3(0f, -3f, -5f);
    Vector3 stop_pos1 = new Vector3(3f, 1f, -5f);
    Vector3 stop_pos2 = new Vector3(3f, -1f, -5f);
    Vector3 max = new Vector3(3f, 1.35f, -5f);
    Vector3 min = new Vector3(3f, -1.35f, -5f);
    Vector3 target;
    float time;

	// Use this for initialization


	void Start () {
        bc.transform.position = max;
        time = 0;
	}


    void Update () {
        float currentTime = Time.time;
        if (currentTime - time >= 5 || (bc.transform.position.y == stop_pos1.y || bc.transform.position.y == stop_pos2.y))
        {
            StartCoroutine(stop());
            time = Time.time;

        }
        checkBounds();
        bc.transform.position = Vector3.MoveTowards(bc.transform.position, target,.025f);

        
    }

    IEnumerator stop()
    {
        while (true)
        {
            yield return new WaitForSeconds(3f);
        }
    }

    void checkBounds()
    {
        if (bc.transform.position  == min)
        {
            target = max;
        }
        if (bc.transform.position == max)
        {
            target = min;
        }
    }

    void ShootDown()
    {

    }

    void ShootUp()
    {

    }

 



}
