public void RevealEventCard() { if( _eventCards.Count == 0) { _playAreaState = PlayAreaState.PlayerWon; ScoreScreenText.text = "You Lose!"; ScoreScreen.Move ( ScoreScreenScreenPosition.transform.position, ScoreScreenScreenPosition.transform.rotation, 2.0f, null ); } var newEventCard = _eventCards[0]; _eventCards.RemoveAt(0); var objectMover = newEventCard.GetComponent< ObjectMover >(); objectMover.Move( this.EventCardScreenPosition.position, EventCardScreenPosition.rotation, MoveHeightForNewTile, null ); if( _eventCardActive ) { objectMover = _eventCardActive.GetComponent< ObjectMover >(); objectMover.Move( EventCardDiscardPosition.position, EventCardDiscardPosition.rotation, MoveHeightForReturnTile, null ); //_eventCards.Add(_eventCardActive); } _eventCardActive = newEventCard; _timer = 4.0f; }
private static void LoadOverlordCards(Game game) { StreamReader reader = new StreamReader(TitleContainer.OpenStream("overlordcards.txt")); overlordCards = new List<OverlordCard>(); int n = int.Parse(reader.ReadLine()); for (int i = 0; i < n; i++) { string line = reader.ReadLine(); if (line.StartsWith("//")) continue; OverlordCard card = null; string[] data = line.Split(new char[] { ',' }, 9); int id = int.Parse(data[0]); string type = data[1]; string name = data[2]; int amount = int.Parse(data[3]); int cost = int.Parse(data[4]); int sell = int.Parse(data[5]); string description = data[7]; switch (type) { case "Spawn": List<Monster> monsters = new List<Monster>(); string[] creaturesToSpawn = data[6].Split('/'); for (int j = 0; j < creaturesToSpawn.Length; j++) { for (int k = 0; k < int.Parse(creaturesToSpawn[j].Split(' ')[1]); k++) { monsters.Add(GetMonster(int.Parse(creaturesToSpawn[j].Split(' ')[0]))); } } card = new SpawnCard(id, name, description, cost, sell, monsters.ToArray()); break; case "Power": card = new PowerCard(id, name, description, cost, sell); break; case "Trap": card = new TrapCard(id, name, description, cost, sell); break; case "Event": card = new EventCard(id, name, description, cost, sell); break; } if (card != null) overlordCards.Add(card); } }
/// <summary> /// 事件处理方法 /// </summary> /// <param name="事件"></param> /// <param name="game"></param> /// <returns></returns> public List<string> 事件处理方法(EventCard.全局事件 事件, ActionStatus game) { List<string> ActionLst = new List<string>(); if (!沉默状态 && 自身事件效果.触发效果事件类型 == 事件.触发事件类型) { if (自身事件效果.触发效果事件方向 != CardUtility.目标选择方向枚举.双方) { if (自身事件效果.触发效果事件方向 == CardUtility.目标选择方向枚举.本方 && (!事件.触发位置.本方对方标识)) return ActionLst; if (自身事件效果.触发效果事件方向 == CardUtility.目标选择方向枚举.对方 && (事件.触发位置.本方对方标识)) return ActionLst; } if (!string.IsNullOrEmpty(自身事件效果.限制信息) && !SelectUtility.符合选择条件(this, 自身事件效果.限制信息)) { return ActionLst; } ActionLst.Add(Server.ActionCode.strHitEvent + CardUtility.strSplitMark); //这里有可能是一个增益表达式!! if (自身事件效果.效果编号.StartsWith("A")) { ActionLst.AddRange(((SpellCard)CardUtility.GetCardInfoBySN(自身事件效果.效果编号)).UseSpell(game)); } else { Effect.PointEffect t = new Effect.PointEffect(); string[] opt = 自身事件效果.效果编号.Split("/".ToCharArray()); t.持续回合 = CardUtility.Max.ToString(); t.攻击力 = opt[0]; t.生命值 = opt[1]; ((Effect.IAtomicEffect)t).DealMinion(game, this); } 潜行特性 = false; } return ActionLst; }
public void ReceiveEvent(EventCard eventCard) { if (!waitingEvent) return; this.eventCard = eventCard; objectEvent = Instantiate(Resources.Load<GameObject>("Prefabs/Cards/Card_" + (int)eventCard)); CardAnimation anim = objectEvent.AddComponent<CardAnimation>(); anim.StartTransition(1); receiveEvent = true; }