void Start() { berryCount = 0; if (!berryBushScript) { berryBushScript = GetComponent <ResourceGiverScript>(); } SpawnBerries(); }
private void OnTriggerStay2D(Collider2D other) { if (wepScript.swinging) { if (other.CompareTag("Resource")) // Stone Wood Food { ResourceGiverScript resScript = other.GetComponent <ResourceGiverScript>(); if (resScript.typeOfResource == "Stone") { Player.stoneResource += resScript.TakeResource(resourceGain); } if (resScript.typeOfResource == "Wood") { Player.woodResource += resScript.TakeResource(resourceGain); } if (resScript.typeOfResource == "Food") { Player.foodResource += resScript.TakeResource(resourceGain); } } } }