Example #1
0
    //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();
        }
    }