function not functioning/variable not subtracting

I’m writing a script to display UI elements on the screen. Most of the actions I want it to achieve it’s doing correctly, but there are a few things which are not running correctly, which I do not understand.

What it currently does:

-when the player hit’s the ‘p’ key the power bar fills up

-only after the power bar is full, when the player hit’s the ‘e’ key, the engine bar fills up

-once and only when the engine bar is full, the warp drive bar fills up

-if the power bar is turned off (by pressing the ‘p’ key again)/drops below it’s max, the engine as well as the warp turns off, decreasing the engine and warp bar variable

What it doesn’t do and I don’t understand why it’s not/weird things it’s doing that I don’t get:

-if the warp variable contains any amount, when the player holds down the w key, it decrements [not doing]

-when the player releases the key again, it fills up (assuming the engine bar is still at max and not off) [not doing]

-occasionally, I have to press the ‘e’ key a few times to get it to begin ‘charging’/‘de-charging’ the engine bar [weird thing its doing]

Here’s the script:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class uiBar : MonoBehaviour {

	public Image systemPowerBar;
	public Image enginePowerBar;
	public Image warpPowerBar;

	public float maxsysPower, minsysPower, Syspower;
	public float maxengPower, minengPower, Engpower;
	public float maxwarPower, minwarPower, Warpower;

	bool engineCanBePowered; //if true, engine can be turned on activating 'engineOn' bool
	bool warpDriveCanBePowered; //if true, warp drive can be turned on activating 'warpDriveOn' bool

	bool powerOn;
	bool engineOn; //'engineCanBePowered' needs to be true before this bool can be set to true
	bool warpDriveOn; //'warpDriveCanBePowered' needs to be true before this bool can be set to true
	
	void Start () {

		powerOn = false;
		maxsysPower = 1f;
		minsysPower = 0f;
		Syspower = 0f;

		engineCanBePowered = false;
		engineOn = false;
		minengPower = 0f;
		maxengPower = 1f;
		Engpower = 0f;

		warpDriveCanBePowered = false;
		warpDriveOn = false;
		minwarPower = 0f;
		maxwarPower = 1f;
		Warpower = 0f;

	}

	void Update () {

		playerInput ();
		boolLogic ();
		minMaxSetters ();
	
	}

	void minMaxSetters() {
		//System 
		if(Syspower > maxsysPower) {
			Syspower = maxsysPower;
		}
		if(Syspower < minsysPower) {
			Syspower = minsysPower;
		}
		if (Syspower == maxsysPower) {
			engineCanBePowered = true;
		}
		//Engine
		if(Engpower > maxengPower) {
			Engpower = maxengPower;
		}
		if (Engpower < minengPower) {
			Engpower = minengPower;
		}
		//Warp
		if (Warpower > maxwarPower) {
			Warpower = maxwarPower;
		}
		if (Warpower < minwarPower) {
			Warpower = minwarPower;
		}
	}

	void playerInput () {
		//System power
		if (Input.GetKeyDown ("p")) {
			powerOn =! powerOn;
		}

		//Engine power
		if (engineCanBePowered == true && Input.GetKey ("e")) {
			engineOn =! engineOn;
		} else if (engineCanBePowered == false && Input.GetKey ("e")) {
			Debug.Log (engineCanBePowered); //TODO: display flashing 'engine not powered' text
		}

		//Warp drive power
		if (warpDriveCanBePowered == true && Input.GetKey ("w")) {
			warpDriveOn =! warpDriveOn;
		} else if (warpDriveCanBePowered == false && Input.GetKey ("w")) {
			warpDriveOn = false;
		}
	}

	void boolLogic() {
		//System 
		if (powerOn == true & Syspower < maxsysPower) {
			syspowerOn (.1f);
		} else if (powerOn == false & Syspower > minsysPower) {
			syspowerDown (.1f);
			warpDriveCanBePowered = false;
		}

		//Engine
		if (Syspower == maxsysPower) {
			engineCanBePowered = true;
		} else if (Syspower < maxsysPower) {
			engineOn = false;
			engineCanBePowered = false;
			warpDriveCanBePowered = false;
			engpowerDown(.1f);
			warpowerDown(.1f);
		}
		if (engineOn == true & Engpower < maxengPower) {
			engpowerUp (.1f);
		} else if (engineOn == false & Engpower > minengPower) {
			engpowerDown(.1f);
		}
		if (Engpower == maxengPower) {
			warpDriveCanBePowered = true;
		} else if(Engpower < maxengPower) {
			warpDriveCanBePowered = false;
		}	

		//Warp
	
		if (warpDriveCanBePowered == true && Warpower < maxwarPower) {
			warpowerUp(.1f);
		} else if (warpDriveCanBePowered == false && Warpower > minwarPower) {
			warpowerDown(.1f);
		}
	}


	void syspowerOn(float powerUP) {
		warpDriveOn = true;
		Syspower += powerUP * Time.deltaTime * 4;
		systemPowerBar.fillAmount = Syspower;
	}

	void syspowerDown(float powerDown) {
		Syspower -= powerDown * Time.deltaTime / 2;
		systemPowerBar.fillAmount = Syspower;
	}

	void engpowerUp(float engineUp) {
		Engpower += engineUp * Time.deltaTime * 4;
		enginePowerBar.fillAmount = Engpower;
	}

	void engpowerDown(float engineDown) {
		Engpower -= engineDown * Time.deltaTime / 2;
		enginePowerBar.fillAmount = Engpower;
	}

	void warpowerUp (float warUp) {
		Warpower += warUp * Time.deltaTime * 2;
		warpPowerBar.fillAmount = Warpower;
	}

	void warpowerDown (float warDown) {
		Warpower -= warDown * Time.deltaTime / 2;
		warpPowerBar.fillAmount = Warpower;
	}
	
}

My question is, why doesn’t the warp bar power down when I hold ‘w’? Is there a better way to achieve what I am attempting?

Yeah, I realised that when I rewrote the entire thing. Mostly works as expected now:

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections;

public class sysBar : MonoBehaviour {

	//bar 'fill' containers
	public Image systemPowerBar;
	public Image enginePowerBar;
	public Image thrustPowerBar;

	//vars
	public float maxSysPower, minSysPower, sysPower;
	public float maxEngPower, minEngPower, engPower;
	public float maxThrPower, minThrPower, thrPower;

	//function switches
	public bool sysEngageCharge;
	public bool engEngageCharge;
	public bool thrEngageCharge;

	public bool sysPowerOn;
	public bool engPowerOn;
	public bool thrPowerOn;

	public bool sysEngage;
	public bool engEngage;
	public bool thrEngage;

	void Start () {

		sysPower = 0f;
		maxSysPower = 1f;
		minSysPower = 0f;

		engPower = 0f;
		maxEngPower = 1f;
		minEngPower = 0f;

		thrPower = 0;
		maxThrPower = 1f;
		minThrPower = 0f;

		sysPowerOn = false;
		engPowerOn = false;
		thrPowerOn = false;

		thrEngage = false;
	
		sysEngageCharge = false;
		engEngageCharge = false;
		thrEngageCharge = false;

	}

	void Update () {

		capFunc ();

		systemEngageInput ();
		thrustEngageInput ();
		engineEngageInput ();

		systemPowerCheck ();
		enginePowerCheck ();
		thrustPowerCheck ();

	}

	void capFunc () { //set max/min cap 

		if (sysPower > maxSysPower) {
			sysPower = maxSysPower;
		}
		if (sysPower < minSysPower) {
			sysPower = minSysPower;
		}
		if(engPower > maxEngPower) {
			engPower = maxEngPower;
		}
		if (engPower < minEngPower) {
			engPower = minEngPower;
		}
		if (thrPower > maxThrPower) {
			thrPower = maxThrPower;
		}
		if(thrPower < minThrPower) {
			thrPower = minThrPower;
		}
	}

	void systemEngageInput () { //press p key to turn sysEngageCharge on/off

		if (Input.GetKeyDown ("p")) {
			sysEngageCharge =! sysEngageCharge; 
		} 
	}

	void systemPowerCheck() {

		if(sysPowerOn == false) {
			engPowerOn = false;
			engEngageCharge = false;
		}

		if (sysPower == maxSysPower) {
			sysPowerOn = true;
		} else {
			sysPowerOn = false;
		}
		if (sysEngageCharge == true && sysPower < maxSysPower) {
			sysPowerUp(.1f);
		} else if (sysEngageCharge == false && sysPower > minSysPower) {
			sysPowerDown(.1f);
		}
	}

	void engineEngageInput () {
		
		if (Input.GetKeyDown ("e") && sysPowerOn == true) {
			engEngageCharge =! engEngageCharge;
		} else if (Input.GetKeyDown ("e") && sysPowerOn == false) {
			Debug.Log(engEngageCharge); //todo: 'system not powered'
		}
	}

	void enginePowerCheck() {
		
		if (engPower == maxEngPower) {
			engPowerOn = true;
			thrPowerOn = true;
			thrEngageCharge = true;
		} else {
			engPowerOn = false;
			thrPowerOn = false;
			thrEngageCharge = false;
		}
		if(engEngageCharge == true && engPower < maxEngPower) {
			engPowerUp(.1f);
		} else if (engEngageCharge == false && engPower > minEngPower) {
			engPowerDown(.1f);
		}
	}

	void thrustEngageInput () { 
		
		if (Input.GetKey ("w") && thrPowerOn == true) { //only when thrPowerOn is true: when holding w key, set switches
			thrEngage = true;
			thrEngageCharge = false;
		} else if (!Input.GetKey ("w") && thrPowerOn == true) { //if not holding key and thrPowerOn is still true, set switches
			thrEngage = false; 
			thrEngageCharge = true;
		}
		if (Input.GetKey ("w") && thrPowerOn == false) { //if thrPowerOn is false, display text
			Debug.Log(thrPowerOn); //todo: 'warp drive not powered'
		}
		
	}

	void thrustPowerCheck () { 

		if (thrEngage == true && thrPower > minThrPower) {
			thrEngageCharge = false;
			thrPowerDown (.1f);
		} 
		if (thrEngageCharge == true && thrPower < maxThrPower) { //check if to see if thrPowerOn is true and thrPower is less than max, if so begin charging
			thrPowerUp (.1f);
		} else if (thrEngageCharge == false && thrPower > minThrPower) { //if not, begin decharging 
			thrPowerDown (.1f);
		}

	}

	//---------
	void sysPowerUp(float i) {
		sysPower += i * Time.deltaTime * 4;
		systemPowerBar.fillAmount = sysPower;
	}
	void sysPowerDown(float i) {
		sysPower -= i * Time.deltaTime / 4;
		systemPowerBar.fillAmount = sysPower;
	}

	void engPowerUp (float i) {
		engPower += i * Time.deltaTime * 4;
		enginePowerBar.fillAmount = engPower;
	}

	void engPowerDown (float i) {
		engPower -= i * Time.deltaTime / 4;
		enginePowerBar.fillAmount = engPower;
	}

	void thrPowerUp(float i) {
		thrPower += i * Time.deltaTime;
		thrustPowerBar.fillAmount = thrPower;
	}
	void thrPowerDown(float i) {
		thrPower -= i * Time.deltaTime;
		thrustPowerBar.fillAmount = thrPower;
	}

}