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

public class CameraFollow : MonoBehaviour
{
    public bool FollowBool;
    // Start is called before the first frame update
    void Start()
    {
        transform.position = new Vector3(GameObject.Find("PainKiller").transform.position.x, GameObject.Find("PainKiller").transform.position.y, -20);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    private void LateUpdate()
    {
        if (GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeony == false && GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeonx == false)
        {
            transform.position = new Vector3(GameObject.Find("PainKiller").transform.position.x, GameObject.Find("PainKiller").transform.position.y, -20);
        }
        if (GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeony == false && GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeonx == true)
        {
            transform.position = new Vector3(transform.position.x, GameObject.Find("PainKiller").transform.position.y, -20);
        }
        if (GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeony == true && GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeonx == false)
        {
            transform.position = new Vector3(GameObject.Find("PainKiller").transform.position.x, transform.position.y, -20);
        }
        if (GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeony == true && GameObject.Find("PainKiller").GetComponent<PainKiller>().freezeonx == true)
        {
            transform.position = new Vector3(transform.position.x, transform.position.y, -10);
        }
    }
}
