using UnityEngine; public class PlayerDepositStation : MonoBehaviour { private PlayerControllerNewRohan currentPlayer; private bool playerInside; private void OnTriggerEnter(Collider other) { // HUMAN PLAYER PlayerControllerNewRohan player = other.GetComponent(); if (player != null) { CashManager cash = other.GetComponent(); InteractionManager.CurrentInteraction = () => currentPlayer?.StartDeposit(15f); if (cash != null && cash.currentCash > 0) { currentPlayer = player; playerInside = true; UI_Manager.Instance?.ShowInteractionPrompt( "Press F To Deposit"); MobileInteractButton.Instance?.Show(); } return; } // AI SimpleTeamAI ai = other.GetComponent(); if (ai != null) { CashManager cash = other.GetComponent(); if (cash == null || cash.currentCash <= 0) return; ai.StartDepositEffect(); ai.StartDeposit(15f); } } private void Update() { if (!playerInside) return; //if (Input.GetKeyDown(KeyCode.F)) //{ // StartPlayerDeposit(); //} } private void OnTriggerExit(Collider other) { if (!other.CompareTag("Player")) return; PlayerControllerNewRohan player = other.GetComponent(); if (player != null) { player.CancelDeposit(); } playerInside = false; currentPlayer = null; UI_Manager.Instance?.HideActionTimer(); MobileInteractButton.Instance?.Hide(); InteractionManager.Clear(); } public void StartPlayerDeposit() { if (!playerInside) return; currentPlayer?.StartDeposit(15f); UI_Manager.Instance?.HideActionTimer(); } }