protected override void Process(GameEventEntity entity) { var cardEvent = entity.eventUseCardOnUnit; var cardEntity = cardEvent.CardEntity; var ability = (ActiveAbility <UnitEntity>)cardEntity.ability.Ability; ability.OnTargetSelected(cardEvent.UserEntity, cardEvent.TargetEntity); if (cardEntity.hasAbilityEffect) { IAbilityAnimation animation = ability as IAbilityAnimation; if (animation == null) { var effect = Object.Instantiate( cardEntity.abilityEffect.EffectObject, cardEvent.TargetEntity.view.GameObject.transform, false ).GetComponent <AbilityEffect>(); effect.PlayAnimation(); } else { var effect = cardEntity.abilityEffect.EffectObject; animation.PlayAnimation(effect, cardEvent.UserEntity, cardEvent.TargetEntity); } } //if (cardEntity.hasAbilityEffect) //{ // var effect = Object.Instantiate( // cardEntity.abilityEffect.EffectObject, // cardEvent.TargetEntity.view.GameObject.transform, false // ).GetComponent<AbilityEffect>(); // effect.PlayAnimation(); //} if (cardEntity.hasDeckCard) { RemovePlayerCard(cardEntity); } var msg = string.Format("{0} use {1}", cardEvent.UserEntity.owner.Entity.player, cardEntity.cardDescription.Name ); if (cardEvent.TargetEntity != cardEvent.UserEntity) { msg += " to " + cardEvent.TargetEntity.owner.Entity.player; } EventLogger.ShowMessge(msg); }
protected override void Execute(List<GameEntity> entities) { foreach (var e in entities) { Debug.Log("Boss Prepare active"); var cards = _cardContext.GetPlayerSkills<ActiveAbility<UnitEntity>>(e); var unit = _unitContext.GetEntityOwnedBy(e); foreach (var card in cards) { Debug.Log("Boss Activeskill card"); var ability = card.ability.Ability as ActiveAbility<UnitEntity>; Debug.Log("ability boss = "+(ability==null)); ability.OnTargetSelected(unit, unit); if(card.hasAbilityEffect) { IAbilityAnimation animation = ability as IAbilityAnimation; if(animation == null) { var effect = Object.Instantiate( card.abilityEffect.EffectObject, unit.view.GameObject.transform , false ).GetComponent<AbilityEffect>(); effect.PlayAnimation(); } else { var effect = card.abilityEffect.EffectObject; animation.PlayAnimation(effect,unit,unit); } } } } if(_syscon.AutoEndTurnForBoss) { _noti.AnimationEndAction = () => { var endTurnEvent = _eventContext.CreateEntity(); endTurnEvent.isEventEndTurn = true; }; } }