Example #1
0
        public void UnequipWeapon()
        {
            // Remove listeners
            if (hitbox != null)
            {
                hitbox.OnHit.RemoveListener(HitTarget);
            }

            // Destroy old weapon gameobject instance
            if (weaponGameObject != null)
            {
                Destroy(weaponGameObject);
            }

            // Cleanup references
            hitbox           = null;
            weaponGameObject = null;
            currentWeapon    = null;
        }
Example #2
0
        Hitbox GetHitbox()
        {
            Hitbox _h = null;

            if (weaponGameObject.GetComponent <WeaponReferences>() != null)
            {
                _h = weaponGameObject.GetComponent <WeaponReferences>().hitbox.GetComponent <Hitbox>();
            }

            // TOOD: Improve this but not right now because its 01:30 am


            // If hitbox is not on parent, search inside
            if (_h == null)
            {
                _h = weaponGameObject.transform.GetChild(0).GetComponent <WeaponReferences>().hitbox.GetComponent <Hitbox>();
            }

            return(_h);
        }