static ActionNode CreateActionNodeAttackMelee(TBGState s, int targetUnitIndex, int damage, BoardPath path)
        {
            var cpState = new TBGState(s);
            var cpUnitCurrent = cpState.UnitCurrent;
            var cpUnitTarget = cpState.Units[targetUnitIndex];
            var cpPath = new BoardPath(path);
            bool isDead = cpUnitCurrent.Attack(cpUnitTarget, damage);

            // move unit
            cpUnitCurrent.Pos = cpPath.Last;

            // update wait list
            cpState.UpdateWaitListNext();

            return new ActionNode(new TBGActionAttackMelee(
                s.PlayerCurrent,
                s.UnitCurrentIndex,
                cpPath,
                damage,
                targetUnitIndex,
                s.Units[targetUnitIndex].Pos,
                isDead),
                //
                new StateNode(cpState));
        }
        /// <summary>
        /// Create ActionContainer that contain true and average node.
        /// </summary>
        public static ActionContainer CreateAttackMelee(TBGState s, int targetUnitIndex, BoardPath path)
        {
            var unitCurrent = s.UnitCurrent;

            return ActionContainer.CreateAverage(
                CreateActionNodeAttackMelee(s, targetUnitIndex, unitCurrent.CreateDamageRandom(), path),
                CreateActionNodeAttackMelee(s, targetUnitIndex, unitCurrent.CreateDamageAverage(), path));
        }
 /// <summary>
 /// Copy constractor
 /// </summary>
 public BoardPath(BoardPath rhs)
     : this(rhs.Count)
 {
     for (int i = 0; i < rhs.Count; i++)
     {
         this.Add(rhs[i]);
     }
 }
 public TBGActionAttackMelee(int playerOwner, int unitIndex,
     BoardGame.BoardPath path,
     int damage,
     int targetUnitIndex,
     Basic.Vec2Int targetUnitPos,
     bool isTargetDead)
     : base(playerOwner, unitIndex)
 {
     _path = path;
     _damage = damage;
     _targetUnitIndex = targetUnitIndex;
     _targetUnitPos = targetUnitPos;
     _isTargetDead = isTargetDead;
 }
        /// <summary>
        /// Create ActionContainer that contain only true node.
        /// </summary>
        public static ActionContainer CreateMove(TBGState s, BoardPath path)
        {
            var cpState = new TBGState(s);
            var cpUnitCurrent = cpState.UnitCurrent;
            var cpPath = new BoardPath(path);

            // update unit pos
            cpUnitCurrent.Pos = cpPath.Last;

            // update wait list
            cpState.UpdateWaitListNext();

            var moveNode = new ActionNode(new TBGActionMove(
                    s.UnitCurrent.Owner,
                    s.UnitCurrentIndex,
                    cpPath),
                    //
                    new StateNode(cpState));

            return ActionContainer.CreateTrue(moveNode);
        }
        void AnimationMove(int unitIndex, BoardPath path)
        {
            var unit = unitControllers[unitIndex];
            var movePath = BoardPathToWalkPathConverter.Convert(path);

            // totdo furimuki

            foreach (var item in movePath)
            {
                Debug.Log(item);
                // fix postion
                var copy = item;
                copy.PosStart = ConvertWalkToWorldPos(item.PosStart);
                copy.PosEnd = ConvertWalkToWorldPos(item.PosEnd);

                unit.CoSequencer.Add(unit.CoMove2(copy));
            }
        }