// very basic implementation of firing mechnism, it can be more advanced if needed which I feel not needed for this game private void FireBullet() { int newFireColumn = 0; List <int> nonEmptyFirableColumnIndexs = new List <int>(); for (int i = 0; i < m_firableColumn.Length; i++) { if (m_lastFiredColumn != i && m_firableColumn[i] != null) { nonEmptyFirableColumnIndexs.Add(i); } } newFireColumn = nonEmptyFirableColumnIndexs[UnityEngine.Random.Range(0, nonEmptyFirableColumnIndexs.Count)]; Invader fireInvader = m_firableColumn[newFireColumn]; Vector3 firePosition = fireInvader.transform.position; SpaceInvaderAbstractFactory spaceInvaderFactory = SpaceInvaderFactoryProducer.GetFactory("InvaderBulletFactory"); // accessomg InvaderFactory InvaderBullet invaderBullet = spaceInvaderFactory.GetInvaderBullet(InvaderBulletTypes.SquiglyShot); invaderBullet.gameObject.transform.position = new Vector3(firePosition.x, firePosition.y - .3f, firePosition.z); invaderBullet.gameObject.transform.rotation = Quaternion.identity; invaderBullet.gameObject.SetActive(true); }
public override void RecycleInvaderBullet(InvaderBullet invaderBullet) { }
public override void RecycleInvaderBullet(InvaderBullet invaderBullet) { PoolManager.Instance.PutObjectBacktoPool(invaderBullet.gameObject); }
public abstract void RecycleInvaderBullet(InvaderBullet invaderBullet);