private GameObject RentGameObjectByTileType(TileType type) { switch (type) { case TileType.Path: return(m_PathTilePool.Rent(true)); case TileType.Obstacle: return(m_ObstacleTilePool.Rent(true)); case TileType.TowerOne: GameObject towerOneInstance = m_TowerTilePool.Rent(true); towerOneInstance.GetComponent <Tower>().Init(TowerType.CannonTower); return(towerOneInstance); case TileType.TowerTwo: GameObject towerTwoInstance = m_TowerTilePool.Rent(true); towerTwoInstance.GetComponent <Tower>().Init(TowerType.FreezeTower); return(towerTwoInstance); case TileType.Start: EnemyBase enemyBaseInstance = m_EnemyBasePool.Rent(true).GetComponent <EnemyBase>(); enemyBaseInstance.Init(m_CurrentMapData, m_EnemyPool); OnEnemyBaseLoaded.Invoke(enemyBaseInstance); return(enemyBaseInstance.gameObject); case TileType.End: PlayerBase playerBaseInstance = m_PlayerBasePool.Rent(true).GetComponent <PlayerBase>(); playerBaseInstance.Init(); OnPlayerBaseLoaded.Invoke(playerBaseInstance); return(playerBaseInstance.gameObject); default: return(null); } }
public void PlayerBaseLoaded(PlayerBase playerBase) { OnPlayerBaseLoaded.Invoke(playerBase); }