コード例 #1
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        FeatureReactionBase item = coll.gameObject.GetComponent <FeatureReactionBase>();

        if (item != null)
        {
            item.onScroll(coll, this);
        }
    }
コード例 #2
0
    public void OnCollisionExit2D(Collision2D coll)
    {
        FeatureReactionBase item = coll.gameObject.GetComponent <FeatureReactionBase>();

        if (item != null)
        {
            item.leaveScroll(coll, this);
        }
    }
コード例 #3
0
//	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);
        }
    }
コード例 #4
0
    public void OnCollisionEnter2D(Collision2D coll)
    {
        GameObject obj = coll.gameObject;

        FeatureReactionBase fb = obj.GetComponent <FeatureReactionBase>();

        if (fb != null)
        {
            fb.hurt(_data.power);
            explode();
        }
    }