Spin Wheel Script

i need a script of spin wheel when my PinPointer is at center of Spin Wheel give me script and tell me how i put my assets i have 8 offers in every offer gameobject there is one Image and one TextMeshPro and my all offers are inside a spin wheel
recently i am using these scripts

using UnityEngine;
using UnityEngine.UI;

public class SpinWheel : MonoBehaviour
{
    public GameObject spinningWheel;
    public GameObject dialer;
    public Button spinButton;
    public float minSpinSpeed = 100f;
    public float maxSpinSpeed = 500f;
    public float minSpinDuration = 2f;
    public float maxSpinDuration = 5f;

    public bool isSpinning = false;
    private float spinDuration;
    private float spinStartTime;
    private float spinSpeed;

    // Number of sections in the spin wheel
    private int numberOfSections = 8;

    void Start()
    {
        // Add a listener to the button click event
        spinButton.onClick.AddListener(OnSpinButtonClick);
    }

    void Update()
    {
        if (isSpinning)
        {
            // Rotate the entire spinningWheel only on the Z-axis
            spinningWheel.transform.Rotate(0, 0, spinSpeed * Time.deltaTime);

            // Counter-rotate the dialer to keep its edge fixed
            dialer.transform.Rotate(0, 0, 0);

            // Check if the spin duration has elapsed
            if (Time.time - spinStartTime >= spinDuration)
            {
                // Stop spinning
                isSpinning = false;

                // Calculate the current section based on the edge position
                float edgePosition = dialer.transform.eulerAngles.z;
                int currentSection = Mathf.RoundToInt(edgePosition / (360f / numberOfSections));

                // Save the current section in PlayerPrefs
                PlayerPrefs.SetInt("CurrentSection", currentSection);
            }
        }
    }

    private void OnSpinButtonClick()
    {
        if (!isSpinning)
        {
            // Set random spin speed and duration
            spinSpeed = Random.Range(minSpinSpeed, maxSpinSpeed);
            spinDuration = Random.Range(minSpinDuration, maxSpinDuration);

            // Record the start time
            spinStartTime = Time.time;

            // Start spinning the wheel
            isSpinning = true;
        }
    }
}
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class NearestOfferHandler : MonoBehaviour
{
    public SpinWheel spinWheel;
    public GameObject targetObject; // Assign your specific GameObject in the Inspector

    void Update()
    {
        if (targetObject != null)
        {
            // Get the position of the target object
            Vector3 targetPosition = targetObject.transform.position;

            // Check if the wheel has stopped (you may need to adjust the threshold)
            if (!spinWheel.isSpinning && Mathf.Approximately(spinWheel.spinningWheel.transform.rotation.eulerAngles.z % 360, 0f))
            {
                // Get the nearest offer to the target object and handle it
                HandleNearestWheelResult(targetPosition);
            }
        }
    }

    void HandleNearestWheelResult(Vector3 targetPosition)
    {
        // Get the nearest offer to the specified position
        GameObject nearestOffer = GetNearestOffer(targetPosition);

        if (nearestOffer != null)
        {
            // Extract information from the nearest offer (replace this with your actual logic)
            string offerText = nearestOffer.GetComponentInChildren<TextMeshProUGUI>().text;
            string imageTag = nearestOffer.GetComponentInChildren<Image>().tag;

            // Check the offer and save values accordingly
            if (imageTag == "Money")
            {
                int money = PlayerPrefs.GetInt("Money", 0);
                money += int.Parse(offerText);
                PlayerPrefs.SetInt("Money", money); // Replace 100 with the actual money value
                Debug.Log("Money: " + money);
            }
            else if (imageTag == "Life")
            {
                int life = PlayerPrefs.GetInt("Lives", 0);
                life += int.Parse(offerText);
                PlayerPrefs.SetInt("Lives", life); // Replace 1 with the actual life value
                Debug.Log("Life: " + life);
            }
            else
            {
                Debug.Log("OK");
                Debug.Log(targetObject.transform.position);
                Transform get = GameObject.Find("Offer 1").GetComponent<Transform>();
                Debug.Log(get.transform.position);
            }

            PlayerPrefs.Save();
        }
    }

    GameObject GetNearestOffer(Vector3 targetPosition)
    {
        // Implement logic to find the nearest offer to the specified position
        Transform wheelTransform = spinWheel.spinningWheel.transform;
        GameObject nearestOffer = null;
        float minDistance = float.MaxValue;

        foreach (Transform child in wheelTransform)
        {
            float distance = Vector3.Distance(child.position, targetPosition);

            if (distance < minDistance)
            {
                minDistance = distance;
                nearestOffer = child.gameObject;
            }
        }

        // If no offer found, return null or handle accordingly
        return nearestOffer;
    }
}