예제 #1
0
    private void UseReviveSkill(UnitEntity entity)
    {
        var skills = _cardContext.GetPlayerSkills <IReviveAbility>(entity.owner.Entity);

        foreach (var s in skills)
        {
            var ability = s.ability.Ability as IReviveAbility;
            ability.OnDead(entity);
        }
    }
    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;
            };
        }
    }