Another Approach To the ItempPickUp Cursor

Good morning,

I completed the challenge using another method but in all honesty I have to move near the pickUp to collect it since I cannot move to it when I click

bool isPickedUp= false;
        public bool HandleRaycast()
        {
            if(isPickedUp)
            {
                return false;
            }
            return true;
        }

        private void OnTriggerEnter(Collider other) 
        {
            if(other.gameObject.tag == "Player")
            {
                isPickedUp= true;
                PickUp(other.GetComponent<Fighter>());
            }
        }

        private void PickUp(Fighter fighter)
        {
            fighter.EquipWeapon(weapon);
            //Destroy(gameObject);
            StartCoroutine(Respawn(respawnTimer));
        }

        IEnumerator Respawn(float seconds)
        {
            ShowPickUp(false);
            yield return new WaitForSeconds(seconds);
            ShowPickUp(true);
            isPickedUp= false;
        }

I am using Sam’s method just in the interest of saving time, but I would love some suggestion as to how to solve the problem with my method :slight_smile:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms