void OnCollisionEnter2D(Collision2D coll) { FeatureReactionBase item = coll.gameObject.GetComponent <FeatureReactionBase>(); if (item != null) { item.onScroll(coll, this); } }
public void OnCollisionExit2D(Collision2D coll) { FeatureReactionBase item = coll.gameObject.GetComponent <FeatureReactionBase>(); if (item != null) { item.leaveScroll(coll, this); } }
// public void init(Vector3 position, float gScale, Vector2 velocity, BulletData d) // { // tf = transform; // _data = d; // spr = tf.GetComponent<SpriteRenderer>(); // ColorUtil.toAlpha(spr, 1); // tf.position = position; // // Rigidbody2D rb = tf.GetComponent<Rigidbody2D>(); // rb.gravityScale = gScale; // rb.velocity = velocity; // } public void OnTriggerEnter2D(Collider2D coll) { explode(); FeatureReactionBase fb = coll.GetComponent <FeatureReactionBase>(); if (fb != null) { fb.hurt(_data.power); } }
public void OnCollisionEnter2D(Collision2D coll) { GameObject obj = coll.gameObject; FeatureReactionBase fb = obj.GetComponent <FeatureReactionBase>(); if (fb != null) { fb.hurt(_data.power); explode(); } }