Exemple #1
0
        /// <summary>
        /// Returns null if there is no targets to chose from.
        /// </summary>
        SkillTargetData ChooseSingleTarget()
        {
            List <CardModel> enemyBackline  = _gameLogic.GetLine(_myIndicator.Opposite(), PlayerLine.Backline);
            List <CardModel> enemyFrontline = _gameLogic.GetLine(_myIndicator.Opposite(), PlayerLine.Frontline);

            if (enemyBackline.Count > 0 && enemyFrontline.Count > 0)
            {
                return(UnityEngine.Random.Range(0, 2) == 0 // both enemy lines contains units so choose one randomly
                    ? GetSingleTarget(PlayerLine.Backline, enemyBackline.Count)
                    : GetSingleTarget(PlayerLine.Frontline, enemyFrontline.Count));
            }
            else if (enemyBackline.Count > 0)
            {
                return(GetSingleTarget(PlayerLine.Backline, enemyBackline.Count));
            }
            else if (enemyFrontline.Count > 0)
            {
                return(GetSingleTarget(PlayerLine.Frontline, enemyFrontline.Count));
            }

            return(null);

            SkillTargetData GetSingleTarget(PlayerLine line, int count)
            => new SkillTargetData(
                _gameLogic.GetLineIndicator(_myIndicator.Opposite(), line),
                UnityEngine.Random.Range(0, count));
        }
 public void StartNextTurn()
 {
     CurrentPlayer = CurrentPlayer.Opposite();
     StartNextTurnInternal();
 }