// ----------------------------------------------------------------------------------- /// <summary> /// Instances a new cannonball and shoots it in the direction /// of the turret (called from the animation) /// </summary> void AnimationCallback_SpawnCannonball() { Bally newBall = Instantiate(sourceBally, transform.parent, true); AddMinion(newBall); newBall.gameObject.SetActive(true); newBall.transform.position = newBall.transform.position; newBall.transform.localScale = Vector3.one * ScaleBasedOnMaskSize(); newBall.transform.rotation = Quaternion.identity; newBall.SetXYFromLocalPosition(); newBall.Initialize(turretTransform.up * settings["cannonball_speed"].f, false); newBall.Run(); }
// --- MonoBehaviour ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------------- protected override void Start() { base.Start(); sourceBally = GetComponentInChildren <Bally>(true); }