using Player.Information; using UnityEngine; public class ConstructArea : ConstructBase { [SerializeField] private string resourceName = ""; [SerializeField] private float resourceRate; [SerializeField] private float radiusEffect; private GameObject player; private PlayerStats playerStats; // Start is called before the first frame update private void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerStats = player.GetComponent(); } // Update is called once per frame private void Update() { if (Vector3.Distance(player.transform.position, transform.position) <= radiusEffect) playerStats.ConsumeResource(resourceRate * Time.deltaTime, resourceName); } }