Ejemplo n.º 1
0
        public bool TryGetReferenceCell(Vector2Int coords, out CellObject referenceCell)
        {
            //IL_003e: Unknown result type (might be due to invalid IL or missing references)
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            //IL_0045: Unknown result type (might be due to invalid IL or missing references)
            //IL_0047: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;
            int            cellIndex     = mapDefinition.GetCellIndex(coords.get_x(), coords.get_y());
            Cell           cell          = m_virtualCells[cellIndex];
            Area           area          = cell.area;

            if (area == null)
            {
                referenceCell = cell.cellObject;
                return(true);
            }
            Vector2Int refCoord = area.refCoord;

            if (refCoord == coords)
            {
                cellIndex     = mapDefinition.GetCellIndex(refCoord.get_x(), refCoord.get_y());
                referenceCell = m_virtualCells[cellIndex].cellObject;
                return(true);
            }
            referenceCell = null;
            return(false);
        }
Ejemplo n.º 2
0
        public void MoveArea([NotNull] Area from, [NotNull] Area to)
        {
            //IL_001a: Unknown result type (might be due to invalid IL or missing references)
            //IL_001f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0069: Unknown result type (might be due to invalid IL or missing references)
            //IL_006e: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;

            Vector2Int[] occupiedCoords = from.occupiedCoords;
            int          num            = occupiedCoords.Length;

            for (int i = 0; i < num; i++)
            {
                Vector2Int val       = occupiedCoords[i];
                int        cellIndex = mapDefinition.GetCellIndex(val.get_x(), val.get_y());
                m_virtualCells[cellIndex].area = null;
            }
            Vector2Int[] occupiedCoords2 = to.occupiedCoords;
            int          num2            = occupiedCoords2.Length;

            for (int j = 0; j < num2; j++)
            {
                Vector2Int val2       = occupiedCoords2[j];
                int        cellIndex2 = mapDefinition.GetCellIndex(val2.get_x(), val2.get_y());
                m_virtualCells[cellIndex2].area = to;
            }
        }
Ejemplo n.º 3
0
        public void GetLinkedCellsNoAlloc(Vector2Int coords, List <CellObject> outCells)
        {
            //IL_0033: Unknown result type (might be due to invalid IL or missing references)
            //IL_0038: Unknown result type (might be due to invalid IL or missing references)
            //IL_0055: Unknown result type (might be due to invalid IL or missing references)
            //IL_005a: Unknown result type (might be due to invalid IL or missing references)
            //IL_005c: Unknown result type (might be due to invalid IL or missing references)
            //IL_005e: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;
            int            cellIndex     = mapDefinition.GetCellIndex(coords.get_x(), coords.get_y());
            Area           area          = m_virtualCells[cellIndex].area;

            if (area == null || area.refCoord != coords)
            {
                return;
            }
            Vector2Int[] occupiedCoords = area.occupiedCoords;
            int          num            = occupiedCoords.Length;

            for (int i = 0; i < num; i++)
            {
                Vector2Int val = occupiedCoords[i];
                if (!(val == coords))
                {
                    cellIndex = mapDefinition.GetCellIndex(val.get_x(), val.get_y());
                    outCells.Add(m_virtualCells[cellIndex].cellObject);
                }
            }
        }
Ejemplo n.º 4
0
        public void GetAreaCellsNoAlloc(Vector2Int coords, List <CellObject> outCells)
        {
            //IL_0065: Unknown result type (might be due to invalid IL or missing references)
            //IL_006a: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;
            int            cellIndex     = mapDefinition.GetCellIndex(coords.get_x(), coords.get_y());
            Cell           cell          = m_virtualCells[cellIndex];
            Area           area          = cell.area;

            if (area == null)
            {
                CellObject cellObject = cell.cellObject;
                if (null != cellObject)
                {
                    outCells.Add(cellObject);
                }
                return;
            }
            Vector2Int[] occupiedCoords = area.occupiedCoords;
            int          num            = occupiedCoords.Length;

            for (int i = 0; i < num; i++)
            {
                Vector2Int val = occupiedCoords[i];
                cellIndex = mapDefinition.GetCellIndex(val.get_x(), val.get_y());
                outCells.Add(m_virtualCells[cellIndex].cellObject);
            }
        }
Ejemplo n.º 5
0
        public unsafe virtual bool TryGetCellObject(int x, int y, out CellObject cellObject)
        {
            //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)
            //IL_0012: 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_001f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
            //IL_003a: Unknown result type (might be due to invalid IL or missing references)
            //IL_0044: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;
            Vector2        val           = Vector2Int.op_Implicit(mapDefinition.sizeMin);

            if ((float)x < ((IntPtr)(void *)val).x || (float)y < ((IntPtr)(void *)val).y)
            {
                cellObject = null;
                return(false);
            }
            Vector2 val2 = Vector2Int.op_Implicit(mapDefinition.sizeMax);

            if ((float)x >= ((IntPtr)(void *)val2).x || (float)y >= ((IntPtr)(void *)val2).y)
            {
                cellObject = null;
                return(false);
            }
            int cellIndex = mapDefinition.GetCellIndex(x, y);

            cellObject = m_cellObjectsByIndex[cellIndex];
            return(null != cellObject);
        }
Ejemplo n.º 6
0
        protected void Create()
        {
            //IL_0008: 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_0013: Unknown result type (might be due to invalid IL or missing references)
            //IL_0018: Unknown result type (might be due to invalid IL or missing references)
            //IL_004c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0051: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;
            Vector2Int     val           = mapDefinition.sizeMax - mapDefinition.sizeMin;

            m_cellObjectsByIndex = new CellObject[val.get_x() * val.get_y()];
            int num = m_cellObjects.Length;

            for (int i = 0; i < num; i++)
            {
                CellObject cellObject = m_cellObjects[i];
                Vector2Int coords     = cellObject.coords;
                int        cellIndex  = mapDefinition.GetCellIndex(coords.get_x(), coords.get_y());
                m_cellObjectsByIndex[cellIndex] = cellObject;
                cellObject.Initialize(this);
            }
            m_virtualGrid = new MapVirtualGrid(mapDefinition, m_cellObjects);
            CreateCellHighlights();
        }
Ejemplo n.º 7
0
        public CellObject GetReferenceCell(Vector2Int coords)
        {
            //IL_003b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0040: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;
            int            cellIndex     = mapDefinition.GetCellIndex(coords.get_x(), coords.get_y());
            Cell           cell          = m_virtualCells[cellIndex];
            Area           area          = cell.area;

            if (area == null)
            {
                return(cell.cellObject);
            }
            Vector2Int refCoord = area.refCoord;

            cellIndex = mapDefinition.GetCellIndex(refCoord.get_x(), refCoord.get_y());
            return(m_virtualCells[cellIndex].cellObject);
        }
Ejemplo n.º 8
0
        public unsafe IEnumerator AddMonsterSpawnCell(int x, int y, Direction direction)
        {
            MonsterSpawnCellDefinition monsterSpawnCellDefinition = m_bossFightMapResources.monsterSpawnCellDefinition;

            if (null == monsterSpawnCellDefinition)
            {
                yield break;
            }
            IMapDefinition mapDefinition = m_mapDefinition;
            Vector2        val           = Vector2Int.op_Implicit(mapDefinition.sizeMin);

            if ((float)x < ((IntPtr)(void *)val).x || (float)y < ((IntPtr)(void *)val).y)
            {
                yield break;
            }
            Vector2 val2 = Vector2Int.op_Implicit(mapDefinition.sizeMax);

            if ((float)x >= ((IntPtr)(void *)val2).x || (float)y >= ((IntPtr)(void *)val2).y)
            {
                yield break;
            }
            int        index      = mapDefinition.GetCellIndex(x, y);
            CellObject cellObject = m_cellObjectsByIndex[index];
            Transform  transform  = cellObject.get_transform();
            Vector3    position   = transform.get_position() + 0.5f * Vector3.get_up();
            Quaternion rotation   = Quaternion.get_identity();

            if (AudioManager.isReady)
            {
                AudioReference appearanceSound = monsterSpawnCellDefinition.appearanceSound;
                if (appearanceSound.get_isValid())
                {
                    AudioManager.PlayOneShot(appearanceSound, transform);
                }
            }
            VisualEffect appearanceEffect = monsterSpawnCellDefinition.appearanceEffect;

            if (null != appearanceEffect)
            {
                Object.Instantiate <VisualEffect>(appearanceEffect, position, rotation, transform);
                float appearanceDelay = monsterSpawnCellDefinition.appearanceDelay;
                if (appearanceDelay > 0f)
                {
                    yield return((object)new WaitForTime(appearanceDelay));
                }
            }
            GameObject val3 = monsterSpawnCellDefinition.Instantiate(position, rotation, cellObject.get_transform());

            if (!(null == val3))
            {
                val3.GetComponent <SpawnCellObject>().SetDirection(direction);
                m_monsterSpawnCellDictionary.Add(index, val3);
            }
        }
Ejemplo n.º 9
0
        public bool IsReferenceCell(Vector2Int coords)
        {
            //IL_0030: Unknown result type (might be due to invalid IL or missing references)
            //IL_0035: Unknown result type (might be due to invalid IL or missing references)
            int  cellIndex = m_mapDefinition.GetCellIndex(coords.get_x(), coords.get_y());
            Area area      = m_virtualCells[cellIndex].area;

            if (area != null)
            {
                return(area.refCoord == coords);
            }
            return(true);
        }
Ejemplo n.º 10
0
        public void RemoveArea([NotNull] Area area)
        {
            //IL_0018: Unknown result type (might be due to invalid IL or missing references)
            //IL_001d: Unknown result type (might be due to invalid IL or missing references)
            IMapDefinition mapDefinition = m_mapDefinition;

            Vector2Int[] occupiedCoords = area.occupiedCoords;
            int          num            = occupiedCoords.Length;

            for (int i = 0; i < num; i++)
            {
                Vector2Int val       = occupiedCoords[i];
                int        cellIndex = mapDefinition.GetCellIndex(val.get_x(), val.get_y());
                m_virtualCells[cellIndex].area = null;
            }
        }
Ejemplo n.º 11
0
        public MapVirtualGrid(IMapDefinition mapDefinition, CellObject[] cells)
        {
            //IL_000e: 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_0019: Unknown result type (might be due to invalid IL or missing references)
            //IL_001e: Unknown result type (might be due to invalid IL or missing references)
            //IL_0046: Unknown result type (might be due to invalid IL or missing references)
            //IL_004b: Unknown result type (might be due to invalid IL or missing references)
            m_mapDefinition = mapDefinition;
            Vector2Int val = mapDefinition.sizeMax - mapDefinition.sizeMin;

            m_virtualCells = new Cell[val.get_x() * val.get_y()];
            int num = cells.Length;

            for (int i = 0; i < num; i++)
            {
                CellObject cellObject = cells[i];
                Vector2Int coords     = cellObject.coords;
                int        cellIndex  = mapDefinition.GetCellIndex(coords.get_x(), coords.get_y());
                m_virtualCells[cellIndex] = new Cell(cellObject);
            }
        }
Ejemplo n.º 12
0
        public virtual CellObject GetCellObject(int x, int y)
        {
            int cellIndex = m_mapDefinition.GetCellIndex(x, y);

            return(m_cellObjectsByIndex[cellIndex]);
        }
Ejemplo n.º 13
0
        private void UpdateFeedbacks()
        {
            //IL_0046: Unknown result type (might be due to invalid IL or missing references)
            //IL_004b: Unknown result type (might be due to invalid IL or missing references)
            //IL_004d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0052: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ef: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f4: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
            //IL_00fb: Unknown result type (might be due to invalid IL or missing references)
            //IL_0103: Unknown result type (might be due to invalid IL or missing references)
            //IL_0108: Unknown result type (might be due to invalid IL or missing references)
            //IL_0146: Unknown result type (might be due to invalid IL or missing references)
            //IL_0152: Unknown result type (might be due to invalid IL or missing references)
            //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
            //IL_01a6: Unknown result type (might be due to invalid IL or missing references)
            //IL_01a8: Unknown result type (might be due to invalid IL or missing references)
            //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
            //IL_024d: Unknown result type (might be due to invalid IL or missing references)
            //IL_0252: Unknown result type (might be due to invalid IL or missing references)
            //IL_0264: Unknown result type (might be due to invalid IL or missing references)
            //IL_0269: Unknown result type (might be due to invalid IL or missing references)
            //IL_026b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0270: Unknown result type (might be due to invalid IL or missing references)
            //IL_02af: Unknown result type (might be due to invalid IL or missing references)
            //IL_02bb: Unknown result type (might be due to invalid IL or missing references)
            //IL_0311: Unknown result type (might be due to invalid IL or missing references)
            FightMapFeedbackResources feedbackResources = m_feedbackResources;

            if (null == feedbackResources)
            {
                return;
            }
            FightMapMovementContext[] movementContexts = m_movementContexts;
            int num = movementContexts.Length;

            for (int i = 0; i < num; i++)
            {
                FightMapMovementContext fightMapMovementContext = movementContexts[i];
                if (!fightMapMovementContext.hasEnded)
                {
                    continue;
                }
                IMapDefinition    mapDefinition = m_mapDefinition;
                IMapStateProvider stateProvider = fightMapMovementContext.stateProvider;
                Vector2Int        sizeMin       = stateProvider.sizeMin;
                Vector2Int        sizeMax       = stateProvider.sizeMax;
                for (int j = sizeMin.get_y(); j < sizeMax.get_y(); j++)
                {
                    for (int k = sizeMin.get_x(); k < sizeMax.get_x(); k++)
                    {
                        int        cellIndex  = mapDefinition.GetCellIndex(k, j);
                        CellObject cellObject = m_cellObjectsByIndex[cellIndex];
                        if (!(null == cellObject))
                        {
                            cellObject.highlight.ClearSprite();
                        }
                    }
                }
            }
            FightMapTargetContext targetContext = m_targetContext;

            if (targetContext != null)
            {
                if (targetContext.isActive)
                {
                    IMapDefinition    mapDefinition2      = m_mapDefinition;
                    IMapStateProvider stateProvider2      = targetContext.stateProvider;
                    Vector2Int        sizeMin2            = stateProvider2.sizeMin;
                    Vector2Int        sizeMax2            = stateProvider2.sizeMax;
                    Color             targetableAreaColor = feedbackResources.feedbackColors.targetableAreaColor;
                    for (int l = sizeMin2.get_y(); l < sizeMax2.get_y(); l++)
                    {
                        for (int m = sizeMin2.get_x(); m < sizeMax2.get_x(); m++)
                        {
                            int        cellIndex2  = mapDefinition2.GetCellIndex(m, l);
                            CellObject cellObject2 = m_cellObjectsByIndex[cellIndex2];
                            if (!(null == cellObject2))
                            {
                                FightMapFeedbackHelper.SetupSpellTargetHighlight(feedbackResources, targetContext, cellObject2.coords, cellObject2.highlight, targetableAreaColor);
                            }
                        }
                    }
                    m_pathFinderFeedbackManager.Clear();
                    return;
                }
                if (targetContext.hasEnded)
                {
                    IMapDefinition    mapDefinition3 = m_mapDefinition;
                    IMapStateProvider stateProvider3 = targetContext.stateProvider;
                    Vector2Int        sizeMin3       = stateProvider3.sizeMin;
                    Vector2Int        sizeMax3       = stateProvider3.sizeMax;
                    for (int n = sizeMin3.get_y(); n < sizeMax3.get_y(); n++)
                    {
                        for (int num2 = sizeMin3.get_x(); num2 < sizeMax3.get_x(); num2++)
                        {
                            int        cellIndex3  = mapDefinition3.GetCellIndex(num2, n);
                            CellObject cellObject3 = m_cellObjectsByIndex[cellIndex3];
                            if (!(null == cellObject3))
                            {
                                cellObject3.highlight.ClearSprite();
                            }
                        }
                    }
                }
            }
            FightMapMovementContext activeMovementContext = m_activeMovementContext;

            if (activeMovementContext == null)
            {
                m_pathFinderFeedbackManager.Clear();
                return;
            }
            ICharacterEntity trackedCharacter = activeMovementContext.trackedCharacter;

            if (trackedCharacter != null)
            {
                Color             highlightColor = GetHighlightColor(feedbackResources.feedbackColors, activeMovementContext.entityProvider, trackedCharacter);
                IMapDefinition    mapDefinition4 = m_mapDefinition;
                IMapStateProvider stateProvider4 = activeMovementContext.stateProvider;
                Vector2Int        sizeMin4       = stateProvider4.sizeMin;
                Vector2Int        sizeMax4       = stateProvider4.sizeMax;
                for (int num3 = sizeMin4.get_y(); num3 < sizeMax4.get_y(); num3++)
                {
                    for (int num4 = sizeMin4.get_x(); num4 < sizeMax4.get_x(); num4++)
                    {
                        int        cellIndex4  = mapDefinition4.GetCellIndex(num4, num3);
                        CellObject cellObject4 = m_cellObjectsByIndex[cellIndex4];
                        if (!(null == cellObject4))
                        {
                            FightMapFeedbackHelper.SetupMovementAreaHighlight(feedbackResources, activeMovementContext, cellObject4.coords, cellObject4.highlight, highlightColor);
                        }
                    }
                }
            }
            if (m_pathFinder.tracking)
            {
                Vector2Int?target = activeMovementContext.targetedEntity?.area.refCoord;
                m_pathFinderFeedbackManager.Setup(feedbackResources.movementFeedbackResources, m_pathFinder.currentPath, target);
            }
            else
            {
                m_pathFinderFeedbackManager.Clear();
            }
        }