Ejemplo n.º 1
0
    /*void OnCollisionEnter2D(Collision2D collision)
     * {
     * GameObject obj=collision.gameObject;
     * TopDownMovementWithRigidBody mov =obj.GetComponent<TopDownMovementWithRigidBody>();
     * if (obj.CompareTag("Player")&&mov!=null){
     *
     *  mov.damagePlayer(attack);
     * }
     * }*/

    void OnTriggerStay2D(Collider2D other)
    {
        TopDownMovementWithRigidBody mov = other.GetComponent <TopDownMovementWithRigidBody>();

        if (other.CompareTag("Player") && mov != null)
        {
            mov.damagePlayer(attack);
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization



    void Start()
    {
        player = GameObject.FindWithTag("Player").GetComponent <TopDownMovementWithRigidBody>();
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     targetScript = targetObject.GetComponent <TopDownMovementWithRigidBody>();
 }