object oriented – Collection of Unity C# scripts for a Katamari Damacy-style game, with a comparison to the two scripts I originally had, looking for SOLID advice

I would like some feedback on trying to implement SOLID principles to my code, I have provided below the ‘original’ script which accomplished a variety of tasks, and then the ‘new’ scripts that accomplish the same things while trying to be more SOLID friendly. In no way do I consider these scripts finished or perfect, I am looking for tips to improve SOLID Conformity.

Original scripts:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class BallController : MonoBehaviour
{
    (SerializeField) private BoostBar boostBar; 
    (SerializeField) private Transform cameraTransform;
    (SerializeField) private float rollSpeed;
    private float originalRollSpeed;
    (SerializeField) private Rigidbody rb;
    (SerializeField) private bool isGrounded;
    (Header("Size stats:"))
    (SerializeField) private float size = 0;
    (SerializeField) private float sizeNeeded = 0;

    (SerializeField) private CinemachineFreeLook cineMachine;
    (SerializeField) private SphereCollider physicalSphere;
    (SerializeField) private SphereCollider triggerSphere;
    private bool boostJump;

    private float originalOrbit;
    private float desiredOrbit;

    void Start()
    {
        originalRollSpeed = rollSpeed;
        originalOrbit = cineMachine.m_Orbits(0).m_Radius;
        desiredOrbit = originalOrbit + 0.2f;

        Cursor.lockState = CursorLockMode.Locked;
        size = gameObject.GetComponent<MeshRenderer>().bounds.size.x  +
               gameObject.GetComponent<MeshRenderer>().bounds.size.y  +
               gameObject.GetComponent<MeshRenderer>().bounds.size.z;
        sizeNeeded = size / 2;
    }

    void Update()
    {
        InputReciever();
    }

    void FixedUpdate()
    {
        MovePlayer();
        TryBoost();
        TryGround();
    }
    
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Prop") && collision.gameObject.GetComponent<MeshRenderer>().bounds.size.x +
                                                       collision.gameObject.GetComponent<MeshRenderer>().bounds.size.y +
                                                       collision.gameObject.GetComponent<MeshRenderer>().bounds.size.z <= size - sizeNeeded && collision.gameObject.GetComponent<PropScript>().canPickUp == true)
        {
            //The larger the sizeNeeded amount, the smaller the object must be
            Destroy(collision.gameObject.GetComponent<Rigidbody>());
            if (collision.gameObject.GetComponent<SphereCollider>())
            {
                collision.gameObject.GetComponent<SphereCollider>().enabled = false;
                //collision.gameObject.GetComponent<SphereCollider>().enabled = true;
            }
            if (collision.gameObject.GetComponent<CapsuleCollider>())
            {
                //collision.gameObject.GetComponent<CapsuleCollider>().enabled = true;
                collision.gameObject.GetComponent<CapsuleCollider>().enabled = false;
            }
            if (collision.gameObject.GetComponent<BoxCollider>())
            {
                collision.gameObject.GetComponent<BoxCollider>().enabled = false;
                //collision.gameObject.GetComponent<BoxCollider>().enabled = false;
            }
            collision.gameObject.transform.SetParent(this.gameObject.transform);
            size += (collision.gameObject.GetComponent<MeshRenderer>().bounds.size.x +
                     collision.gameObject.GetComponent<MeshRenderer>().bounds.size.y +
                     collision.gameObject.GetComponent<MeshRenderer>().bounds.size.z) / 8;
            triggerSphere.radius += size / 72;
            physicalSphere.radius += size / 120;

            sizeNeeded = size / 2;
            collision.gameObject.GetComponent<PropScript>().canPickUp = false;

            StartCoroutine(LerpCameraOrbit());
        }
    }

    private void OnCollisionStay(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            Invoke("GroundedTrue", 0.5f);
        }
    }

    private void GroundedTrue()
    {
        isGrounded = true;
    }

    void OnCollisionExit(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            isGrounded = false;
        }
    }
    

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Prop"))
        {
            other.gameObject.GetComponent<PropScript>().canPickUp = true;
        }
    }

    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.CompareTag("Prop"))
        {
            other.gameObject.GetComponent<PropScript>().canPickUp = true;
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.gameObject.CompareTag("Prop"))
        {
            other.gameObject.GetComponent<PropScript>().canPickUp = false;
        }
    }

    IEnumerator LerpCameraOrbit()
    {

        float timeElapsed = 0f;
        float lerpDuration = 3f;
        float lerpStartValue = originalOrbit;
        float lerpEndValue = desiredOrbit;


        //EVENTUALLY MAKE THIS NICELY IN PROPORTION TO SIZE OF OBJECT COLLECTED
        originalOrbit += 0.2f;
        desiredOrbit += 0.2f;
        //----------------------------------------------------------------------

        while (timeElapsed < lerpDuration)
        {
            cineMachine.m_Orbits(0).m_Radius = Mathf.Lerp(lerpStartValue, lerpEndValue, timeElapsed / lerpDuration);
            cineMachine.m_Orbits(1).m_Radius = Mathf.Lerp(lerpStartValue, lerpEndValue, timeElapsed / lerpDuration);
            cineMachine.m_Orbits(2).m_Radius = Mathf.Lerp(lerpStartValue, lerpEndValue, timeElapsed / lerpDuration);
            timeElapsed += Time.deltaTime;

            yield return null;
        }

        cineMachine.m_Orbits(0).m_Radius = lerpEndValue;
        cineMachine.m_Orbits(1).m_Radius = lerpEndValue;
        cineMachine.m_Orbits(2).m_Radius = lerpEndValue;
    }

    void InputReciever()
    {
        if (Input.GetButtonDown("Boost"))
        {
            //will attempt to use boost
            boostBar.useBoost = true;
            boostBar.currentBoost -= (boostBar.boostChangeAmount);
            boostJump = true;
            rollSpeed = rollSpeed * 1.3f;
        }
        if (Input.GetButtonUp("Boost"))
        {
            boostBar.useBoost = false;
            rollSpeed = originalRollSpeed;
        }
    }

    void MovePlayer()
    {
        Vector3 playerInput = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
        Vector3 playerMovement = (playerInput.z * cameraTransform.forward) + (playerInput.x * cameraTransform.right);

        rb.AddForce(playerMovement * rollSpeed * Time.fixedDeltaTime * (size / 2));
    }

    void TryBoost()
    {
        if (boostJump == true)
        {
            Vector3 boostJumpVector = new Vector3(0f, 1f, 0f);
            rb.AddForce(boostJumpVector, ForceMode.Impulse);
            boostJump = false;
        }
    }

    void TryGround()
    {
        if (!isGrounded)
        {
            rb.AddForce(Vector3.down * 5);
        }
    }
        
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BatteryBar : MonoBehaviour
{
    (SerializeField) private Slider batteryBarSlider;
    (SerializeField) private Image fillImage;
    (SerializeField) private byte() fullColor;
    (SerializeField) private byte() lowColor;
    (SerializeField) private byte() boostColor;
    (SerializeField) private float maxBattery;
    public float batteryChangeAmount;

    
    public float currentBattery;
    private bool isBoosting;

    void Start()
    {
        currentBattery = maxBattery;
        batteryBarSlider.maxValue = maxBattery;
        batteryBarSlider.value = maxBattery;
    }
    public void Update()
    {
        if (!isBoosting)
        {
            currentBattery -= Time.deltaTime * batteryChangeAmount;
            batteryBarSlider.value = currentBattery;

            if (batteryBarSlider.value <= maxBattery / 4)
            {
                fillImage.color = new Color32(lowColor(0), lowColor(1), lowColor(2), lowColor(3));
            }
            else
            {
                fillImage.color = new Color32(fullColor(0), fullColor(1), fullColor(2), fullColor(3));
            }
        } else
        {
            currentBattery -= Time.deltaTime * (batteryChangeAmount + (batteryChangeAmount/2));
            batteryBarSlider.value = currentBattery;
            fillImage.color = new Color32(boostColor(0), boostColor(1), boostColor(2), boostColor(3));
        }

        //later on functionality will be added to gain back charge from picking up certain items
        //
        //
        //
    }

    public void BoostDrain(bool boosting)
    {
        if (boosting)
        {
            isBoosting = true;
        } else
        {
            isBoosting = false;
        }
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class BoostBar : MonoBehaviour
{
    (SerializeField) private Slider boostBarSlider;
    (SerializeField) private Image fillImage;
    (SerializeField) private byte() fillColor;
    (SerializeField) private byte() emptyFillColor;
    (SerializeField) private BatteryBar batteryBar;
    public float boostChangeAmount;

    private float maxBoost = 100f;
    public float currentBoost;

    public bool useBoost;

    public float maxCooldownTime;
    public float cooldownTime;
    (SerializeField) private bool isCool = true;

    void Start()
    {
        cooldownTime = maxCooldownTime;
        currentBoost = maxBoost;
        boostBarSlider.maxValue = maxBoost;
        boostBarSlider.value = maxBoost;
    }
    public void Update()
    {
        if(useBoost == false)
        {
            batteryBar.BoostDrain(false);
        }
        if (useBoost && isCool)
        {
            if (currentBoost - boostChangeAmount >= 0)
            {
                fillImage.color = new Color32(fillColor(0), fillColor(1), fillColor(2), fillColor(3));
                currentBoost -= Time.deltaTime * boostChangeAmount;
               //Debug.Log(boostChangeAmount);
                boostBarSlider.value = currentBoost;
                batteryBar.BoostDrain(true);
            }
            else
            {
                fillImage.color = new Color32(emptyFillColor(0), emptyFillColor(1), emptyFillColor(2), emptyFillColor(3));
                isCool = false;
                cooldownTime = 0;
            }
        }

        if (cooldownTime < maxCooldownTime && !isCool)
        {
            batteryBar.BoostDrain(false);
            fillImage.color = new Color32(emptyFillColor(0), emptyFillColor(1), emptyFillColor(2), emptyFillColor(3));
            currentBoost += Time.deltaTime * boostChangeAmount;
            boostBarSlider.value = currentBoost;
            cooldownTime += Time.deltaTime * boostChangeAmount;
        } else
        {
            isCool = true;
        }

        if (!useBoost && isCool && currentBoost < maxBoost)
        {
            fillImage.color = new Color32(fillColor(0), fillColor(1), fillColor(2), fillColor(3));
            currentBoost += Time.deltaTime * boostChangeAmount;
            boostBarSlider.value = currentBoost;
        }
    }
    public void UseBoost()
    {
        useBoost = true;
    }
}

New scripts:

using UnityEngine;

public class PlayerInput : MonoBehaviour
{
    private BallBoost ballBoost;

    private void Start()
    {
        ballBoost = GetComponent<BallBoost>();
    }

    void Update()
    {
        InputReciever();
    }

    public void InputReciever()
    {
        if (Input.GetButtonDown("Boost"))
        {
            ballBoost.StartBoost();
        }
        if (Input.GetButtonUp("Boost"))
        {
            ballBoost.StopBoost();
        }
    }
}
using UnityEngine;

public class BallBoost : MonoBehaviour
{
    public float boostChangeAmount;
    public float maxBoost = 100f;
    public float currentBoost;

    private bool boostJump;
    private BoostBarUI boostBarUI;
    private BallPhysics ballPhysics;

    private void Start()
    {
        currentBoost = maxBoost;
        boostBarUI = GetComponent<BoostBarUI>();
        ballPhysics = GetComponent<BallPhysics>();
        boostBarUI.boostBarSlider.maxValue = maxBoost;
        boostBarUI.boostBarSlider.value = maxBoost;
    }

    private void FixedUpdate()
    {
        TryBoostJump();
    }

    public void TryBoostJump()
    {
        if (boostJump == true && ballPhysics.isGrounded)
        {
            Vector3 boostJumpVector = new Vector3(0f, 1f, 0f);
            ballPhysics.rb.AddForce(boostJumpVector, ForceMode.Impulse);
            boostJump = false;
        }
    }

    public void StopBoost()
    {
        boostBarUI.StopBoost();
        ballPhysics.rollSpeed = ballPhysics.originalRollSpeed;
    }

    public void StartBoost()
    {
        if (currentBoost - boostChangeAmount >= 0 && boostBarUI.isCool)
        {
            boostBarUI.UseBoost();
            currentBoost -= (boostChangeAmount);
            boostJump = true;
            ballPhysics.rollSpeed = ballPhysics.rollSpeed * 1.3f;
            boostBarUI.BoostingUI();
        }
        else
        {
            boostBarUI.EmptyBoostUI();
            ballPhysics.rollSpeed = ballPhysics.originalRollSpeed;
        }
    }

    public void AddBoost()
    {
        currentBoost += Time.deltaTime * boostChangeAmount;
    }
}
using UnityEngine;
using UnityEngine.UI;

public class BoostBarUI : MonoBehaviour
{
    public bool useBoost;
    public bool isCool = true;
    public float maxCooldownTime;
    public float cooldownTime;
    public Slider boostBarSlider;
    public Image fillImage;

    (SerializeField) private byte() fillColor;
    (SerializeField) private byte() emptyFillColor;
    (SerializeField) private BatteryBar batteryBar;

    private BallBoost ballBoost;

    void Start()
    {
        ballBoost = GetComponent<BallBoost>();
        Cursor.lockState = CursorLockMode.Locked;
        cooldownTime = maxCooldownTime;
    }
    public void Update()
    {
        if(useBoost == false)
        {
            batteryBar.BoostDrain(false);
        } else
        {
            if (ballBoost.currentBoost >= 0)
            {
                NegateBoostUI();
            } else
            {
                EmptyBoostUI();
            }
        }

        if (cooldownTime < maxCooldownTime && !isCool)
        {
            CoolDownTime();
            ballBoost.AddBoost();
        } else
        {
            isCool = true;
        }

        if (!useBoost && isCool && ballBoost.currentBoost < ballBoost.maxBoost)
        {
            AddBoostUI();
        }
    }
    public void UseBoost()
    {
        useBoost = true;
    }

    public void StopBoost()
    {
        useBoost = false;
    }

    public void AddBoostUI()
    {
        fillImage.color = new Color32(fillColor(0), fillColor(1), fillColor(2), fillColor(3));
        ballBoost.AddBoost();
        boostBarSlider.value = ballBoost.currentBoost;
    }

    public void NegateBoostUI()
    {
        ballBoost.currentBoost -= Time.deltaTime * ballBoost.boostChangeAmount;
        boostBarSlider.value = ballBoost.currentBoost;
    }

    public void BoostingUI()
    {
        fillImage.color = new Color32(fillColor(0), fillColor(1), fillColor(2), fillColor(3));
        boostBarSlider.value = ballBoost.currentBoost;
        batteryBar.BoostDrain(true);
    }

    public void EmptyBoostUI()
    {
        useBoost = false;
        ballBoost.StopBoost();
        fillImage.color = new Color32(emptyFillColor(0), emptyFillColor(1), emptyFillColor(2), emptyFillColor(3));
        useBoost = false;
        isCool = false;
        cooldownTime = 0;
    }

    public void CoolDownTime()
    {
        batteryBar.BoostDrain(false);
        fillImage.color = new Color32(emptyFillColor(0), emptyFillColor(1), emptyFillColor(2), emptyFillColor(3));
        boostBarSlider.value = ballBoost.currentBoost;
        cooldownTime += Time.deltaTime * ballBoost.boostChangeAmount;
    }
}
using UnityEngine;
using UnityEngine.UI;
public class BatteryBar : MonoBehaviour
{
    public float batteryChangeAmount;
    public float currentBattery;

    (SerializeField) private Slider batteryBarSlider;
    (SerializeField) private Image fillImage;
    (SerializeField) private byte() fullColor;
    (SerializeField) private byte() lowColor;
    (SerializeField) private byte() boostColor;
    (SerializeField) private float maxBattery;

    private bool isBoosting;

    void Start()
    {
        currentBattery = maxBattery;
        batteryBarSlider.maxValue = maxBattery;
        batteryBarSlider.value = maxBattery;
    }

    public void Update()
    {
        if (!isBoosting)
        {
            BatteryDrain();
        } else
        {
            BoostBatteryDrain();
        }

        //later on functionality will be added to gain back charge from picking up certain items
        //
        //
        //
    }

    public void BoostDrain(bool boosting)
    {
        if (boosting)
        {
            isBoosting = true;
        }
        else
        {
            isBoosting = false;
        }
    }

    private void BatteryDrain()
    {
        currentBattery -= Time.deltaTime * batteryChangeAmount;
        batteryBarSlider.value = currentBattery;

        if (batteryBarSlider.value <= maxBattery / 4)
        {
            fillImage.color = new Color32(lowColor(0), lowColor(1), lowColor(2), lowColor(3));
        }
        else
        {
            fillImage.color = new Color32(fullColor(0), fullColor(1), fullColor(2), fullColor(3));
        }
    }

    private void BoostBatteryDrain()
    {
        currentBattery -= Time.deltaTime * (batteryChangeAmount * 2 /*+ (batteryChangeAmount/2)*/);
        batteryBarSlider.value = currentBattery;
        fillImage.color = new Color32(boostColor(0), boostColor(1), boostColor(2), boostColor(3));
    }
}
using UnityEngine;

public class BallPhysics : MonoBehaviour
{
    public Rigidbody rb;
    public float rollSpeed;
    public float originalRollSpeed;
    public bool isGrounded;
    public bool isGroundedTimer;

    private BallController ballController;
    private CameraController cameraController;

    void Start()
    {
        ballController = GetComponent<BallController>();
        cameraController = GetComponent<CameraController>();
        originalRollSpeed = rollSpeed;
        rb = GetComponent<Rigidbody>();
    }

    private void FixedUpdate()
    {
        MovePlayer();
        TryGround();
    }

    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Trash") && collision.gameObject.GetComponent<MeshRenderer>().bounds.size.x +
                                                        collision.gameObject.GetComponent<MeshRenderer>().bounds.size.y +
                                                        collision.gameObject.GetComponent<MeshRenderer>().bounds.size.z <= ballController.size - ballController.sizeNeeded 
                                                     && collision.gameObject.GetComponent<PropScript>().canPickUp == true)
        {
            ProcessTrash(collision);
        }
    }

    private void OnCollisionStay(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            GroundedTrue();
            Invoke("GroundedTimerTrue", 0.5f);
        }
    }

    private void GroundedTrue()
    {
        isGrounded = true;
    }

    private void GroundedTimerTrue()
    {
        isGroundedTimer = true;
    }

    void OnCollisionExit(Collision collision)
    {
        if (collision.gameObject.CompareTag("Ground"))
        {
            isGrounded = false;
            isGroundedTimer = false;
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Trash"))
        {
            other.gameObject.GetComponent<PropScript>().canPickUp = true;
        }
    }

    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.CompareTag("Trash"))
        {
            other.gameObject.GetComponent<PropScript>().canPickUp = true;
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.gameObject.CompareTag("Trash"))
        {
            other.gameObject.GetComponent<PropScript>().canPickUp = false;
        }
    }

    void MovePlayer()
    {
        Vector3 playerInput = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
        Vector3 playerMovement = (playerInput.z * cameraController.cameraTransform.forward) + (playerInput.x * cameraController.cameraTransform.right);

        rb.AddForce(playerMovement * rollSpeed * Time.fixedDeltaTime * (ballController.size / 2));
    }

    void TryGround()
    {
        if (!isGroundedTimer)
        {
            rb.AddForce(Vector3.down * 5);
        }
    }

    void ProcessTrash(Collision collision)
    {
        //The larger the sizeNeeded amount, the smaller the object must be
        Destroy(collision.gameObject.GetComponent<Rigidbody>());
        if (collision.gameObject.GetComponent<MeshCollider>())
        {
            collision.gameObject.GetComponent<MeshCollider>().enabled = false;
        }
        if (collision.gameObject.GetComponent<SphereCollider>())
        {
            collision.gameObject.GetComponent<SphereCollider>().enabled = false;
        }
        if (collision.gameObject.GetComponent<CapsuleCollider>())
        {
            collision.gameObject.GetComponent<CapsuleCollider>().enabled = false;
        }
        if (collision.gameObject.GetComponent<BoxCollider>())
        {
            collision.gameObject.GetComponent<BoxCollider>().enabled = false;
        }
        collision.gameObject.transform.SetParent(this.gameObject.transform);
        ballController.size += (collision.gameObject.GetComponent<MeshRenderer>().bounds.size.x +
                                collision.gameObject.GetComponent<MeshRenderer>().bounds.size.y +
                                collision.gameObject.GetComponent<MeshRenderer>().bounds.size.z) / 8;

        ballController.IncreaseSize(collision.gameObject);
    }
}
using UnityEngine;

public class BallController : MonoBehaviour
{
    
    public float size = 0;
    public float sizeNeeded = 0; 
    public SphereCollider physicalSphere;
    public SphereCollider triggerSphere;

    //The higher this value is, the smaller the ball will grow each time
    private float growthSizeFraction = 400;
    private CameraController cameraController;

    void Start()
    {
        cameraController = GetComponent<CameraController>();
        
        size = gameObject.GetComponent<MeshRenderer>().bounds.size.x  +
               gameObject.GetComponent<MeshRenderer>().bounds.size.y  +
               gameObject.GetComponent<MeshRenderer>().bounds.size.z;
        sizeNeeded = size / 2;
    }

    public void IncreaseSize(GameObject collidedObject)
    {
        triggerSphere.radius += size / (growthSizeFraction / 2);
        physicalSphere.radius += size / growthSizeFraction;
        sizeNeeded = size / 2;
        collidedObject.GetComponent<PropScript>().canPickUp = false;

        StartCoroutine(cameraController.LerpCameraOrbit());
    }
}
using System.Collections;
using UnityEngine;
using Cinemachine;

public class CameraController : MonoBehaviour
{
    public Transform cameraTransform;
    (SerializeField) private CinemachineFreeLook cineMachine;

    private float originalOrbit;
    private float desiredOrbit;
    private void Start()
    {
        originalOrbit = cineMachine.m_Orbits(0).m_Radius;
        desiredOrbit = originalOrbit + 0.2f;
    }

    public IEnumerator LerpCameraOrbit()
    {

        float timeElapsed = 0f;
        float lerpDuration = 3f;
        float lerpStartValue = originalOrbit;
        float lerpEndValue = desiredOrbit;


        //EVENTUALLY MAKE THIS NICELY IN PROPORTION TO SIZE OF OBJECT COLLECTED
        originalOrbit += 0.2f;
        desiredOrbit += 0.2f;
        //----------------------------------------------------------------------

        while (timeElapsed < lerpDuration)
        {
            cineMachine.m_Orbits(0).m_Radius = Mathf.Lerp(lerpStartValue, lerpEndValue, timeElapsed / lerpDuration);
            cineMachine.m_Orbits(1).m_Radius = Mathf.Lerp(lerpStartValue, lerpEndValue, timeElapsed / lerpDuration);
            cineMachine.m_Orbits(2).m_Radius = Mathf.Lerp(lerpStartValue, lerpEndValue, timeElapsed / lerpDuration);
            timeElapsed += Time.deltaTime;

            yield return null;
        }

        cineMachine.m_Orbits(0).m_Radius = lerpEndValue;
        cineMachine.m_Orbits(1).m_Radius = lerpEndValue;
        cineMachine.m_Orbits(2).m_Radius = lerpEndValue;
    }
}
```