public override void Unload() { if (weaponUI != null) { GameObject.Destroy(weaponUI.gameObject); weaponUI = null; } }
public override void Load(PrototypeObject data) { if (data == null) { return; } WeaponData weapon = data as WeaponData; weaponUI = ResourceUtils.AddAndGetComponent <WeaponUI>(GlobalDefinitions.RESOURCE_PATH_WEAPON + weapon.resourceID); weaponUI.transform.SetParent(owner.componentsHolder.transform); weaponUI.transform.localPosition = new Vector2(weapon.offsetX, weapon.offsetY); weaponUI.transform.localScale = Vector2.one; weaponUI.Initialize(weapon); }