private void OnTriggerEnter2D(Collider2D other)
    {
        DemoObjectType demoObjectType = other.GetComponent <DemoObjectType>();
        string         type           = "null";

        if (demoObjectType != null)
        {
            type = demoObjectType.type;
        }


        if (type == "attack")
        {
            Hurt(1);
        }

        if (type == "pullingAttack")
        {
            timer           = 0;
            pullingAttacked = true;
        }
    }
Example #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        DemoObjectType demoObjectType = other.GetComponent <DemoObjectType>();
        string         type           = "null";

        if (demoObjectType != null)
        {
            type = demoObjectType.type;
        }
        if (type == "ground")
        {
            anim.SetBool("isJumping", false);
            if (life > 0)
            {
                canControl = true;
            }
        }
        if (type == "enemy" && canControl && !attack1.activeSelf && !attack2.activeSelf)
        {
            Hurt(1);
            canControl = false;
        }
    }