예제 #1
0
파일: AI.cs 프로젝트: yulcat/Epic_monad
        public static IEnumerator SelectSkillApplyPoint(BattleData battleData, Direction originalDirection)
        {
            Direction beforeDirection = originalDirection;
            Unit      selectedUnit    = battleData.selectedUnitObject.GetComponent <Unit>();

            while (battleData.currentState == CurrentState.SelectSkillApplyPoint)
            {
                Vector2 selectedUnitPos = battleData.selectedUnitObject.GetComponent <Unit>().GetPosition();

                List <GameObject> activeRange   = new List <GameObject>();
                Skill             selectedSkill = battleData.SelectedSkill;
                activeRange = battleData.tileManager.GetTilesInRange(selectedSkill.GetFirstRangeForm(),
                                                                     selectedUnitPos,
                                                                     selectedSkill.GetFirstMinReach(),
                                                                     selectedSkill.GetFirstMaxReach(),
                                                                     battleData.selectedUnitObject.GetComponent <Unit>().GetDirection());

                Tile selectedTile = UdongNoodle.FindEnemyTile(activeRange, battleData.selectedUnitObject);

                if (selectedTile == null)
                {
                    // 아무것도 할 게 없을 경우 휴식
                    battleData.currentState = CurrentState.RestAndRecover;
                    yield return(battleData.battleManager.StartCoroutine(RestAndRecover.Run(battleData)));

                    yield break;
                }
                // activeRange[Random.Range(0, activeRange.Count)].GetComponent<Tile>();

                battleData.selectedTilePosition = selectedTile.GetTilePos();

                // 타겟팅 스킬을 타겟이 없는 장소에 지정했을 경우 적용되지 않도록 예외처리 필요 - 대부분의 스킬은 논타겟팅. 추후 보강.

                BattleManager battleManager = battleData.battleManager;
                battleData.currentState = CurrentState.CheckApplyOrChain;

                List <GameObject> tilesInSkillRange = GetTilesInSkillRange(battleData, selectedTile);

                yield return(SkillAndChainStates.ApplyChain(battleData, tilesInSkillRange));

                FocusUnit(battleData.SelectedUnit);
                battleData.currentState = CurrentState.FocusToUnit;

                yield return(battleManager.StartCoroutine(SkillAndChainStates.CheckApplyOrChain(battleData, battleData.SelectedTile, originalDirection)));
            }
        }
예제 #2
0
파일: AI.cs 프로젝트: yulcat/Epic_monad
        public static IEnumerator SelectSkillApplyDirection(BattleData battleData, Direction originalDirection)
        {
            Direction         beforeDirection = originalDirection;
            List <GameObject> selectedTiles   = new List <GameObject>();
            Unit  selectedUnit  = battleData.selectedUnitObject.GetComponent <Unit>();
            Skill selectedSkill = battleData.SelectedSkill;

            selectedTiles = battleData.tileManager.GetTilesInRange(selectedSkill.GetSecondRangeForm(),
                                                                   selectedUnit.GetPosition(),
                                                                   selectedSkill.GetSecondMinReach(),
                                                                   selectedSkill.GetSecondMaxReach(),
                                                                   selectedUnit.GetDirection());

            if (battleData.isSelectedTileByUser)
            {
                BattleManager battleManager = battleData.battleManager;
                battleData.currentState = CurrentState.CheckApplyOrChain;
                yield return(battleManager.StartCoroutine(SkillAndChainStates.CheckApplyOrChain(battleData, battleData.SelectedUnitTile, originalDirection)));
            }
        }