// creates the Invaders in a grid manner // with the help of Grid class, this creates a new invader grids and stores in an jagged array private void CreateInvaderGrid() { if (m_invaderTypeRow.Length < 1) { return; } m_gridRows = m_invaderTypeRow.Length; // number of rows of invaders m_gridColumns = m_invaderRowLength; // row counts is basically max Coulumn m_leftMaxMoveCheckIndex = new RawCoumn(0, 0); // first row firt column m_rightMaxMoveCheckIndex = new RawCoumn(0, m_gridColumns - 1); // first row last column m_invaderRows = new Invader[m_gridRows][]; for (int i = 0; i < m_gridRows; i++) { m_invaderRows[i] = new Invader[m_gridColumns]; } m_2DGrid = new Grid2D(m_gridRows, m_gridColumns, m_gridCellWidth, m_gridCellHeight, m_gridRootObject.position); SpaceInvaderAbstractFactory spaceInvaderFactory = SpaceInvaderFactoryProducer.GetFactory("InvaderFactory"); // accessomg InvaderFactory for (int i = 0; i < m_gridRows; i++) { InvaderTypes rowType = m_invaderTypeRow[i]; // current row type for (int j = 0; j < m_gridColumns; j++) { Cell cell = m_2DGrid.Cells[i][j]; Invader invader = spaceInvaderFactory.GetInvader(rowType); // asking for type of invaders from the factory invader.gameObject.transform.position = cell.m_center; invader.m_invaderManger = this; invader.m_rowIndex = i; invader.m_coumnIndex = j; m_totalAliveInviders++; m_totalAliveInvadersSO.Value = m_totalAliveInviders; m_invaderRows[i][j] = invader; // assigning to the invader array } } m_firableColumn = m_invaderRows[m_invaderRows.Length - 1]; m_invaderGridState = InvaderGridState.Created; // Invaders will be in hidden state at this point and next ShowAllInviders will display invaders with animation }
public override Invader GetInvader(InvaderTypes type) { return(PoolManager.Instance.GetObjectFromPool(type.ToString()).GetComponent <Invader>()); }
public override Invader GetInvader(InvaderTypes type) { return(null); }
public abstract Invader GetInvader(InvaderTypes type);