public static void QueueAction(ICardAction action) { if (OnActionQueued != null) { OnActionQueued(action); } }
public void AddAction(ICardAction action) { if (_dead) { return; } _actions.Enqueue(action); }
private void SetCardAction(CardModel cardModel) { switch (cardModel.effect) { case CardEffectType.DRAW_CARDS: // TODO break; case CardEffectType.STAT_GAIN: cardAction = new StatGainCardAction(); cardAction.Init(cardModel); break; } }
void Update() { if (_dead) { return; } if (Input.GetKeyDown(KeyCode.W)) { _actions.Enqueue(new CardMoveAction(CardMoveAction.MovementDirection.Up)); } else if (Input.GetKeyDown(KeyCode.S)) { _actions.Enqueue(new CardMoveAction(CardMoveAction.MovementDirection.Down)); } else if (Input.GetKeyDown(KeyCode.A)) { _actions.Enqueue(new CardMoveAction(CardMoveAction.MovementDirection.Left)); } else if (Input.GetKeyDown(KeyCode.D)) { _actions.Enqueue(new CardMoveAction(CardMoveAction.MovementDirection.Right)); } if (_currentAcion == null) { if (_actions.Count > 0) { _currentAcion = _actions.Dequeue(); } else { return; } } if (_currentAcion.DoAction(gameObject)) { _currentAcion = null; } }
public ICard Load(string input, IFaction _owner) { var lenght = ParseLenght(input); var actions = new ICardAction[lenght, lenght]; var basePoint = ParseBasePoint(input); var legend = ParseLegend(input, _owner); var map = GetCardMapLines(input); for (int z = 0; z < lenght; z++) { for (int x = 0; x < lenght; x++) { actions[x, z] = legend[map[z][x]]?.Invoke(); } } var name = ParseName(input); var color = ParseColor(input); var cost = ParseCost(input); return(new Card(name, color, basePoint, actions, cost)); }
public virtual void Play(Actor source, List <Actor> targets, BattleContext mgr) { foreach (Actor actor in targets) { // Run effects if (null != _targetEffectList) { foreach (JClassInfo property in _targetEffectList) { // 創建Effect ObjectBuilder effectBuilder = new ObjectBuilder(property.Name); foreach (JKeyValuePair attributes in property.Properties) { effectBuilder.SetProperty(attributes.Key, attributes.Value); } ICardAction effect = (ICardAction)effectBuilder.Build(); effect.RunAction(source, actor, this, mgr); } } // Run effects if (null != _sourceEffectList) { foreach (JClassInfo property in _sourceEffectList) { // 創建Effect ObjectBuilder effectBuilder = new ObjectBuilder(property.Name); foreach (JKeyValuePair attributes in property.Properties) { effectBuilder.SetProperty(attributes.Key, attributes.Value); } ICardAction effect = (ICardAction)effectBuilder.Build(); effect.RunAction(actor, source, this, mgr); } } } }
public ActionCard(IHover hoverProvider, ICardAction actionProvider) { this.hoverProvider = hoverProvider; this.actionProvider = actionProvider; }