Hi I try to lower an integer to limit the use of an item but somehow unity blocks that. I haven’t recived any errors btw.
Heres my code:
using UnityEngine;
public class PlayerExtras : MonoBehaviour
{
public GameObject[] possibleExtras;
public int currIceSpikes = 0;
public List<GameObject> medKits;
public int medKitEffect = 10;
public PlayerMovement player;
public int currExtra = 0;
public void LowerIceSpikes(int lowerBy)
{
currIceSpikes = currIceSpikes - lowerBy;
}
void Update()
{
player.projectile = possibleExtras[currExtra];
if(Input.GetKeyDown(KeyCode.Alpha1))
{
currExtra = 0;
}
if(Input.GetKeyDown(KeyCode.Alpha2) && possibleExtras.Length == 2 && currIceSpikes > 0)
{
currExtra = 1;
}
if(Input.GetKeyDown(KeyCode.Return) && medKits.Count > 0)
{
medKits.RemoveAt(0);
player.Health = player.Health + medKitEffect;
}
}
}