コード例 #1
0
        // defender continues attack
        public void AnimateFightCellDefenderAttack(Cell cell)
        {
            if (_checkCleaningFight("animateFightCellDefenderAttack"))
            {
                return;
            }

            this._cell2 = cell;

            _attacker = cell.Piece;
            _defender = cell.AttackerPiece;

            FightState = FightCellState.DEFENDER_ATTACK;

            _attacker.SpriteObj.transform.DOLocalMove(Vector3.zero, TIME_ATTACKING).OnComplete(_applyAttackerAttack);

            if (!_isKilling(_attacker, _defender))
            {
                _attacker.SpriteObj.transform.DOLocalMove(_defenderPosition, TIME_ATTACKING_BACK).SetDelay(TIME_ATTACKING);
                _defender.SpriteObj.transform.DOLocalMove(_attackerPosition - _attackedShift, TIME_ATTACKED_SHIFT).SetDelay(TIME_ATTACKING);
                _defender.SpriteObj.transform.DOLocalMove(_attackerPosition, TIME_ATTACKED_BACK_SHIFT).SetDelay(TIME_ATTACKING + TIME_ATTACKED_SHIFT)
                .OnComplete(_afterAttack);
            }
            else
            {
                _defender.SpriteObj.transform.DOLocalMove(_attackerPosition - _deathShift, TIME_DEATH_SHIFT).SetDelay(TIME_ATTACKING);
                _defender.KilledAnimation(1, TIME_DEATH_SHIFT, _onAttackerKilled);
            }
        }
コード例 #2
0
        public FightMapStatus CreateFightMapStatus(int regionIndex)
        {
            //IL_0009: Unknown result type (might be due to invalid IL or missing references)
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            //IL_000f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0014: Unknown result type (might be due to invalid IL or missing references)
            //IL_0015: Unknown result type (might be due to invalid IL or missing references)
            //IL_0016: Unknown result type (might be due to invalid IL or missing references)
            //IL_0017: Unknown result type (might be due to invalid IL or missing references)
            //IL_001c: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f1: Unknown result type (might be due to invalid IL or missing references)
            FightMapRegionDefinition obj = m_regions[regionIndex];
            Vector2Int sizeMin           = obj.sizeMin;
            Vector2Int sizeMax           = obj.sizeMax;
            Vector2Int val  = sizeMax - sizeMin;
            int        num  = val.get_x() * val.get_y();
            int        num2 = m_sizeMax.get_x() - m_sizeMin.get_x();
            int        num3 = m_sizeMin.get_y() * num2 + m_sizeMin.get_x();
            int        num4 = sizeMax.get_x() - sizeMin.get_x();
            int        num5 = sizeMin.get_y() * num4 + sizeMin.get_x();

            FightCellState[] cellStates = m_cellStates;
            FightCellState[] array      = new FightCellState[num];
            for (int i = sizeMin.get_y(); i < sizeMax.get_y(); i++)
            {
                for (int j = sizeMin.get_x(); j < sizeMax.get_x(); j++)
                {
                    int num6 = i * num2 + j - num3;
                    int num7 = i * num4 + j - num5;
                    array[num7] = cellStates[num6];
                }
            }
            return(new FightMapStatus(array, sizeMin, sizeMax));
        }
コード例 #3
0
 private void _clearFight()
 {
     _cell1     = null;
     _cell2     = null;
     _defender  = null;
     _attacker  = null;
     FightState = FightCellState.NONE;
 }
コード例 #4
0
 public bool TryGetCellState(int index, out FightCellState fightCellState)
 {
     if (index < 0 || index >= m_cellStates.Length)
     {
         fightCellState = FightCellState.None;
         return(false);
     }
     fightCellState = m_cellStates[index];
     return(true);
 }
コード例 #5
0
        public bool TryGetCellState(int x, int y, out FightCellState fightCellState)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_0006: Unknown result type (might be due to invalid IL or missing references)
            //IL_0008: Unknown result type (might be due to invalid IL or missing references)
            //IL_000d: Unknown result type (might be due to invalid IL or missing references)
            Vector2Int sizeMin = m_sizeMin;
            Vector2Int sizeMax = m_sizeMax;

            if (x < sizeMin.get_x() || y < sizeMin.get_y() || x >= sizeMax.get_x() || y >= sizeMax.get_y())
            {
                fightCellState = FightCellState.None;
                return(false);
            }
            fightCellState = m_cellStates[y * m_width + x - m_delta];
            return(true);
        }
コード例 #6
0
        public void AnimateAtackerAttack()
        {
            FightState = FightCellState.ATTACKER_ATTACK;

            _attacker.SpriteObj.transform.DOLocalMove(Vector3.zero, TIME_ATTACKING).OnComplete(_applyAttackerAttack);

            if (!_isKilling(_attacker, _defender))
            {
                _attacker.SpriteObj.transform.DOLocalMove(_attackerPosition, TIME_ATTACKING_BACK).SetDelay(TIME_ATTACKING);
                _defender.SpriteObj.transform.DOLocalMove(_defenderPosition + _attackedShift, TIME_ATTACKED_SHIFT).SetDelay(TIME_ATTACKING);
                _defender.SpriteObj.transform.DOLocalMove(_defenderPosition, TIME_ATTACKED_BACK_SHIFT).SetDelay(TIME_ATTACKING + TIME_ATTACKED_SHIFT)
                .OnComplete(_afterAttack);
            }
            else
            {
                _defender.SpriteObj.transform.DOLocalMove(_defenderPosition + _deathShift, TIME_DEATH_SHIFT).SetDelay(TIME_ATTACKING);
                _defender.KilledAnimation(1, TIME_DEATH_SHIFT, _onDefenderKilled);
            }
        }
コード例 #7
0
        public FightMapMovementContext([NotNull] IMapStateProvider stateProvider, [NotNull] IMapEntityProvider entityProvider)
        {
            //IL_0020: Unknown result type (might be due to invalid IL or missing references)
            //IL_0025: Unknown result type (might be due to invalid IL or missing references)
            //IL_0027: Unknown result type (might be due to invalid IL or missing references)
            //IL_002c: Unknown result type (might be due to invalid IL or missing references)
            //IL_002d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0032: Unknown result type (might be due to invalid IL or missing references)
            //IL_00c9: Unknown result type (might be due to invalid IL or missing references)
            this.stateProvider  = stateProvider;
            this.entityProvider = entityProvider;
            Vector2Int sizeMin = stateProvider.sizeMin;
            Vector2Int val     = stateProvider.sizeMax - sizeMin;
            int        num     = val.get_y() * val.get_x();
            int        num2    = sizeMin.get_y() * val.get_x() + sizeMin.get_x();

            grid = new Cell[num];
            Vector2Int coords = default(Vector2Int);

            for (int i = 0; i < num; i++)
            {
                FightCellState cellState = stateProvider.GetCellState(i);
                int            num3      = sizeMin.get_x() + i % val.get_x();
                int            num4      = (i + num2 - num3) / val.get_x();
                coords._002Ector(num3, num4);
                CellState state;
                switch (cellState)
                {
                case FightCellState.None:
                    state = CellState.None;
                    break;

                case FightCellState.Movement:
                    state = CellState.Movement;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                grid[i] = new Cell(coords, state, null);
            }
        }
コード例 #8
0
        public void BeginAttack(Cell cell1, Cell cell2)
        {
            if (_checkCleaningFight("beginAttack"))
            {
                return;
            }

            FightState = FightCellState.ATTTACKER_MOVE_TO_ATTACK_CELL;

            _cell1 = cell1;
            _cell2 = cell2;

            _attacker = cell1.Piece;
            _defender = cell2.Piece;

            // animate
            _defender.SetFightStatus(FightCellStatus.DEFENDER, TIME_MOVE_TO_ATTACK);

            _defender.SpriteObj.transform.DOLocalMove(_defenderPosition, TIME_MOVE_TO_ATTACK);

            _attacker.transform.DOLocalMove(cell2.transform.localPosition, TIME_MOVE_TO_ATTACK);
            _attacker.SpriteObj.transform.DOLocalMove(_attackerPosition, TIME_MOVE_TO_ATTACK).OnComplete(_createFight);
        }