public void MoveCardToTomb(BattleCardMaid c) { RemoveCard(c); Tomb.Add(c); c.SetState(BattleMaid.CardState.Tomb); movingToTomb.Add(c); }
public void SummonCard(BattleCardMaid maid) { CurrentMana -= maid.CostMana; Hand.Remove(maid); maid.SetState(BattleMaid.CardState.Field); Monsters.Add(maid); maid.transform.SetParent(MonsterGroup.transform); maid.OnSummon(); }
public void DrawCard(int count = 1) { for (int i = 0; i < count; i++) { BattleCardMaid maid = CardPool[currentCardIdx]; CardPool.Remove(maid); maid.SetState(BattleMaid.CardState.Hand); maid.transform.SetParent(HandGroup.transform); Hand.Add(maid); } }
private void Init() { currentTurn = Turn.Self; ClearCurrentCommand(); selectedCard = null; BGMPlayer.clip = BGM; BGMPlayer.Play(); SelfPlayer.HandGroup.ClearChildren(); SelfPlayer.MonsterGroup.ClearChildren(); OpponentPlayer.HandGroup.ClearChildren(); OpponentPlayer.MonsterGroup.ClearChildren(); LeftCommandPanel.Clear(); SelfPlayer.Init(); SelfPlayer.Side = Turn.Self; SelfPlayer.CardPool.Clear(); for (int i = 0; i < 30; i++) { CardData card = CardPool.Cards[i % CardPool.Cards.Count].Value; BattleCardMaid maid = GenerateCard(card, SelfPlayer.CardPoolGroup.transform as RectTransform); maid.SetState(CardState.CardPool); maid.Owner = SelfPlayer; SelfPlayer.CardPool.Add(maid); } SelfPlayer.DrawCard(5); SelfPlayer.UpdateState(); OpponentPlayer.Init(); OpponentPlayer.Side = Turn.Opponent; OpponentPlayer.CardPool.Clear(); for (int i = 0; i < 30; i++) { CardData card = CardPool.Cards[i % CardPool.Cards.Count].Value; BattleCardMaid maid = GenerateCard(card, OpponentPlayer.CardPoolGroup.transform as RectTransform); maid.SetState(CardState.CardPool); maid.Owner = OpponentPlayer; OpponentPlayer.CardPool.Add(maid); } OpponentPlayer.DrawCard(9); int c = 0; for (int i = 8; i >= 0 && c < 5; i--) { if (OpponentPlayer.Hand[i].Data.Type == CardType.Monster) { OpponentPlayer.SummonCard(OpponentPlayer.Hand[i]); ++c; } } OpponentPlayer.CurrentMana = 1; OpponentPlayer.UpdateState(); for (int i = 0; i < MaxCommand; i++) { commands[i] = Instantiate(CommandTemplate); commands[i].transform.SetParent(LeftCommandPanel); commands[i].SetVisible(false); } TurnEndCommand.SetCommand(CommandMaid.State.TurnEnd, true); Helper.SetText("你的回合。"); }