using System.Collections; using System.Collections.Generic; using UnityEngine; public class BatteryManager : MonoBehaviour { public int batteriesCollected; public bool CanCarryBatteries; [HideInInspector] public bool BatteryCollected = false; private static BatteryManager _instance; public static BatteryManager GetInstance() { return _instance; } private void Awake() { if (!_instance) { _instance = this; } } private void Update() { if(batteriesCollected >= 7) //If the batteries that you have collected hit the maximum number you will not be able to carry any more. { CanCarryBatteries = false; } else { CanCarryBatteries = true; } } #region AXRHSTH FTWXIA METHODOS //public void collectBattery() //Collects batteries. //{ // if (CanCarryBatteries) // { // if(Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton0)) // { // batteriesCollected += 1; // BatteryCollected = true; // } // } // else //If you can't carry any more batteries because your inventory is full: // { // if (Input.GetKeyDown(KeyCode.E) || Input.GetKeyDown(KeyCode.JoystickButton0)) // { // print("You can't carry any more batteries INVENTORY FULL!"); // } // } //} #endregion }