Commit f1086ac9 authored by astatham's avatar astatham
Browse files

Pies disappear if they hit a target, targets disappear if they're hit by a...

Pies disappear if they hit a target, targets disappear if they're hit by a pie, pies stay where they land if they hit anything else
parent f658077b
......@@ -7,22 +7,27 @@ public class Pie : MonoBehaviour {
// Use this for initialization
void Start () {
Launch();
Launch();
}
private void OnTriggerEnter2D(Collider2D collision)
{
PieManager.pieInScene = false;
PieManager.start = false;
gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(0, 0);
gameObject.GetComponent<Rigidbody2D>().gravityScale = 0;
//gameObject.GetComponent<Rigidbody2D>().isKinematic = true;
//gameObject.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePosition;
if (collision.GetComponent<PieTarget>())
{
Destroy(gameObject);
}
else
{
gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(0, 0);
gameObject.GetComponent<Rigidbody2D>().gravityScale = 0;
}
}
private void Update()
{
private void Update()
{
}
void Launch(){
......
......@@ -9,11 +9,11 @@ public class PieTarget : MonoBehaviour {
}
private void OnTriggerEnter2D(Collider2D collision)
{
//Destroy(gameObject);
private void OnTriggerEnter2D(Collider2D collision)
{
Destroy(gameObject);
}
......
Supports Markdown
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