コード例 #1
0
    //Called when the Sythe overlaps the Enemy
    void OnCollisionEnter(Collision collision)
    {
        iDestructable other = collision.gameObject.GetComponent <iDestructable>();

        if (other != null)
        {
            other.iDie();
            Destroy(gameObject);
        }
    }
コード例 #2
0
    void OnCollisionEnter(Collision collision)
    {
        print("Colliding!!");
        iDestructable other = collision.gameObject.GetComponent <iDestructable>();

        if (other != null)
        {
            print("Pow!");
            other.iDie();
        }
        else
        {
            Debug.Log("Wimpy...");
        }
    }