| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using UnityEngine;
- using UnityEngine.InputSystem;
- /// <summary>
- /// Example script demonstrating the Upgrade API.
- /// Attach this to a GameObject in your scene to test upgrades with keyboard input.
- /// </summary>
- public class UpgradeAPIDemo : MonoBehaviour
- {
- void Update()
- {
- if (Keyboard.current == null)
- return;
- // Press 'E' to upgrade explosive radius
- if (Keyboard.current.eKey.wasPressedThisFrame)
- {
- GameManager.Instance.UpgradeExplosiveRadius(0.5f);
- }
- // Press 'D' to upgrade explosive damage
- if (Keyboard.current.dKey.wasPressedThisFrame)
- {
- GameManager.Instance.UpgradeExplosiveDamage(1.5f);
- }
- // Press 'S' to upgrade split angle
- if (Keyboard.current.sKey.wasPressedThisFrame)
- {
- GameManager.Instance.UpgradeSplitAngle(10f);
- }
- // Press 'P' to upgrade split speed
- if (Keyboard.current.pKey.wasPressedThisFrame)
- {
- GameManager.Instance.UpgradeSplitSpeed(1.5f);
- }
- // Press 'I' to upgrade piercing hits
- if (Keyboard.current.iKey.wasPressedThisFrame)
- {
- GameManager.Instance.UpgradePiercingHits(1);
- }
- // Press 'H' to upgrade homing turn rate
- if (Keyboard.current.hKey.wasPressedThisFrame)
- {
- GameManager.Instance.UpgradeHomingTurnRate(1.5f);
- }
- // Press 'T' to upgrade teleport distance
- if (Keyboard.current.tKey.wasPressedThisFrame)
- {
- GameManager.Instance.UpgradeTeleportDistance(1.5f);
- }
- // Press 'R' to reset all upgrades
- if (Keyboard.current.rKey.wasPressedThisFrame)
- {
- GameManager.Instance.ResetAllUpgrades();
- }
- // Press 'U' to print upgrade summary
- if (Keyboard.current.uKey.wasPressedThisFrame)
- {
- UpgradeState state = GameManager.Instance.GetUpgradeState();
- Debug.Log("=== CURRENT UPGRADES ===\n" + state.ToString());
- }
- }
- void OnGUI()
- {
- GUILayout.BeginArea(new Rect(10, 10, 400, 300));
- GUILayout.Label("UPGRADE API DEMO - Press keys to test:", new GUIStyle(GUI.skin.label) { fontSize = 14 });
- GUILayout.Label("E - Explosive Radius (+0.5)");
- GUILayout.Label("D - Explosive Damage (x1.5)");
- GUILayout.Label("S - Split Angle (+10°)");
- GUILayout.Label("P - Split Speed (x1.5)");
- GUILayout.Label("I - Piercing Hits (+1)");
- GUILayout.Label("H - Homing Turn Rate (x1.5)");
- GUILayout.Label("T - Teleport Distance (x1.5)");
- GUILayout.Label("R - Reset All Upgrades");
- GUILayout.Label("U - Print Upgrade Summary (check Console)");
- GUILayout.EndArea();
- }
- }
|