Пример #1
0
    void InitializeExplosionColumns()
    {
        bool leftColumnLineNotCompleted  = true;
        bool rightColumnLineNotCompleted = true;
        bool upColumnLineNotCompleted    = true;
        bool downColumnLineNotCompleted  = true;

        Vector2Int left;
        Vector2Int right;
        Vector2Int up;
        Vector2Int down;

        Instantiate(layoutManager.explosionColumnPrefab, transform.position, Quaternion.identity, transform);

        for (int i = 1; i <= player.bombRange; i++)
        {
            left  = new Vector2Int((int)transform.position.x - i, (int)transform.position.z);
            right = new Vector2Int((int)transform.position.x + i, (int)transform.position.z);
            up    = new Vector2Int((int)transform.position.x, (int)transform.position.z + i);
            down  = new Vector2Int((int)transform.position.x, (int)transform.position.z - i);

            if (leftColumnLineNotCompleted)
            {
                leftColumnLineNotCompleted = InitializeOuterColumn(left);
            }
            else
            {
                left = Vector2Int.zero;
            }

            if (rightColumnLineNotCompleted)
            {
                rightColumnLineNotCompleted = InitializeOuterColumn(right);
            }
            else
            {
                right = Vector2Int.zero;
            }

            if (upColumnLineNotCompleted)
            {
                upColumnLineNotCompleted = InitializeOuterColumn(up);
            }
            else
            {
                up = Vector2Int.zero;
            }

            if (downColumnLineNotCompleted)
            {
                downColumnLineNotCompleted = InitializeOuterColumn(down);
            }
            else
            {
                down = Vector2Int.zero;
            }

            layoutManager.CheckColumnExplosion(left, right, up, down);
        }
    }