示例#1
0
        private IEnumerator AIAction(CommanderUnit[] _commanderArray)
        {
            foreach (var v in _commanderArray)
            {
                TileSaveData[] commanderMovingData = sceneTileMapManager.CalculateMovingRange(v);
                activitiesManager.EnterCommanderOrSoliderUnit(v);
                yield return(new WaitForSeconds(2));

                activitiesManager.UnitMoveTo(sceneTileMapManager.GetMoveToUnitAllow(commanderMovingData[0].widthHeighValue).RemoveDuplicates(), v, CtrlType.AI);
                activitiesManager.ExitCommanderOrSoliderUnit();
                yield return(WaitMoveOn(v));

                activitiesManager.EnterCommanderOrSoliderUnit(v);

                foreach (var vv in v.GetSoliderUnitArray())
                {
                    TileSaveData[] soliderMovingData = sceneTileMapManager.CalculateMovingRange(vv);

                    activitiesManager.UnitMoveTo(sceneTileMapManager.GetMoveToUnitAllow(soliderMovingData[0].widthHeighValue).RemoveDuplicates(), vv, CtrlType.AI);

                    yield return(WaitMoveOn(vv));
                }

                yield return(new WaitForSeconds(2));

                activitiesManager.ExitCommanderOrSoliderUnit();

                // 主要为了去掉cacheSaveData数据
                sceneTileMapManager.ClearCacheSaveData();
            }

            gameManager.FinishCurrentRoundTurn();
        }
示例#2
0
        /// <summary>
        /// 指挥圈变更通知
        /// </summary>
        /// <param name="_unit"></param>
        private void CommanderRangeUnit(ActivitiesUnit _unit)
        {
            if (_unit == null)
            {
                activitiesManager.ExitCommanderOrSoliderUnit();
                cacheHitRaycastUnit = null;
                return;
            }

            if (!activitiesManager.GetUnitSameCommander(cacheHitRaycastUnit, _unit))
            {
                activitiesManager.ExitCommanderOrSoliderUnit(true);
            }

            if (_unit.GetType() == typeof(CommanderUnit))
            {
                activitiesManager.EnterCommanderOrSoliderUnit(_unit as CommanderUnit);
                LoadInfo.Instance.sceneWindowsCanvas.ShowActivitiesData(_unit as CommanderUnit, false);
            }
            else if (_unit.GetType() == typeof(SoliderUnit))
            {
                activitiesManager.EnterCommanderOrSoliderUnit((_unit as SoliderUnit)?.mineCommanderUnit);
                LoadInfo.Instance.sceneWindowsCanvas.ShowActivitiesData(_unit as SoliderUnit, false);
            }

            cacheHitRaycastUnit = _unit;
        }