Commit 169cc128 authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

fixed pie throwing 'tap' spacebar bug

parent 63883711
...@@ -22,6 +22,7 @@ public class throwManager : MonoBehaviour { ...@@ -22,6 +22,7 @@ public class throwManager : MonoBehaviour {
public GameObject hand; public GameObject hand;
private GameObject currentPie; private GameObject currentPie;
private bool shotPie; private bool shotPie;
private bool loadingPie;
private float angle; private float angle;
private float power; private float power;
...@@ -62,13 +63,20 @@ public class throwManager : MonoBehaviour { ...@@ -62,13 +63,20 @@ public class throwManager : MonoBehaviour {
} }
void manageThrow(bool canThrow) { void manageThrow(bool canThrow) {
if (Input.GetKeyUp("space") && PieManager.pieCount > 0 && canThrow) { if (Input.GetKeyUp(KeyCode.Space) && PieManager.pieCount > 0 && canThrow) {
//unpause animation //unpause animation
anim.speed = 2; if (loadingPie) {
anim.SetBool("ResetThrow", true);
Destroy(currentPie);
anim.speed = 1;
} else {
anim.speed = 2;
}
} }
if (PieManager.pieCount > 0) { if (PieManager.pieCount > 0) {
if (Input.GetKeyDown(KeyCode.Space)) { if (Input.GetKeyDown(KeyCode.Space)) {
//load pie into players hand //load pie into players hand
anim.SetBool("ResetThrow", false);
anim.SetBool("BeginThrow", true); anim.SetBool("BeginThrow", true);
anim.speed = 1; anim.speed = 1;
angle = angleMeter.fillAmount; angle = angleMeter.fillAmount;
...@@ -77,6 +85,7 @@ public class throwManager : MonoBehaviour { ...@@ -77,6 +85,7 @@ public class throwManager : MonoBehaviour {
AngleState = PowerIncreasing; AngleState = PowerIncreasing;
PowerIncreasing = true; PowerIncreasing = true;
loadingPie = true;
} }
if (Input.GetKeyUp(KeyCode.Space)) { if (Input.GetKeyUp(KeyCode.Space)) {
PowerIncreasing = AngleState; PowerIncreasing = AngleState;
...@@ -120,6 +129,7 @@ public class throwManager : MonoBehaviour { ...@@ -120,6 +129,7 @@ public class throwManager : MonoBehaviour {
public void pauseAnimation() { public void pauseAnimation() {
anim.speed = 0; anim.speed = 0;
anim.SetBool("BeginThrow", false); anim.SetBool("BeginThrow", false);
loadingPie = false;
} }
void fillSomething(Image thing) { void fillSomething(Image thing) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment