/// <summary> /// Implements <see cref="CgfGames.IAsteroidView.SpawnChild"/>. /// </summary> public IAsteroidView SpawnChild(int childNum, int childSize) { // Calculate delta angle for this child. float angle = CHILDREN_DELTA_ANGLE / 2 * Math.Sign(childNum - 0.5f); Quaternion rot = Quaternion.Euler(0, 0, angle) * this.trans.rotation; // Obtain and init asteoid. IAsteroidView asteroiView = _asteroidPool .Get(this.trans.position, rot) .GetComponent <AsteroidView> (); asteroiView.Init( childSize, _asteroidPool, _powerupPool, _explosionPool ); return(asteroiView); }
//====================================================================== /// <summary> /// Initializes a new instance of the <see cref="CgfGames.AsteroidCtrl"/> class. /// </summary> /// <param name="view">Associated view.</param> /// <param name="size">Size.</param> public AsteroidCtrl(IAsteroidView view, int size) { this.View = view; this.Size = size; this.View.HitEvent += this.Destroyed; }