コード例 #1
0
    void OnCollisionStay2D(Collision2D collision)
    {
        PlatformerController2D controller = collision.gameObject.GetComponent <PlatformerController2D>();

        if (controller != null)
        {
            controller.TakeDamage();
        }
    }
コード例 #2
0
    void OnTriggerStay2D(Collider2D other)
    {
        PlatformerController2D pController = other.gameObject.GetComponent <PlatformerController2D>();

        if (pController != null)
        {
            pController.TakeDamage();
            return;
        }
    }