Exemplo n.º 1
0
        /// <summary>
        /// 部隊を配置
        /// </summary>
        /// <param name="unit">部隊</param>
        /// <param name="hex">へクス</param>
        internal void SetUnit(Unit unit, Hex hex)
        {
            if (!hex.CanLand)
            {
                int[] hexIndex = this.GetIndex(hex);
                throw new InvalidOperationException($"へクスに部隊を配置できません。部隊:{unit}、座標{hexIndex[0]}, {hexIndex[1]}");
            }

            if (unit.CurrentHex != null)
            {
                unit.CurrentHex.OnTakeOff();
            }
            hex.OnLanded(unit);
            unit.Move(hex);
        }