Пример #1
0
        public static void SetupSpellTargetHighlight([NotNull] FightMapFeedbackResources resources, [NotNull] FightMapTargetContext context, Vector2Int coords, [NotNull] CellHighlight highlight, Color color)
        {
            //IL_0001: 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)
            if (!context.HasNonEntityTargetAt(coords))
            {
                highlight.ClearSprite();
                return;
            }
            Sprite sprite = resources.areaFeedbackSprites[15];

            highlight.SetSprite(sprite, color);
        }
Пример #2
0
        public static void SetupMovementAreaHighlight([NotNull] FightMapFeedbackResources resources, [NotNull] FightMapMovementContext context, Vector2Int coords, [NotNull] CellHighlight highlight, Color color)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //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_0527: Unknown result type (might be due to invalid IL or missing references)
            //IL_0557: Unknown result type (might be due to invalid IL or missing references)
            //IL_056a: Unknown result type (might be due to invalid IL or missing references)
            if ((context.GetCell(coords).state & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable)
            {
                highlight.ClearSprite();
                return;
            }
            IMapStateProvider stateProvider = context.stateProvider;
            Vector2Int        sizeMin       = stateProvider.sizeMin;
            Vector2Int        sizeMax       = stateProvider.sizeMax;

            FightMapMovementContext.Cell[] grid = context.grid;
            Sprite[]   areaFeedbackSprites      = resources.areaFeedbackSprites;
            Vector2Int val = default(Vector2Int);

            val._002Ector(coords.get_x(), coords.get_y() + 1);
            Vector2Int val2 = default(Vector2Int);

            val2._002Ector(coords.get_x() - 1, coords.get_y());
            Vector2Int val3 = default(Vector2Int);

            val3._002Ector(coords.get_x() + 1, coords.get_y());
            Vector2Int val4 = default(Vector2Int);

            val4._002Ector(coords.get_x(), coords.get_y() - 1);
            FightMapMovementContext.CellState cellState  = (val.get_x() >= sizeMin.get_x() && val.get_x() < sizeMax.get_x() && val.get_y() >= sizeMin.get_y() && val.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val.get_x(), val.get_y())].state : FightMapMovementContext.CellState.None;
            FightMapMovementContext.CellState cellState2 = (val2.get_x() >= sizeMin.get_x() && val2.get_x() < sizeMax.get_x() && val2.get_y() >= sizeMin.get_y() && val2.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val2.get_x(), val2.get_y())].state : FightMapMovementContext.CellState.None;
            FightMapMovementContext.CellState cellState3 = (val3.get_x() >= sizeMin.get_x() && val3.get_x() < sizeMax.get_x() && val3.get_y() >= sizeMin.get_y() && val3.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val3.get_x(), val3.get_y())].state : FightMapMovementContext.CellState.None;
            FightMapMovementContext.CellState num        = (val4.get_x() >= sizeMin.get_x() && val4.get_x() < sizeMax.get_x() && val4.get_y() >= sizeMin.get_y() && val4.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val4.get_x(), val4.get_y())].state : FightMapMovementContext.CellState.None;
            int num2 = ((cellState & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0;
            int num3 = ((cellState2 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0;
            int num4 = ((cellState3 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0;
            int num5 = ((num & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) == FightMapMovementContext.CellState.Reachable) ? 1 : 0;

            switch (4 - (num2 + num3 + num4 + num5))
            {
            case 0:
            case 1:
            case 2:
            {
                Vector2Int val5 = default(Vector2Int);
                val5._002Ector(coords.get_x() - 1, coords.get_y() + 1);
                Vector2Int val6 = default(Vector2Int);
                val6._002Ector(coords.get_x() + 1, coords.get_y() + 1);
                Vector2Int val7 = default(Vector2Int);
                val7._002Ector(coords.get_x() - 1, coords.get_y() - 1);
                Vector2Int val8 = default(Vector2Int);
                val8._002Ector(coords.get_x() + 1, coords.get_y() - 1);
                FightMapMovementContext.CellState cellState4 = (val5.get_x() >= sizeMin.get_x() && val5.get_x() < sizeMax.get_x() && val5.get_y() >= sizeMin.get_y() && val5.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val5.get_x(), val5.get_y())].state : FightMapMovementContext.CellState.None;
                FightMapMovementContext.CellState cellState5 = (val6.get_x() >= sizeMin.get_x() && val6.get_x() < sizeMax.get_x() && val6.get_y() >= sizeMin.get_y() && val6.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val6.get_x(), val6.get_y())].state : FightMapMovementContext.CellState.None;
                FightMapMovementContext.CellState cellState6 = (val7.get_x() >= sizeMin.get_x() && val7.get_x() < sizeMax.get_x() && val7.get_y() >= sizeMin.get_y() && val7.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val7.get_x(), val7.get_y())].state : FightMapMovementContext.CellState.None;
                FightMapMovementContext.CellState num6       = (val8.get_x() >= sizeMin.get_x() && val8.get_x() < sizeMax.get_x() && val8.get_y() >= sizeMin.get_y() && val8.get_y() < sizeMax.get_y()) ? grid[stateProvider.GetCellIndex(val8.get_x(), val8.get_y())].state : FightMapMovementContext.CellState.None;
                int num7  = ((cellState4 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0;
                int num8  = ((cellState5 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0;
                int num9  = ((cellState6 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0;
                int num10 = ((num6 & (FightMapMovementContext.CellState.Reachable | FightMapMovementContext.CellState.Occupied)) != FightMapMovementContext.CellState.Reachable) ? 1 : 0;
                int num11 = 1 - num2;
                int num12 = 1 - num3;
                int num13 = 1 - num4;
                int num14 = 1 - num5;
                int num15 = num11 | num12 | (num7 * num2 * num3);
                int num16 = num11 | num13 | (num8 * num2 * num4);
                int num17 = num14 | num12 | (num9 * num5 * num3);
                int num18 = num14 | num13 | (num10 * num5 * num4);
                Compute(num15 | (num16 << 1) | (num17 << 2) | (num18 << 3) | (num11 << 4) | (num12 << 5) | (num13 << 6) | (num14 << 7), areaFeedbackSprites, highlight, color);
                break;
            }

            case 3:
            {
                Sprite sprite2 = areaFeedbackSprites[4];
                float  angle   = (float)num2 * -90f + (float)num4 * 180f + (float)num5 * 90f;
                highlight.SetSprite(sprite2, color, angle);
                break;
            }

            case 4:
            {
                Sprite sprite = areaFeedbackSprites[5];
                highlight.SetSprite(sprite, color);
                break;
            }

            default:
                throw new ArgumentException();
            }
        }