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

public class NPCEater : MonoBehaviour {
    static float baseDistanceAway = 4;
    Camera main;

    private void Awake()
    {
        main = Camera.main;
    }

    private void Update()
    {
        Vector3 cameraPos = main.transform.position;
        float screenSizeX = Vector2.Distance(Camera.main.ScreenToWorldPoint(new Vector2(0, 0)), Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, 0))) * 0.5f;
        this.transform.position = new Vector3(cameraPos.x - screenSizeX - (this.transform.localScale.x * 0.5f) - baseDistanceAway, cameraPos.y, 0);
    }
}
