コード例 #1
0
        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));
        }
コード例 #2
0
        /// <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));
        }
コード例 #3
0
 /// <summary>
 /// Copy constractor
 /// </summary>
 public BoardPath(BoardPath rhs)
     : this(rhs.Count)
 {
     for (int i = 0; i < rhs.Count; i++)
     {
         this.Add(rhs[i]);
     }
 }
コード例 #4
0
 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;
 }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
        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));
            }
        }