//void Update() //{ // flag.a = 1; //} void OnTriggerEnter2D(Collider2D collider) { //int temp = gm.GetTotalAmount(); string tag = collider.tag; SummonAnimation sa = null; if (tag == "Collectible") { sa = collider.GetComponent <SummonAnimation>(); if (sa.LockAndCheck()) { collider.gameObject.GetComponent <SummonAnimation>().Summon(); mf.CreateNewFollower(collider.gameObject.GetComponent <SpriteRenderer>().sprite); gm.IncrementTotal(); Destroy(collider.gameObject); } } if (tag == "Recycler" && gameObject.GetComponent <ManageFollowers>().GetNFollowers() > 0) //Verifica se to segurando pelo menos um coletável pra ser entregue { collider.gameObject.GetComponent <Animator>().SetTrigger("Burn"); //collider.gameObject.GetComponent<SummonAnimation>().Summon(); mf.ClearAllFollowers(); gm.RetrieveAllPieces(); } }
void OnCollisionEnter2D(Collision2D collision) { colliding = true; SummonAnimation sa = gameObject.GetComponent <SummonAnimation>(); if (sa != null) { sa.Summon(); } Destroy(gameObject); }
void OnTriggerEnter2D(Collider2D collision) { bool wasColliding = colliding; colliding = true; if (collision.tag == "Checkpoint" && justSummoned > 0) { return; } SummonAnimation sa = gameObject.GetComponent <SummonAnimation>(); if (sa != null) { sa.Summon(); } Destroy(gameObject); }