The idea is to access the function BlockWasDestroyed(); from Combo class.
Instead of var combo = gameObject.GetComponent(Combo);
I've also tried with
var combo = GetComponent(Combo);
var combo:Combo = gameObject.GetComponent(Combo);
var combo:Combo = GetComponent(Combo);
But the console keeps telling it's null. However it could work when the function was static, but thing is now that function is calling another function, and so the errors happen once again.
Here's my code so far:
Brick.js
#pragma strict
public class Brick extends MonoBehaviour{
function OnCollisionEnter(col : Collision){
if(col.gameObject.name == "Ball"){
var ballb = gameObject.GetComponent(BouncingBall);
var combo = gameObject.GetComponent(Combo);
combo.BlockWasDestroyed();
ballb.velocityZ = ballb.velocityZ * -1;
Score.score += 20;
Destroy(this.gameObject);
}
}
}