Beispiel #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        GruntScript  grunt = other.GetComponent <GruntScript>();
        JohnMovement john  = other.GetComponent <JohnMovement>();

        if (grunt != null)
        {
            grunt.Hit();
        }
        if (john != null)
        {
            john.Hit();
        }
        DestroyBullet();
    }
    private void OnTriggerEnter2D(Collider2D other)
    {
        GruntScript  grunt = other.GetComponent <GruntScript>();
        JohnMovement john  = other.GetComponent <JohnMovement>();

        if (other.CompareTag("enemy"))
        {
            grunt.Hit();
        }
        if (other.name == "John")
        {
            john.Hit();
        }
        DestroyBullet();
    }