// Tank single cannon fire attack method public void SingleCannonFire() { // Set cannonSource if null if (cannonSource == null) { cannonSource = GetComponentInChildren <CannonSource>(); // Get the cannonSource component in the child of the tank object } else { cannonSource.FireCannon(); // Fire cannon } }