Beispiel #1
0
    void herir(Transform target)
    {
        if (target.transform.tag == tagDamage) {
            Debug.Log (target.transform.tag);
            ds = target.transform.GetComponent<DamageSystem> ();
            if (ds) {
                Debug.Log (tagDamage + ":" + damage);
                ds.hurt (damage);
                if (force > 0) {
                    var direction = target.transform.position - transform.position;
                    ds.GetComponent<Rigidbody2D>().AddForce (direction.normalized * force / 10, ForceMode2D.Impulse);

                }
            }

        }
    }