Beispiel #1
0
        public Node GetNode(ActionDefinition action)
        {
            if (action is BuildAction buildAction)
            {
                return(GetNode(buildAction.prefab));
            }

            if (!(action is UpgradeAction upgradeAction))
            {
                Debug.LogError($"No node type defined for action {action.GetType()}");
                return(null);
            }

            var hash = UpgradeGroupNode.GenerateHash(upgradeAction);
            var node = GetNodeFromHash <UpgradeGroupNode>(hash);

            if (node == null)
            {
                node = new UpgradeGroupNode(upgradeAction);
                upgradeGroupNodes.Add(node);
            }
            else
            {
                // TODO this calls a second Setup on the node
                // TODO which replaces the upgrade group sub nodes
                node.Setup(upgradeAction);
            }

            return(node);
        }
Beispiel #2
0
        public void Setup(UpgradeGroupNode group, UpgradeAction.UpgradeDetails upgrade, int index)
        {
            this.group   = group;
            this.upgrade = upgrade;
            this.index   = index;

            hash    = GenerateHash(upgrade);
            Element = GetElement();
        }
Beispiel #3
0
 public UpgradeSubNode(UpgradeGroupNode group, UpgradeAction.UpgradeDetails upgrade, int index)
 {
     MoveDisabled = false;
     Setup(group, upgrade, index);
 }