Ejemplo n.º 1
0
        // 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);
        }
Ejemplo n.º 2
0
 public override void RecycleInvaderBullet(InvaderBullet invaderBullet)
 {
 }
Ejemplo n.º 3
0
 public override void RecycleInvaderBullet(InvaderBullet invaderBullet)
 {
     PoolManager.Instance.PutObjectBacktoPool(invaderBullet.gameObject);
 }
Ejemplo n.º 4
0
 public abstract void RecycleInvaderBullet(InvaderBullet invaderBullet);