Beispiel #1
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();
        }
Beispiel #2
0
        private void LateUpdate()
        {
            //IL_0096: Unknown result type (might be due to invalid IL or missing references)
            //IL_0131: Unknown result type (might be due to invalid IL or missing references)
            if (m_feedbackNeedsUpdate)
            {
                UpdateFeedbacks();
                m_feedbackNeedsUpdate = false;
            }
            MapVirtualGrid    virtualGrid    = m_virtualGrid;
            List <CellObject> referenceCells = m_referenceCells;
            List <CellObject> linkedCells    = m_linkedCells;
            List <CellObjectAnimationInstance> cellObjectAnimationInstances = m_cellObjectAnimationInstances;
            float deltaTime       = Time.get_deltaTime();
            float gravityVelocity = deltaTime * m_gravity;

            if (m_virtualGridIsDirty)
            {
                referenceCells.Clear();
                virtualGrid.GetReferenceCellsNoAlloc(referenceCells);
                m_virtualGridIsDirty = false;
            }
            int count  = referenceCells.Count;
            int count2 = cellObjectAnimationInstances.Count;

            if (count2 > 0)
            {
                for (int i = 0; i < count2; i++)
                {
                    CellObjectAnimationInstance cellObjectAnimationInstance = cellObjectAnimationInstances[i];
                    for (int j = 0; j < count; j++)
                    {
                        CellObject cellObject  = referenceCells[j];
                        float      heightDelta = cellObjectAnimationInstance.Resolve(cellObject.coords);
                        cellObject.ApplyAnimation(heightDelta);
                    }
                }
                cellObjectAnimationInstances.Clear();
                m_cellObjectNeedsCleanup = true;
            }
            else if (m_cellObjectNeedsCleanup)
            {
                bool flag = false;
                for (int k = 0; k < count; k++)
                {
                    flag = (referenceCells[k].CleanupAnimation(deltaTime, gravityVelocity) | flag);
                }
                m_cellObjectNeedsCleanup = flag;
            }
            for (int l = 0; l < count; l++)
            {
                CellObject cellObject2 = referenceCells[l];
                bool       isSleeping  = cellObject2.ResolvePhysics(deltaTime, gravityVelocity);
                linkedCells.Clear();
                virtualGrid.GetLinkedCellsNoAlloc(cellObject2.coords, linkedCells);
                int count3 = linkedCells.Count;
                for (int m = 0; m < count3; m++)
                {
                    linkedCells[m].CopyPhysics(cellObject2, isSleeping, deltaTime, gravityVelocity);
                }
            }
        }