Ejemplo n.º 1
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        //print(collision.gameObject.tag);

        if (collision.gameObject.tag == "Coins")
        {
            UIC.changeScore(1);
            Destroy(collision.gameObject);
        }

        if (collision.gameObject.tag == "Enemy")
        {
            UIC.ChangeLive(-1);

            Vector2 blockForce = new Vector2(0, Vforce);

            if (gameObject.GetComponent <CCAnimation>().faceRight == true)
            {
                blockForce.x = -Hforce;
            }
            else
            {
                blockForce.x = Hforce;
            }

            //print(blockForce);

            gameObject.GetComponent <CCAnimation>().Freeze(blockForce);

            //this.gameObject.GetComponent<Rigidbody2D>().AddForce(blockForce * 10f);
        }
    }
Ejemplo n.º 2
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        //print("get collisionEnter");
        if (collision.gameObject.name == "Castlevania_Animation")
        {
            UIC.changeScore(1);
        }

        Destroy(this);
    }