public IAction[] GetAllActionsFlat() { var result = ActionHolders .Select(x => x.Action) .Union( ActionHolders .Where(x => x.Action is IMultipleAction multipleAction) .Select(x => ((IMultipleAction)x.Action).GetAllActionsFlat()).SelectMany(x => x)).ToArray(); return(result); }
private void BaseInit(MapElementInfo mei, BaseDataBuildingUnit d, CalculatedData calc) { action = new ActionHolders(d.action); sprite = d.Icon; name = d.Name(); hp = calc.hp; hpMax = calc.hp; ap = calc.ap; apMax = calc.ap; atk = d.atk; def = d.def; visibilityRange = d.visibilityRange; data = new Dictionary <string, string>(); items = new Dictionary <string, string>(); modi = new Dictionary <string, string>(); spells = new MapElementSpells(); info = new MapElementInfoInfoMgmt(); info.mapElementInfo = mei; }
public void AddNewActionButton(ActionHolders holder, ActionHolder action, MapElementInfo info, GameObject actionPanel) { if (action == null) { throw new MissingMemberException($"Action for {info} is missing."); } //BasePerformAction ba = action.PerformAction(); FDataAction da = action.DataAction(); //can add under construction? if (info.IsUnderConstruction() && !da.useUnderConstruction) { return; } //can add from diff player? if (da.onlyOwner && !info.Owner(S.ActPlayerID())) { return; } //can add final? if (!action.req.Check(S.ActPlayer(), info, info.Pos(), true)) { return; } Button button = UIElements.CreateImageButton(da.Sprite(), actionPanel.transform, () => { PerformAction(holder, action, info); }, da.sound); UIHelper.HoverEnter(button, () => { ShowPanelMessage(S.T("actionTooltip", LSys.tem.inputs.ActionName(da), action.cost, info.data.ap)); }, () => { ShowPanelMessage(info.Status(S.ActPlayerID())); }); }
protected void ActionParse(ActionHolders action, string data) { var a = SplitHelper.Delimiter(data); action.Add(LClass.s.GetNewAction(a.key).Create(a.value)); }
public Spell() { action = new ActionHolders(); actionFail = new ActionHolders(); reqTarget = new ReqHolder(); }
public Item() { action = new ActionHolders(); }