public void TestCard() { Debug.Log("testing card"); UltimateCardPlayEvent cardEvent = new UltimateCardPlayEvent(); cardEvent.Card = _ultimateCard; cardEvent.Targets = null; EventManager.TriggerEvent(BattleManager.PLAY_ULTIMATE_CARD, cardEvent); }
public void OnMouseDown() { UltimateCardInstance ultimate = DataManager.Instance.BattleContext.UltimateCard.Property; //play ultimate card effect if (ultimate != null) { UltimateCardPlayEvent cardEvent = new UltimateCardPlayEvent(); cardEvent.Card = ultimate; Actor[] targetList = new Actor[1]; targetList[0] = EnemyInstance; cardEvent.Targets = targetList; EventManager.TriggerEvent(BattleManager.PLAY_ULTIMATE_CARD, cardEvent); Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); DataManager.Instance.BattleContext.UltimateCard.Property = null; } }
// Playing ultimate card private void OnUltimateCardPlayed(System.Object arg) { if (arg is UltimateCardPlayEvent) { UltimateCardPlayEvent playEvent = (UltimateCardPlayEvent)arg; // remove element cards _battleContext.Player.HandheldSet.RemoveItem(playEvent.LeftCard); _battleContext.Player.HandheldSet.RemoveItem(playEvent.RightCard); _battleContext.Player.Graveyard.AddItem(playEvent.LeftCard); _battleContext.Player.Graveyard.AddItem(playEvent.RightCard); List <Actor> targets = new List <Actor>(); targets.AddRange(playEvent.Targets); playEvent.Card.Play(_battleContext.Player, targets, _battleContext); CheckGameEnded(); } }
public void ComboCardPolymery() { ComboCardUIController.SetVisible(false); Debug.Log("play combo"); BattleContext context = DataManager.Instance.BattleContext; if (null != context) { UltimateCardPlayEvent cardEvent = new UltimateCardPlayEvent(); cardEvent.Card = ComboCardUIController.GetCardInstance(); cardEvent.Targets = null; bool isPlayable = false; ListenableList <ElementCardInstance> handHeldSet = context.Player.HandheldSet; int totalCnt = handHeldSet.GetCount(); for (int i = 0; i < totalCnt; i++) { for (int j = 0; j < totalCnt; j++) { if (cardEvent.Card.IsCardPlayable(handHeldSet.Get(i), handHeldSet.Get(j))) { isPlayable = true; cardEvent.LeftCard = handHeldSet.Get(i); cardEvent.RightCard = handHeldSet.Get(j); EventManager.TriggerEvent(BattleManager.PLAY_ULTIMATE_CARD, cardEvent); break; } else if (cardEvent.Card.IsCardPlayable(handHeldSet.Get(j), handHeldSet.Get(i))) { isPlayable = true; cardEvent.LeftCard = handHeldSet.Get(j); cardEvent.RightCard = handHeldSet.Get(i); EventManager.TriggerEvent(BattleManager.PLAY_ULTIMATE_CARD, cardEvent); break; } } } Debug.Log("IsCombo Card Played: " + isPlayable.ToString()); } }