Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject gameObject = collision.gameObject;

        if (!gameObject.GetComponent <Defenders>())
        {
            return;
        }
        animator.SetBool("isAttacking", true);
        attackers.Attack(gameObject);
    }
Esempio n. 2
0
    void OnTriggerEnter2D(Collider2D trigger)
    {
        GameObject obj = trigger.gameObject;

        if (!obj.GetComponent <Defenders>())
        {
            return;
        }

        attacker.Attack(obj);
        anim.SetBool("isAttacking", true);
    }
Esempio n. 3
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        //abort if not colliding with defender
        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        anim.SetBool("isAttacking", true);
        att.Attack(obj);
    }
Esempio n. 4
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        //Leave the method if not a defender
        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        anim.SetBool("isAttacking", true);
        attackers.Attack(obj);
    }
Esempio n. 5
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     obj = collider.gameObject;
     if (!obj.GetComponent <Defenders>())
     {
         return;
     }
     else
     {
         animate.SetBool("Explode", true);
         attackobject.Attack(obj);
     }
 }
Esempio n. 6
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        else
        {
            Debug.LogWarning("Not a defender");
        }

        anim.SetBool("isAttacking", true);
        attacker.Attack(obj);
    }
Esempio n. 7
0
    /// <summary>
    ///
    /// </summary>

    void OnTriggerEnter2D(Collider2D collider)
    {
        obj = collider.gameObject;
        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        if (obj.GetComponent <Stone>())
        {
            animate.SetBool("isJumping", true);
        }
        else
        {
            animate.SetBool("isAttacking", true);
            attackobject.Attack(obj);
        } Invoke("invokebool", 0.5f);
    }
Esempio n. 8
0
    // Attack starts after colliding with something
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        anim.SetBool("isAttacking", true);
        attacker.Attack(obj);
        attacker.StrikeCurrentTarget(15f);
        // Defender health reached 0, interrupts the attack and starts moving
        if (obj.GetComponent <Health>().HP < 0)
        {
            anim.SetBool("isAttacking", false);
        }
    }
Esempio n. 9
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        if (obj.GetComponent <Stone>())
        {
            anim.SetTrigger("jump trigger");
        }
        else
        {
            anim.SetBool("isAttacking", true);
            attacker.Attack(obj);
        }
    }
Esempio n. 10
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        obj = collider.gameObject;

        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        else
        {
            animate.SetBool("isAttacking", true);
            attackobject.Attack(obj);
            thereIsADefender = true;
            defenderHealth   = obj.GetComponent <Health>();
            thereIsADefender = true;

            defenderHealthValue = defenderHealth.health;
        }
    }
Esempio n. 11
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        //Leave the method if not a defender
        if (!obj.GetComponent <Defenders>())
        {
            return;
        }

        if (obj.GetComponent <GraveStone>())
        {
            Debug.Log("Fox Collided with " + collider);
            anim.SetTrigger("JumpTrigger");
        }
        else
        {
            anim.SetBool("isAttacking", true);
            attackers.Attack(obj);
        }
    }
Esempio n. 12
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        // Leave method if not colliding with defender
        if (!obj.GetComponent <Defenders>())
        {
            return;
        }

        //Trigger jump animation
        if (obj.GetComponent <Stone>())
        {
            anim.SetTrigger("jumpTrigger");
        }
        else
        {
            // Set's animation to attacking
            anim.SetBool("isAttacking", true);
            attacker.Attack(obj);
        }
    }
Esempio n. 13
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;

        if (!obj.GetComponent <Defenders>())
        {
            return;
        }
        else if (obj.GetComponent <Stone>())
        {
            anim.SetTrigger("jump once");
        }
        else
        {
            anim.SetBool("isAttacking", true);
            attacker.Attack(obj);
            attacker.StrikeCurrentTarget(10);
            if (obj.GetComponent <Health>().HP < 0)
            {
                anim.SetBool("isAttacking", false);
                Destroy(obj);
            }
        }
    }