/// <summary> /// Checks if there is a resource in the direction of the player. /// </summary> /// <param name="collision">The object that the collision checker is colliding with.</param> private void OnTriggerStay2D(Collider2D collision) { if (collision != null && collision.gameObject.tag == "Resource") { _currentCollision = collision.gameObject; //start harvesting if the player is not already trying to harvest any other resource. if (!Harvester.IsHarvesting) { _harvester.HarvestResource(_direction, collision.gameObject, false); } } }