From 1dcd8bf80b2b9e5ab190d317ed76e3da3a4edc50 Mon Sep 17 00:00:00 2001 From: Rohan Date: Tue, 21 Jul 2026 08:58:18 +0530 Subject: [PATCH] Batch 1 - Scripts --- .../Scripts/BillboardNew.cs | 22 +++++ .../Scripts/BillboardNew.cs.meta | 2 + .../Scripts/CamerasTouchArea.cs | 25 +++++ .../Scripts/CamerasTouchArea.cs.meta | 2 + .../New Lowpoly Models/Scripts/CashManager.cs | 39 ++++++++ .../New Lowpoly Models/Scripts/CashPopupUI.cs | 27 ++++++ .../Scripts/CashPopupUI.cs.meta | 2 + .../New Lowpoly Models/Scripts/FPSManager.cs | 2 +- .../New Lowpoly Models/Scripts/Minimap.meta | 8 ++ .../Scripts/Minimap/EdgeIndicator.cs | 95 +++++++++++++++++++ .../Scripts/Minimap/EdgeIndicator.cs.meta | 2 + .../Scripts/Minimap/EdgeIndicatorManager.cs | 92 ++++++++++++++++++ .../Minimap/EdgeIndicatorManager.cs.meta | 2 + .../Scripts/Minimap/EdgeTarget.cs | 17 ++++ .../Scripts/Minimap/EdgeTarget.cs.meta | 2 + Assets/New Lowpoly Models/Scripts/Player.meta | 8 ++ .../Scripts/{ => Player}/CombatAnimations.cs | 0 .../{ => Player}/CombatAnimations.cs.meta | 0 .../Scripts/{ => Player}/Health.cs | 0 .../Scripts/{ => Player}/Health.cs.meta | 0 .../{ => Player}/PlayerControllerNewRohan.cs | 37 +++++++- .../PlayerControllerNewRohan.cs.meta | 0 .../Scripts/{ => Player}/Stamina.cs | 0 .../Scripts/{ => Player}/Stamina.cs.meta | 0 .../Scripts/PlayerDepositStation.cs | 2 +- .../Scripts/PlayerTeamCashUI.cs | 40 ++++++++ .../Scripts/PlayerTeamCashUI.cs.meta | 2 + .../Scripts/SimpleTeamAI.cs | 19 +++- .../Scripts/TeamMemberHealthUI.cs | 43 +++++++++ .../Scripts/TeamMemberHealthUI.cs.meta | 2 + .../New Lowpoly Models/Scripts/UI_Manager.cs | 64 ++++++++++++- Assets/New Lowpoly Models/Scripts/Vault.cs | 15 ++- .../Scripts/VaultMinimapMarker.cs | 7 +- .../New Lowpoly Models/Scripts/WorldIcon.cs | 30 ++++++ .../Scripts/WorldIcon.cs.meta | 2 + .../New Lowpoly Models/Scripts/WorldMarker.cs | 46 +++++++++ .../Scripts/WorldMarker.cs.meta | 2 + .../CashSystemCharacterSelection.cs | 2 +- .../CharacterSelection.cs | 2 +- Assets/Scripts/Managers/MinimapManager.cs | 4 + .../Scripts/Managers/MinimapMarkerManager.cs | 2 +- 41 files changed, 655 insertions(+), 13 deletions(-) create mode 100644 Assets/New Lowpoly Models/Scripts/BillboardNew.cs create mode 100644 Assets/New Lowpoly Models/Scripts/BillboardNew.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs create mode 100644 Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/CashPopupUI.cs create mode 100644 Assets/New Lowpoly Models/Scripts/CashPopupUI.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/Minimap.meta create mode 100644 Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs create mode 100644 Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs create mode 100644 Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs create mode 100644 Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/Player.meta rename Assets/New Lowpoly Models/Scripts/{ => Player}/CombatAnimations.cs (100%) rename Assets/New Lowpoly Models/Scripts/{ => Player}/CombatAnimations.cs.meta (100%) rename Assets/New Lowpoly Models/Scripts/{ => Player}/Health.cs (100%) rename Assets/New Lowpoly Models/Scripts/{ => Player}/Health.cs.meta (100%) rename Assets/New Lowpoly Models/Scripts/{ => Player}/PlayerControllerNewRohan.cs (93%) rename Assets/New Lowpoly Models/Scripts/{ => Player}/PlayerControllerNewRohan.cs.meta (100%) rename Assets/New Lowpoly Models/Scripts/{ => Player}/Stamina.cs (100%) rename Assets/New Lowpoly Models/Scripts/{ => Player}/Stamina.cs.meta (100%) create mode 100644 Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs create mode 100644 Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs create mode 100644 Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/WorldIcon.cs create mode 100644 Assets/New Lowpoly Models/Scripts/WorldIcon.cs.meta create mode 100644 Assets/New Lowpoly Models/Scripts/WorldMarker.cs create mode 100644 Assets/New Lowpoly Models/Scripts/WorldMarker.cs.meta diff --git a/Assets/New Lowpoly Models/Scripts/BillboardNew.cs b/Assets/New Lowpoly Models/Scripts/BillboardNew.cs new file mode 100644 index 0000000..11f7faa --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/BillboardNew.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class BillboardNew : MonoBehaviour +{ + Camera cam; + + private void Start() + { + cam = Camera.main; + } + + private void LateUpdate() + { + if (cam == null) + cam = Camera.main; + + if (cam == null) + return; + + transform.forward = cam.transform.forward; + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/BillboardNew.cs.meta b/Assets/New Lowpoly Models/Scripts/BillboardNew.cs.meta new file mode 100644 index 0000000..0dea09c --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/BillboardNew.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 26bee8a4aff1043438c449430761bc33 \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs b/Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs new file mode 100644 index 0000000..b1b076e --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using UnityEngine.EventSystems; + +public class CameraTouchArea : MonoBehaviour, IPointerDownHandler, IDragHandler +{ + public static Vector2 LookDelta; + + private Vector2 lastPosition; + + public void OnPointerDown(PointerEventData eventData) + { + lastPosition = eventData.position; + } + + public void OnDrag(PointerEventData eventData) + { + LookDelta = eventData.position - lastPosition; + lastPosition = eventData.position; + } + + private void LateUpdate() + { + LookDelta = Vector2.zero; + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs.meta b/Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs.meta new file mode 100644 index 0000000..d100b1b --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/CamerasTouchArea.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 66297c96b861aad4c81dd175dcc43013 \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/CashManager.cs b/Assets/New Lowpoly Models/Scripts/CashManager.cs index 2e3fce6..235bd9c 100644 --- a/Assets/New Lowpoly Models/Scripts/CashManager.cs +++ b/Assets/New Lowpoly Models/Scripts/CashManager.cs @@ -49,6 +49,29 @@ public class CashManager : MonoBehaviour } UpdateUI(); + + if (IsHumanPlayer()) + { + UpdatePlayerObjectiveUI(); + } + } + + private void UpdatePlayerObjectiveUI() + { + if (!IsHumanPlayer() || UI_Manager.Instance == null) + return; + + UI_Manager.Instance.UpdatePlayerCash(currentCash); + + if (currentCash > 0) + UI_Manager.Instance.ShowDepositObjective(); + else + UI_Manager.Instance.ShowOpenVaultObjective(); + } + + private bool IsHumanPlayer() + { + return GetComponent() != null; } void UpdateUI() @@ -65,6 +88,11 @@ public class CashManager : MonoBehaviour { currentCash += amount; + if (IsHumanPlayer()) + { + UI_Manager.Instance?.ShowCashPopup(amount); + } + switch (team) { case TeamMember.Team.PlayerTeam: @@ -80,6 +108,8 @@ public class CashManager : MonoBehaviour break; } + UpdatePlayerObjectiveUI(); + UpdateUI(); } @@ -104,6 +134,13 @@ public class CashManager : MonoBehaviour currentCash = 0; + if (IsHumanPlayer()) + { + AudioManager.Instance?.PlaySFX("DepositComplete"); + } + + UpdatePlayerObjectiveUI(); + UpdateUI(); return amount; @@ -144,6 +181,8 @@ public class CashManager : MonoBehaviour currentCash = 0; + UpdatePlayerObjectiveUI(); + UpdateUI(); } diff --git a/Assets/New Lowpoly Models/Scripts/CashPopupUI.cs b/Assets/New Lowpoly Models/Scripts/CashPopupUI.cs new file mode 100644 index 0000000..a7209f9 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/CashPopupUI.cs @@ -0,0 +1,27 @@ +using TMPro; +using UnityEngine; +using System.Collections; + +public class CashPopupUI : MonoBehaviour +{ + [SerializeField] private TextMeshProUGUI amountText; + + public void Show(int amount) + { + amountText.text = $"+${amount:N0}"; + + AudioManager.Instance?.PlaySFX("CashPopup"); + + gameObject.SetActive(true); + + StopAllCoroutines(); + StartCoroutine(HideRoutine()); + } + + IEnumerator HideRoutine() + { + yield return new WaitForSeconds(1.5f); + + gameObject.SetActive(false); + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/CashPopupUI.cs.meta b/Assets/New Lowpoly Models/Scripts/CashPopupUI.cs.meta new file mode 100644 index 0000000..5b2e517 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/CashPopupUI.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 740a4258753985548b8ab0f4b59f25aa \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/FPSManager.cs b/Assets/New Lowpoly Models/Scripts/FPSManager.cs index 0b2869a..e7dfede 100644 --- a/Assets/New Lowpoly Models/Scripts/FPSManager.cs +++ b/Assets/New Lowpoly Models/Scripts/FPSManager.cs @@ -4,6 +4,6 @@ public class FPSManager : MonoBehaviour { void Awake() { - Application.targetFrameRate = 60; + Application.targetFrameRate = 1000; } } \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Minimap.meta b/Assets/New Lowpoly Models/Scripts/Minimap.meta new file mode 100644 index 0000000..12e269c --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Minimap.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f416dcd6817fdd94db07d59bea652386 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs new file mode 100644 index 0000000..a65b5f1 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs @@ -0,0 +1,95 @@ +using UnityEngine; +using UnityEngine.UI; + +public class EdgeIndicator : MonoBehaviour +{ + [HideInInspector] + public EdgeTarget Target; + + private RectTransform rect; + private Image image; + + private RectTransform minimapRect; + private MinimapManager minimap; + + private float radius; + + public void Initialize( + EdgeTarget target, + RectTransform minimapRectTransform, + float edgePadding) + { + Target = target; + + minimapRect = minimapRectTransform; + minimap = FindObjectOfType(); + + rect = GetComponent(); + image = GetComponent(); + + image.sprite = target.icon; + image.color = target.iconColor; + + radius = Mathf.Min(minimapRect.rect.width, minimapRect.rect.height) * 0.5f - edgePadding; + } + + private void Update() + { + if (Target == null) + { + Destroy(gameObject); + return; + } + + if (minimap == null || minimap.MinimapCamera == null || minimap.Player == null) + return; + + Camera cam = minimap.MinimapCamera; + + // Position of the target in the minimap camera + Vector3 viewport = cam.WorldToViewportPoint(Target.transform.position); + + // If target is visible inside minimap, hide the edge arrow + bool visible = + viewport.z > 0 && + viewport.x >= 0f && + viewport.x <= 1f && + viewport.y >= 0f && + viewport.y <= 1f; + + if (visible) + { + image.enabled = false; + return; + } + + image.enabled = true; + + // Direction from player to target + Vector3 worldDir = Target.transform.position - minimap.Player.position; + + Vector2 dir = new Vector2(worldDir.x, worldDir.z).normalized; + + // If your minimap rotates, rotate direction too + if (minimap.rotateWithPlayer) + { + float angle = -minimap.Player.eulerAngles.y * Mathf.Deg2Rad; + + float cos = Mathf.Cos(angle); + float sin = Mathf.Sin(angle); + + dir = new Vector2( + dir.x * cos - dir.y * sin, + dir.x * sin + dir.y * cos + ); + } + + // Place arrow on edge of minimap + rect.anchoredPosition = dir * radius; + + // Rotate arrow to point toward target + float rot = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; + + rect.localRotation = Quaternion.Euler(0, 0, rot - 90f); + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs.meta b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs.meta new file mode 100644 index 0000000..15ecdfb --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicator.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 90eb04afe3bc588458146859ad793297 \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs new file mode 100644 index 0000000..f65213f --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using UnityEngine; + +public class EdgeIndicatorManager : MonoBehaviour +{ + public static EdgeIndicatorManager Instance; + + [Header("References")] + public MinimapManager minimapManager; + public RectTransform edgeContainer; + public EdgeIndicator indicatorPrefab; + + [Header("Settings")] + public float edgePadding = 18f; + public float refreshInterval = 1f; + + private readonly Dictionary indicators = + new Dictionary(); + + float timer; + + void Awake() + { + Instance = this; + } + + void Start() + { + if (minimapManager == null) + minimapManager = FindObjectOfType(); + + RefreshTargets(); + } + + void Update() + { + timer += Time.deltaTime; + + if (timer >= refreshInterval) + { + timer = 0; + RefreshTargets(); + } + } + + void RefreshTargets() + { + EdgeTarget[] targets = FindObjectsOfType(); + + HashSet currentTargets = new HashSet(targets); + + //------------------------------------- + // Remove destroyed targets + //------------------------------------- + + List remove = new List(); + + foreach (var pair in indicators) + { + if (pair.Key == null || !currentTargets.Contains(pair.Key)) + { + if (pair.Value != null) + Destroy(pair.Value.gameObject); + + remove.Add(pair.Key); + } + } + + foreach (var t in remove) + indicators.Remove(t); + + //------------------------------------- + // Add new targets + //------------------------------------- + + foreach (EdgeTarget target in targets) + { + if (indicators.ContainsKey(target)) + continue; + + EdgeIndicator arrow = + Instantiate(indicatorPrefab, edgeContainer); + + arrow.Initialize( + target, + edgeContainer, + edgePadding); + + indicators.Add(target, arrow); + } + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs.meta b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs.meta new file mode 100644 index 0000000..f96922b --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeIndicatorManager.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: c1c3c18764486f7478515f771cac46bb \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs new file mode 100644 index 0000000..0d8ba26 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs @@ -0,0 +1,17 @@ +using UnityEngine; + +public class EdgeTarget : MonoBehaviour +{ + public enum TargetType + { + Enemy, + Vault, + Deposit, + Objective + } + + [Header("Indicator")] + public TargetType targetType; + public Sprite icon; + public Color iconColor = Color.white; +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs.meta b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs.meta new file mode 100644 index 0000000..f23e7d2 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Minimap/EdgeTarget.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 262b041e5698df34b992d80ceab7e3b6 \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Player.meta b/Assets/New Lowpoly Models/Scripts/Player.meta new file mode 100644 index 0000000..4d626e0 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/Player.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b7513d3dac2791f4eb86f28f153761ea +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/New Lowpoly Models/Scripts/CombatAnimations.cs b/Assets/New Lowpoly Models/Scripts/Player/CombatAnimations.cs similarity index 100% rename from Assets/New Lowpoly Models/Scripts/CombatAnimations.cs rename to Assets/New Lowpoly Models/Scripts/Player/CombatAnimations.cs diff --git a/Assets/New Lowpoly Models/Scripts/CombatAnimations.cs.meta b/Assets/New Lowpoly Models/Scripts/Player/CombatAnimations.cs.meta similarity index 100% rename from Assets/New Lowpoly Models/Scripts/CombatAnimations.cs.meta rename to Assets/New Lowpoly Models/Scripts/Player/CombatAnimations.cs.meta diff --git a/Assets/New Lowpoly Models/Scripts/Health.cs b/Assets/New Lowpoly Models/Scripts/Player/Health.cs similarity index 100% rename from Assets/New Lowpoly Models/Scripts/Health.cs rename to Assets/New Lowpoly Models/Scripts/Player/Health.cs diff --git a/Assets/New Lowpoly Models/Scripts/Health.cs.meta b/Assets/New Lowpoly Models/Scripts/Player/Health.cs.meta similarity index 100% rename from Assets/New Lowpoly Models/Scripts/Health.cs.meta rename to Assets/New Lowpoly Models/Scripts/Player/Health.cs.meta diff --git a/Assets/New Lowpoly Models/Scripts/PlayerControllerNewRohan.cs b/Assets/New Lowpoly Models/Scripts/Player/PlayerControllerNewRohan.cs similarity index 93% rename from Assets/New Lowpoly Models/Scripts/PlayerControllerNewRohan.cs rename to Assets/New Lowpoly Models/Scripts/Player/PlayerControllerNewRohan.cs index 42d631b..08998ed 100644 --- a/Assets/New Lowpoly Models/Scripts/PlayerControllerNewRohan.cs +++ b/Assets/New Lowpoly Models/Scripts/Player/PlayerControllerNewRohan.cs @@ -77,7 +77,7 @@ public class PlayerControllerNewRohan : MonoBehaviour animator = GetComponent(); stamina = GetComponent(); - StopDepositEffect(); + //StopDepositEffect(); } private void Start() @@ -274,6 +274,9 @@ public class PlayerControllerNewRohan : MonoBehaviour isAttacking = true; canMove = false; + FindClosestEnemy(); + FaceTarget(); + SetTrails(true); if (IsTargetInRange()) @@ -412,6 +415,9 @@ public class PlayerControllerNewRohan : MonoBehaviour void FaceTarget() { + if (target == null) + return; + Vector3 dir = target.position - transform.position; dir.y = 0; @@ -421,6 +427,35 @@ public class PlayerControllerNewRohan : MonoBehaviour } } + private void FindClosestEnemy() + { + TeamMember myTeam = GetComponent(); + + float closestDistance = Mathf.Infinity; + Transform closestEnemy = null; + + TeamMember[] allCharacters = FindObjectsOfType(); + + foreach (TeamMember character in allCharacters) + { + if (character == myTeam) + continue; + + if (character.CurrentTeam == myTeam.CurrentTeam) + continue; + + float distance = Vector3.Distance(transform.position, character.transform.position); + + if (distance < closestDistance) + { + closestDistance = distance; + closestEnemy = character.transform; + } + } + + target = closestEnemy; + } + public void PlayVaultOpen(System.Action onComplete) { StartCoroutine(VaultRoutine(onComplete)); diff --git a/Assets/New Lowpoly Models/Scripts/PlayerControllerNewRohan.cs.meta b/Assets/New Lowpoly Models/Scripts/Player/PlayerControllerNewRohan.cs.meta similarity index 100% rename from Assets/New Lowpoly Models/Scripts/PlayerControllerNewRohan.cs.meta rename to Assets/New Lowpoly Models/Scripts/Player/PlayerControllerNewRohan.cs.meta diff --git a/Assets/New Lowpoly Models/Scripts/Stamina.cs b/Assets/New Lowpoly Models/Scripts/Player/Stamina.cs similarity index 100% rename from Assets/New Lowpoly Models/Scripts/Stamina.cs rename to Assets/New Lowpoly Models/Scripts/Player/Stamina.cs diff --git a/Assets/New Lowpoly Models/Scripts/Stamina.cs.meta b/Assets/New Lowpoly Models/Scripts/Player/Stamina.cs.meta similarity index 100% rename from Assets/New Lowpoly Models/Scripts/Stamina.cs.meta rename to Assets/New Lowpoly Models/Scripts/Player/Stamina.cs.meta diff --git a/Assets/New Lowpoly Models/Scripts/PlayerDepositStation.cs b/Assets/New Lowpoly Models/Scripts/PlayerDepositStation.cs index 9d71add..74af2e3 100644 --- a/Assets/New Lowpoly Models/Scripts/PlayerDepositStation.cs +++ b/Assets/New Lowpoly Models/Scripts/PlayerDepositStation.cs @@ -26,7 +26,7 @@ public class PlayerDepositStation : MonoBehaviour playerInside = true; UI_Manager.Instance?.ShowInteractionPrompt( - "Press F To Deposit"); + "Press the interaction button to deposit the cash."); MobileInteractButton.Instance?.Show(); } diff --git a/Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs b/Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs new file mode 100644 index 0000000..d336d83 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs @@ -0,0 +1,40 @@ +using UnityEngine; +using System.Collections.Generic; + +public class PlayerTeamCashUI : MonoBehaviour +{ + private readonly List teammates = new(); + + private void Start() + { + CashManager[] all = FindObjectsOfType(); + + foreach (CashManager cash in all) + { + TeamMember team = cash.GetComponent(); + + if (team == null) + continue; + + if (team.CurrentTeam != TeamMember.Team.PlayerTeam) + continue; + + if (cash.GetComponent() != null) + continue; + + teammates.Add(cash); + } + } + + private void Update() + { + if (UI_Manager.Instance == null) + return; + + if (teammates.Count > 0) + UI_Manager.Instance.UpdateTeammate1Cash(teammates[0].currentCash); + + if (teammates.Count > 1) + UI_Manager.Instance.UpdateTeammate2Cash(teammates[1].currentCash); + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs.meta b/Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs.meta new file mode 100644 index 0000000..4689f58 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/PlayerTeamCashUI.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 53858e4bb09074f4299b82c2bbe8cbe0 \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/SimpleTeamAI.cs b/Assets/New Lowpoly Models/Scripts/SimpleTeamAI.cs index 3d01f73..2a17f52 100644 --- a/Assets/New Lowpoly Models/Scripts/SimpleTeamAI.cs +++ b/Assets/New Lowpoly Models/Scripts/SimpleTeamAI.cs @@ -33,6 +33,8 @@ public class SimpleTeamAI : MonoBehaviour [SerializeField] private float attackRange = 2f; [SerializeField] private float attackCooldown = 1.2f; [SerializeField] private float targetPriorityRange = 100f; + private float nextCombatSearch; + [SerializeField] private float combatSearchInterval = 0.3f; [Header("Collection Settings")] [SerializeField] private float scanRadius = 15f; @@ -172,13 +174,18 @@ public class SimpleTeamAI : MonoBehaviour { SetState(AIState.Hit); } - else if (isBusy) + if (isBusy) { - // Keep current state while opening vault / hit / special action + anim.SetFloat("Speed", 0f); + return; } + //else if (isBusy) + //{ + // // Keep current state while opening vault / hit / special action + //} else { - cashManager = GetComponent(); + //cashManager = GetComponent(); if (cashManager != null && cashManager.currentCash >= depositCashAmount) { @@ -186,7 +193,11 @@ public class SimpleTeamAI : MonoBehaviour } else { - combatTarget = FindNearestCombatTarget(); + if (Time.time >= nextCombatSearch) + { + nextCombatSearch = Time.time + combatSearchInterval; + combatTarget = FindNearestCombatTarget(); + } if (combatTarget != null) { diff --git a/Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs b/Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs new file mode 100644 index 0000000..17b9eab --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs @@ -0,0 +1,43 @@ +using UnityEngine; +using UnityEngine.UI; + +public class TeamMemberHealthUI : MonoBehaviour +{ + [SerializeField] private Health enemyHealth; + + [Header("Health Sliders")] + [SerializeField] private Slider healthSlider; + [SerializeField] private Slider secondHealthSlider; + + void Start() + { + if (enemyHealth == null) return; + + UpdateHealthBar(enemyHealth.currentHealth, enemyHealth.maxHealth); + + enemyHealth.OnHealthChanged += UpdateHealthBar; + } + + void UpdateHealthBar(float current, float max) + { + if (healthSlider != null) + { + healthSlider.maxValue = max; + healthSlider.value = current; + } + + if (secondHealthSlider != null) + { + secondHealthSlider.maxValue = max; + secondHealthSlider.value = current; + } + } + + void OnDestroy() + { + if (enemyHealth != null) + { + enemyHealth.OnHealthChanged -= UpdateHealthBar; + } + } +} diff --git a/Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs.meta b/Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs.meta new file mode 100644 index 0000000..b7b074a --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/TeamMemberHealthUI.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2429a0099bbd7a940b7652710ebc61f1 \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/UI_Manager.cs b/Assets/New Lowpoly Models/Scripts/UI_Manager.cs index b74c3be..24d7802 100644 --- a/Assets/New Lowpoly Models/Scripts/UI_Manager.cs +++ b/Assets/New Lowpoly Models/Scripts/UI_Manager.cs @@ -7,8 +7,12 @@ public class UI_Manager : MonoBehaviour public static UI_Manager Instance; [SerializeField] private TextMeshProUGUI playerCarryText; + [SerializeField] private TextMeshProUGUI playerCashText; [SerializeField] private TextMeshProUGUI playerDepositText; + [SerializeField] private TextMeshProUGUI teammate1CarryText; + [SerializeField] private TextMeshProUGUI teammate2CarryText; + [SerializeField] private TextMeshProUGUI enemy1CarryText; [SerializeField] private TextMeshProUGUI enemy1DepositText; @@ -18,10 +22,14 @@ public class UI_Manager : MonoBehaviour [SerializeField] private TextMeshProUGUI actionTimerText; [SerializeField] private TextMeshProUGUI depositTimerText; + [SerializeField] private TextMeshProUGUI objectiveText; + [SerializeField] private Slider playerProgressSlider; [SerializeField] private Slider enemy1ProgressSlider; [SerializeField] private Slider enemy2ProgressSlider; + [SerializeField] private CashPopupUI cashPopup; + private void Awake() { Instance = this; @@ -35,6 +43,27 @@ public class UI_Manager : MonoBehaviour $"{amount:N0}"; } + public void ShowCashPopup(int amount) + { + cashPopup?.Show(amount); + } + + public void UpdatePlayerCash(int amount) + { + if (playerCashText != null) + playerCashText.text = $"${amount:N0}"; + } + + public void UpdateTeammate1Cash(int amount) + { + teammate1CarryText.text = $"${amount:N0}"; + } + + public void UpdateTeammate2Cash(int amount) + { + teammate2CarryText.text = $"${amount:N0}"; + } + public void UpdatePlayerDepositCash(int amount) { playerDepositText.text = @@ -73,17 +102,26 @@ public class UI_Manager : MonoBehaviour public void UpdateDepositTimer(float timeLeft) { + if (objectiveText != null) + objectiveText.gameObject.SetActive(false); + depositTimerText.text = - "Depositing: " + Mathf.CeilToInt(timeLeft).ToString(); + "Depositing: " + Mathf.CeilToInt(timeLeft); } public void HideDepositTimer() { depositTimerText.text = ""; + + if (objectiveText != null) + objectiveText.gameObject.SetActive(true); } public void UpdateActionTimer(string actionName, float timeLeft) { + if (objectiveText != null) + objectiveText.gameObject.SetActive(false); + actionTimerText.text = actionName + ": " + Mathf.CeilToInt(timeLeft); } @@ -91,10 +129,34 @@ public class UI_Manager : MonoBehaviour public void HideActionTimer() { actionTimerText.text = ""; + + if (objectiveText != null) + objectiveText.gameObject.SetActive(true); } public void ShowInteractionPrompt(string message) { + if (objectiveText != null) + objectiveText.gameObject.SetActive(false); + actionTimerText.text = message; } + + public void ShowOpenVaultObjective() + { + if (objectiveText != null) + objectiveText.text = "-> Open a vault to collect cash."; + } + + public void ShowDepositObjective() + { + if (objectiveText != null) + objectiveText.text = "-> Deposit your cash at a deposit dtation."; + } + + public void HideObjective() + { + if (objectiveText != null) + objectiveText.text = ""; + } } \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/Vault.cs b/Assets/New Lowpoly Models/Scripts/Vault.cs index 3c1623a..697eaee 100644 --- a/Assets/New Lowpoly Models/Scripts/Vault.cs +++ b/Assets/New Lowpoly Models/Scripts/Vault.cs @@ -29,6 +29,13 @@ public class Vault : MonoBehaviour currentPlayer = player; currentCashManager = other.GetComponent(); + // Player must deposit before opening another vault + if (currentCashManager != null && currentCashManager.currentCash >= vaultCash) + { + UI_Manager.Instance?.ShowInteractionPrompt("Deposit your cash before opening another vault."); + return; + } + playerInside = true; MobileInteractButton.Instance?.Show(); @@ -36,7 +43,7 @@ public class Vault : MonoBehaviour if (!isBeingOpened) { - UI_Manager.Instance?.ShowInteractionPrompt("Press F To Open Vault"); + UI_Manager.Instance?.ShowInteractionPrompt("Press the interaction button to open vault."); } } @@ -79,6 +86,12 @@ public class Vault : MonoBehaviour isBeingOpened) return; + if (currentCashManager.currentCash >= vaultCash) + { + UI_Manager.Instance?.ShowInteractionPrompt("Deposit your cash before opening another vault."); + return; + } + UI_Manager.Instance?.HideActionTimer(); isBeingOpened = true; diff --git a/Assets/New Lowpoly Models/Scripts/VaultMinimapMarker.cs b/Assets/New Lowpoly Models/Scripts/VaultMinimapMarker.cs index 2819dc3..476c7a3 100644 --- a/Assets/New Lowpoly Models/Scripts/VaultMinimapMarker.cs +++ b/Assets/New Lowpoly Models/Scripts/VaultMinimapMarker.cs @@ -8,11 +8,16 @@ public class VaultMinimapMarker : MonoBehaviour private GameObject marker; - private void LateUpdate() + private void Start() { CreateMarker(); } + //private void LateUpdate() + //{ + // CreateMarker(); + //} + private void CreateMarker() { marker = GameObject.CreatePrimitive(PrimitiveType.Quad); diff --git a/Assets/New Lowpoly Models/Scripts/WorldIcon.cs b/Assets/New Lowpoly Models/Scripts/WorldIcon.cs new file mode 100644 index 0000000..8899c2d --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/WorldIcon.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +public class WorldIcon : MonoBehaviour +{ + [SerializeField] Transform target; + [SerializeField] float height = 3f; + + Camera cam; + + void Start() + { + cam = Camera.main; + } + + void LateUpdate() + { + if (cam == null) + return; + + transform.position = target.position + Vector3.up * height; + + transform.forward = cam.transform.forward; + + float distance = Vector3.Distance(cam.transform.position, target.position); + + float scale = Mathf.Clamp(distance * 0.015f, 1f, 2.5f); + + transform.localScale = Vector3.one * scale; + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/WorldIcon.cs.meta b/Assets/New Lowpoly Models/Scripts/WorldIcon.cs.meta new file mode 100644 index 0000000..8dead48 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/WorldIcon.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 523266fa276e1804395c630cce596804 \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/WorldMarker.cs b/Assets/New Lowpoly Models/Scripts/WorldMarker.cs new file mode 100644 index 0000000..a76c6db --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/WorldMarker.cs @@ -0,0 +1,46 @@ +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +public class WorldMarker : MonoBehaviour +{ + [Header("References")] + [SerializeField] private Transform target; + [SerializeField] private TextMeshProUGUI distanceText; + + private Camera cam; + private Transform player; + + void Start() + { + cam = Camera.main; + + PlayerControllerNewRohan p = FindObjectOfType(); + if (p != null) + player = p.transform; + } + + void LateUpdate() + { + if (cam == null) + cam = Camera.main; + + if (player == null) + { + PlayerControllerNewRohan p = FindObjectOfType(); + if (p != null) + player = p.transform; + } + + if (cam == null || player == null) + return; + + // Billboard + transform.forward = cam.transform.forward; + + // Distance + float distance = Vector3.Distance(player.position, target.position); + + distanceText.text = $"{Mathf.RoundToInt(distance)}m"; + } +} \ No newline at end of file diff --git a/Assets/New Lowpoly Models/Scripts/WorldMarker.cs.meta b/Assets/New Lowpoly Models/Scripts/WorldMarker.cs.meta new file mode 100644 index 0000000..9ad9634 --- /dev/null +++ b/Assets/New Lowpoly Models/Scripts/WorldMarker.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0ce259faccb268847adbd48bdc508558 \ No newline at end of file diff --git a/Assets/Scripts/CashSystem/CashSystemCharacterSelection.cs b/Assets/Scripts/CashSystem/CashSystemCharacterSelection.cs index 91a09b4..065963e 100644 --- a/Assets/Scripts/CashSystem/CashSystemCharacterSelection.cs +++ b/Assets/Scripts/CashSystem/CashSystemCharacterSelection.cs @@ -379,7 +379,7 @@ public class CashSystemCharacterSelection : MonoBehaviour // Load game scene Debug.Log("[CashSystemCharacterSelection] Loading Game scene..."); - SceneManager.LoadScene("Test"); + SceneManager.LoadScene("Game"); } /// diff --git a/Assets/Scripts/Character Selection System/CharacterSelection.cs b/Assets/Scripts/Character Selection System/CharacterSelection.cs index 3f8cd26..c0bd85b 100644 --- a/Assets/Scripts/Character Selection System/CharacterSelection.cs +++ b/Assets/Scripts/Character Selection System/CharacterSelection.cs @@ -99,7 +99,7 @@ public class CharacterSelection : MonoBehaviour characterName.text = characterNames[index]; characterDescription.text = characterDescriptions[index]; - if (characterNames[index] == "Windham" || characterNames[index] == "Amira" || characterNames[index] == "Ziggy" || characterNames[index] == "Bahman" || characterNames[index] == "Amon" || characterNames[index] == "Imani") + if (characterNames[index] == "Rabbit" || characterNames[index] == "Cheetah" || characterNames[index] == "Cat" || characterNames[index] == "Eagle" || characterNames[index] == "Hammer-Head" || characterNames[index] == "Hyena") { selectCharacterButton.GetComponent