Commit 5a89134c authored by mmaluschnig's avatar mmaluschnig
Browse files

power chooses correct fill now

parent 6a2e46ef
...@@ -24,6 +24,7 @@ public class throwManager : MonoBehaviour { ...@@ -24,6 +24,7 @@ public class throwManager : MonoBehaviour {
private bool shotPie; private bool shotPie;
private float angle; private float angle;
private float power;
// Use this for initialization // Use this for initialization
void Start () { void Start () {
...@@ -44,6 +45,7 @@ public class throwManager : MonoBehaviour { ...@@ -44,6 +45,7 @@ public class throwManager : MonoBehaviour {
} }
if (Input.GetKeyUp(KeyCode.Space)) { if (Input.GetKeyUp(KeyCode.Space)) {
PowerIncreasing = AngleState; PowerIncreasing = AngleState;
power = powerBar.fillAmount;
} }
if (Input.GetKey(KeyCode.Space)) { if (Input.GetKey(KeyCode.Space)) {
fillSomething(powerBar); fillSomething(powerBar);
...@@ -78,6 +80,7 @@ public class throwManager : MonoBehaviour { ...@@ -78,6 +80,7 @@ public class throwManager : MonoBehaviour {
} }
if (Input.GetKeyUp(KeyCode.Space)) { if (Input.GetKeyUp(KeyCode.Space)) {
PowerIncreasing = AngleState; PowerIncreasing = AngleState;
power = powerBar.fillAmount;
} }
if (Input.GetKey(KeyCode.Space)) { if (Input.GetKey(KeyCode.Space)) {
fillSomething(powerBar); fillSomething(powerBar);
...@@ -100,7 +103,7 @@ public class throwManager : MonoBehaviour { ...@@ -100,7 +103,7 @@ public class throwManager : MonoBehaviour {
//create pie object and set its power to the powerBars fill //create pie object and set its power to the powerBars fill
//GameObject pie = Instantiate(piePrefab, pieSpawn.position, Quaternion.Euler(new Vector3(0, 0, (1 - angleMeter.fillAmount) * -90))); //GameObject pie = Instantiate(piePrefab, pieSpawn.position, Quaternion.Euler(new Vector3(0, 0, (1 - angleMeter.fillAmount) * -90)));
currentPie.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic; currentPie.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
currentPie.GetComponent<Pie>().force = powerBar.fillAmount; currentPie.GetComponent<Pie>().force = power;
currentPie.transform.parent.DetachChildren(); currentPie.transform.parent.DetachChildren();
currentPie.transform.rotation = Quaternion.Euler(new Vector3(0, 0, (1 - angle) * -90)); currentPie.transform.rotation = Quaternion.Euler(new Vector3(0, 0, (1 - angle) * -90));
currentPie.GetComponent<Pie>().Launch(); currentPie.GetComponent<Pie>().Launch();
......
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