public override void Execute() { //事件接口; //----------------------------------------------------------------------- _cardOfKickTheDoorAtPresent = CoreDataObserver.GetInstance().Get_CardOfKickTheDoorAtPresent();//获取当前的踢门牌; if (_cardOfKickTheDoorAtPresent != null && _cardOfKickTheDoorAtPresent.GetCardType() == CardType.DebuffCard) { //当前卡牌确实为诅咒卡; List <string> function = null; Base_Event events = null; function = _cardOfKickTheDoorAtPresent.GetDebuffCard().GetCurse(); if (function != null) { foreach (string i in function) { //通过字符串从EventTable中获取对应的事件类型,制造出对应的事件;(注意:先将事件类型与对应的字符串注册到EventTable中); events = EventFactory.GetInstance().GetEvent(i); events.SetCard(_cardOfKickTheDoorAtPresent); //为此事件添加父类card; EventQueue.GetInstance().PushEventForSecondqueue(events); //向事件队列中添加事件; } } } else { //出错并不是诅咒卡; Console.WriteLine("此卡牌不是诅咒卡或者当前踢门卡为空"); return; } //----------------------------------------------------------------------- }
//---------------------------------------------------------------- //事件组合器; public override void Update() { //------------------------------------------------------------- if (CoreDataObserver.GetInstance().GetCardOfTheMonsterAtPresent().Count > 0 && CoreDataObserver.GetInstance().GetMomentTypeAtPresent() != MomentType.CombatPhase) { //当前场地上的怪兽容器存在怪兽卡片,并且当前游戏阶段不为战斗阶段,则执行此函数; //将当前的游戏阶段设置为战斗阶段; EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent("ChangeMomentType_CombatPhase"));//投递事件; } //------------------------------------------------------------- }
//---------------------------------------------------------------- //事件组合器; public override void Update() { //事件处理; //------------------------------------------------------------ _double = CoreDataObserver.GetInstance().GetMomentTypeAtPresent();//获取当前的状态; if (_double != _momentType) { _momentType = _double;//触发了新的状态; //------------------------------------------------------------------------------------------------ //Do something: //Put event; switch (_momentType) { case MomentType.KickTheDoor: Debug.Log("MomentTypeAtPresent_Listenner"); EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent("SetACardOfKickTheDoor")); //投递事件; //---------------------------------------------------------------------------------------- //当前为踢门牌阶段; //从踢门牌堆中获取一张卡牌; //............. //...... //... //---------------------------------------------------------------------------------------- break; case MomentType.FreePhase: //---------------------------------------------------------------------------------------- //当前为自由阶段;(抽到的踢门牌不为怪兽卡) Console.WriteLine("当前为自由阶段,在此阶段你可以做任何想做的事情,阶段持续时间为10S,时间结束后,强制结束你的回合"); //---------------------------------------------------------------------------------------- break; case MomentType.CombatPhase: //---------------------------------------------------------------------------------------- //当前为战斗阶段;(怪兽List不为空的时候) Console.WriteLine("当前为战斗阶段"); //---------------------------------------------------------------------------------------- break; //---------------------------------------------------------------------------------------- default: break; } //------------------------------------------------------------------------------------------------- } //------------------------------------------------------------ }
//---------------------------------------------------------------- //事件组合器; public override void Update() { //游戏阶段更新; _double = CoreDataObserver.GetInstance().Get_CardOfKickTheDoorAtPresent();//获取最新的卡牌数据; if (_double != _cardOfKickTheDoorAtPresent) { _cardOfKickTheDoorAtPresent = _double; //------------------------------------------------------------------------------------------------- //Do something: //Put event; switch (_cardOfKickTheDoorAtPresent.GetCardType()) { case CardType.DebuffCard: //----------------------------------------------------------------------------------------- //当前抽到的卡片为诅咒卡和即时魔法卡; EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent("Debuff_CreatEventOne")); //投递事件; //----------------------------------------------------------------------------------------- break; case CardType.MonsterCard: //----------------------------------------------------------------------------------------- //当前抽到的卡片为怪兽卡; EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent(" GetMonsterCardAndPushItToList")); //----------------------------------------------------------------------------------------- break; default: //----------------------------------------------------------------------------------------- //其余卡片;(将此卡片加入手牌中) EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent("GetACardOfKickTheDoor")); //投递事件; //------------------------------------------------------------------------------------------ //Test: //当前的手牌 //----------------------------------------------------------------------------------------- break; } //------------------------------------------------------------------------------------------------- } }
//---------------------------------------------------------------- //事件组合器; public override void Update() { _double = CoreDataObserver.GetInstance().Get_CardOfThePlayAtPresent();//获取最新的打出卡牌数据; if (_double != _cardOfThePlayAtPresent) { _cardOfThePlayAtPresent = _double; //------------------------------------------------------------------------------------------------- //Do something: //Put event; switch (_cardOfThePlayAtPresent.GetCardType()) { case CardType.MagicCard: //----------------------------------------------------------------------------------------- //当前出的卡片为魔法卡; //EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent("Debuff_CreatEventOne"));//投递事件; if (CoreDataObserver.GetInstance().GetMomentTypeAtPresent() == MomentType.DisruptivePhase || CoreDataObserver.GetInstance().GetMomentTypeAtPresent() == MomentType.A_HandoutPhase) { //如果当前阶段为捣乱阶段或者施舍阶段; EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent("PushAttackEnemyCards")); //投递事件; } else { //为其他阶段; //表明作用对象为本人或者为本人所面对的怪物; EventQueue.GetInstance().PushEventForSecondqueue(EventFactory.GetInstance().GetEvent("Magic_CreatEvent")); //投递事件; } //----------------------------------------------------------------------------------------- break; case CardType.MonsterCard: //----------------------------------------------------------------------------------------- //当前出的卡片为怪兽卡; //----------------------------------------------------------------------------------------- break; case CardType.EquipmentCard: //----------------------------------------------------------------------------------------- //当前出的卡牌为装备卡; //----------------------------------------------------------------------------------------- break; case CardType.OccupationCard: //----------------------------------------------------------------------------------------- //当前出的卡牌为职业卡; //----------------------------------------------------------------------------------------- break; case CardType.RaceCard: //----------------------------------------------------------------------------------------- //当前出的卡牌为种族卡; //----------------------------------------------------------------------------------------- break; case CardType.DebuffCard: //----------------------------------------------------------------------------------------- //当前出的卡牌为诅咒卡; //----------------------------------------------------------------------------------------- break; default: //----------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------- break; } //------------------------------------------------------------------------------------------------- } }