private void SpawnSkillIcon(Transform parent, string prefabPath, UpgradeComponentData skillData) { var skillIcon = Resources.Load <SkillIconPresentation>(prefabPath); Object.Instantiate(skillIcon.gameObject, parent); skillIcon.Init(skillData); }
public UpgradeComponent(PlayerData playerData, AutomationsData automationsData, Automation automationData, UpgradeComponentData upgradeComponentData, IAutomationCommand automationCommand, AutomationUpgradeComponentPresenter skillPresenter) { _upgradeComponentData = upgradeComponentData; _playerData = playerData; AutomationsData = automationsData; AutomationData = automationData; _skillCommand = automationCommand; _skillPresenter = skillPresenter; Subscribe(); }
private AutomationUpgradeComponentPresenter InitializeSkill(string skillPath, IAutomationCommand skillCommand, UpgradeComponentData skillData) { try { var skillPrefab = Resources.Load <AutomationUpgradeComponentPresenter>(skillPath); skillPrefab.SetUpgradeComponentData(skillData); var _ = new UpgradeComponent(_playerData, _automationsData, _automation, skillData, skillCommand, skillPrefab); return(skillPrefab); } catch (Exception e) { Debug.LogError("Something wrong with skill initialization:"); Debug.LogError(e); } return(null); }
public void Init(UpgradeComponentData upgradeComponentData) { _upgradeComponentData = upgradeComponentData; _upgradeComponentData.Attach(this); Fetch(_upgradeComponentData); }
public void AddSkill(IAutomationCommand command, UpgradeComponentData skillData) { SpawnSkillIcon(_product.SkillIconsParent, skillData.IconSkillPath, skillData); _product.AddSkillPrefab(InitializeSkill(skillData.SkillPrefabPath, command, skillData)); }
public void SetUpgradeComponentData(UpgradeComponentData skillData) { _upgradeComponentData = skillData; }