//効果の処理
    private IEnumerator EffctExecution(BattleCommand battleCommand)
    {
        BattleCharacter        owner         = battleCommand.owner;
        List <BattleCharacter> targets       = battleCommand.target;
        TargetUnit             targetUnit    = battleCommand.GetTargetType().targetUnit;
        PlayableAsset          playableAsset = battleCommand.GetCommand().animation;
        var effects = battleCommand.GetEffect();

        //効果の範囲が全体の場合
        if (battleCommand.GetTargetType().targetRange == TargetRange.全体)
        {
            //敵キャラクタの行動はアニメション表示をしない
            if (owner is PlayerCharacter)
            {
                BattleDirectorController.Instance.AnimationPlay(playableAsset);
            }
        }

        foreach (var effect in effects)
        {
            //単体処理
            foreach (var target in targets)
            {
                //ターゲットが存在しないとき新しいターゲットに変更する
                BattleCharacter newTarget = target;
                if (TargetUnit.死亡者 != targetUnit && target.IsDead())
                {
                    TargetFilter targetFilter = new TargetFilter();
                    newTarget = targetFilter.Auto(battleCommand);
                }

                //効果の処理
                if (battleCommand.GetTargetType().targetRange == TargetRange.単体)
                {
                    //敵キャラクタの行動はアニメション表示をしない
                    if (owner is PlayerCharacter)
                    {
                        BattleDirectorController.Instance.AnimationPlay(playableAsset, newTarget.transform);
                    }
                }

                effect.Use(owner, newTarget);
                //演出を再生する
                yield return(BattleDirectorController.Instance.Play());
            }
        }
        yield break;
    }
Ejemplo n.º 2
0
    public List <BattleCharacter> EnemyToFilter(BattleCommand battleCommand)
    {
        BattleCharacter owner       = battleCommand.owner;
        TargetType      targetType  = battleCommand.GetTargetType();
        TargetUnit      targetUnit  = targetType.targetUnit;
        TargetRange     targetRange = targetType.targetRange;

        return(EnemyToFilter(owner, targetUnit, targetRange));
    }
Ejemplo n.º 3
0
    public List <BattleCharacter> PlayerToFilter(BattleCommand battleCommand)
    {
        List <PlayerCharacter> playerCharacters = BattleController.instance.AlivePlayerCharacters;
        List <EnemyCharacter>  enemyCharacters  = BattleController.instance.AliveEnemyCharacters;
        BattleCharacter        owner            = battleCommand.owner;

        TargetType  targetType  = battleCommand.GetTargetType();
        TargetUnit  targetUnit  = targetType.targetUnit;
        TargetRange targetRange = targetType.targetRange;

        IReadOnlyCollection <BattleCharacter> target = new List <BattleCharacter>();

        switch (targetUnit)
        {
        case TargetUnit.自分:
            return(new List <BattleCharacter>()
            {
                owner
            });

        case TargetUnit.味方:
            target = playerCharacters;
            break;

        case TargetUnit.相手:
            target = enemyCharacters;
            break;

        case TargetUnit.死亡者:
            var allPlayer = BattleController.instance.playerCharacters;
            target = allPlayer.Where(x => x.IsDead()).ToList();
            break;

        default:
            break;
        }

        switch (targetRange)
        {
        case TargetRange.単体:
            return(Randam(target));

        case TargetRange.全体:
            return(target.Cast <BattleCharacter>().ToList());

        default:
            break;
        }
        return(null);
    }
Ejemplo n.º 4
0
    public List <BattleCharacter> GetBattleCharacters(BattleCommand battleCommand, IReadOnlyCollection <BattleCharacter> Friend, IReadOnlyCollection <BattleCharacter> Opponent)
    {
        BattleCharacter owner       = battleCommand.owner;
        TargetType      targetType  = battleCommand.GetTargetType();
        TargetUnit      targetUnit  = targetType.targetUnit;
        TargetRange     targetRange = targetType.targetRange;
        IReadOnlyCollection <BattleCharacter> target = new List <BattleCharacter>();

        switch (targetUnit)
        {
        case TargetUnit.自分:
            return(new List <BattleCharacter>()
            {
                owner
            });

        case TargetUnit.味方:
            target = Friend;
            break;

        case TargetUnit.相手:
            target = Opponent;
            break;

        case TargetUnit.死亡者:
            target = Friend.Where(x => x.IsDead()).ToList();
            break;

        default:
            break;
        }

        switch (targetRange)
        {
        case TargetRange.単体:
            return(Randam(target));

        case TargetRange.全体:
            return(target.Cast <BattleCharacter>().ToList());

        default:
            break;
        }
        return(null);
    }
Ejemplo n.º 5
0
    //バトルコマンドの効果を実行します
    public IEnumerator Execution(BattleCommand battleCommand)
    {
        BattleCharacter        owner      = battleCommand.owner;
        List <BattleCharacter> targets    = battleCommand.target;
        TargetUnit             targetUnit = battleCommand.GetTargetType().targetUnit;

        var effects = battleCommand.GetEffect();

        foreach (var effect in effects)
        {
            foreach (var target in targets)
            {
                if (!CanEffect(target, targetUnit))
                {
                    continue;
                }
                yield return(StartCoroutine(EffectExecution(effect, owner, target)));
            }
        }
        yield break;
    }
Ejemplo n.º 6
0
    public void SelectCommand(BattleCommand battleCommand)
    {
        this.battleCommand = battleCommand;
        TargetType targetType = battleCommand.GetTargetType();

        battleCommand.owner = CurrentInputCharacter;
        TargetFilter targetFilter = new TargetFilter();


        if (targetType.targetRange == TargetRange.単体)
        {
            var target = targetFilter.PlayerToGroup(battleCommand);
            OpenTargetWindow(target);
        }
        else
        {
            var target = targetFilter.PlayerToFilter(battleCommand);
            battleCommand.target = target;

            SetCommand(battleCommand);
        }
    }