Ejemplo n.º 1
0
    private void Start()
    {
        if (_obstaclePool == null)
        {
            _obstaclePool = FindObjectOfType <ObstaclePool>();
        }
        if (_highwayPool == null)
        {
            _highwayPool = FindObjectOfType <HighwayPool>();
        }
        if (_particlePool == null)
        {
            _particlePool = FindObjectOfType <ParticlePool>();
        }


        _chunkSize = (int)(_chunkSize / _highwayPool.HighwayPieceLength) * _highwayPool.HighwayPieceLength;


        _chunkSpawnCheckpoint           = GetComponent <BoxCollider>();
        _chunkSpawnCheckpoint.isTrigger = true;
        _chunkSpawnCheckpoint.center    = new Vector3(0, 0, _chunkSize);

        CreateChunk(1, true);
        CreateChunk(2, false);
    }
Ejemplo n.º 2
0
    public void SpawnChunk(float chunkLength, ObstaclePool obstaclePool, HighwayPool highwayPool, ParticlePool particlePool, bool firstChunk)
    {
        _chunkLength  = chunkLength;
        ChunkCenter   = transform.position;
        _obstaclePool = obstaclePool;
        _particlePool = particlePool;
        _highwayPool  = highwayPool;

        SpawnHighway();
        SpawnObstacles(firstChunk);
    }