Beispiel #1
0
        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 AddSkill(IAutomationCommand command, UpgradeComponentData skillData)
 {
     SpawnSkillIcon(_product.SkillIconsParent, skillData.IconSkillPath, skillData);
     _product.AddSkillPrefab(InitializeSkill(skillData.SkillPrefabPath, command, skillData));
 }