Commit f966b6bf authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

there still seems to be a slight problem with loading pies (some dont get...

there still seems to be a slight problem with loading pies (some dont get remved from the scene when the players throw is reset) but its a lot better
parent 4758ba7a
......@@ -68,4 +68,11 @@ AnimationClip:
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_GenerateMotionCurves: 0
m_Events: []
m_Events:
- time: 0
functionName: resetThrow
data:
objectReferenceParameter: {fileID: 0}
floatParameter: 0
intParameter: 0
messageOptions: 0
......@@ -24,6 +24,7 @@ public class throwManager : MonoBehaviour {
private bool shotPie;
private bool loadingPie;
private float angle;
private float power;
......@@ -67,7 +68,7 @@ public class throwManager : MonoBehaviour {
//unpause animation
if (loadingPie) {
anim.SetBool("ResetThrow", true);
Destroy(currentPie);
anim.SetBool("BeginThrow", false);
anim.speed = 1;
} else {
anim.speed = 2;
......@@ -76,7 +77,7 @@ public class throwManager : MonoBehaviour {
if (PieManager.pieCount > 0) {
if (Input.GetKeyDown(KeyCode.Space)) {
//load pie into players hand
anim.SetBool("ResetThrow", false);
anim.SetBool("ResetThrow",false);
anim.SetBool("BeginThrow", true);
anim.speed = 1;
angle = angleMeter.fillAmount;
......@@ -94,7 +95,10 @@ public class throwManager : MonoBehaviour {
if (Input.GetKey(KeyCode.Space)) {
fillSomething(powerBar);
} else {
if (loadingPie) {
anim.SetBool("ResetThrow", true);
Destroy(currentPie);
}
fillSomething(angleMeter);
resetMeter(powerBar);
}
......@@ -113,7 +117,7 @@ public class throwManager : MonoBehaviour {
//GameObject pie = Instantiate(piePrefab, pieSpawn.position, Quaternion.Euler(new Vector3(0, 0, (1 - angleMeter.fillAmount) * -90)));
currentPie.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
currentPie.GetComponent<Pie>().force = power;
currentPie.transform.parent.DetachChildren();
hand.transform.DetachChildren();
currentPie.transform.rotation = Quaternion.Euler(new Vector3(0, 0, (1 - angle) * -90));
currentPie.GetComponent<Pie>().Launch();
PieManager.pieInScene = true;
......@@ -130,6 +134,7 @@ public class throwManager : MonoBehaviour {
anim.speed = 0;
anim.SetBool("BeginThrow", false);
loadingPie = false;
}
void fillSomething(Image thing) {
......
m_EditorVersion: 2018.2.12f1
m_EditorVersion: 2018.2.11f1
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