Beispiel #1
0
    public void Spawn(TunnelSegment segment)
    {
        if (playing.Value)
        {
            if (buildingStretch)
            {
                SpawnStretchLayout(segment, stretchRotation);
            }
            else
            {
                SpawnRandomLayout(segment);
            }
        }
        else
        {
            SpawnBlank(segment);

            // if next segment is the last, flag the spawning segment
            if (nextSegmentIsLastOfGame)
            {
                segment.lastSegmentOfGame = true;
                nextSegmentIsLastOfGame   = false;
            }
        }
    }
Beispiel #2
0
    void SpawnStretchLayout(TunnelSegment segment, int startRotation)
    {
        nextStretchLayout = currentStretch.GetNextLayout();

        segment.Remake(nextStretchLayout, startRotation);

        if (currentStretch.IsNew())
        {
            currentStretch  = GetNewStretch();
            buildingStretch = false;
        }
    }
Beispiel #3
0
    void InitSegments()
    {
        segmentLength = segmentPrefab.floorPrefab.firewall.transform.localScale.z;

        for (int i = 0; i < poolSize; i++)
        {
            TunnelSegment newSegment = Instantiate(segmentPrefab, transform);
            newSegment.buffers             = buffers;
            newSegment.transform.position += new Vector3(0, 0, segmentLength * i);
            segmentPool.Add(newSegment);
        }
        indexOfFirst = 0;
        indexOfLast  = segmentPool.Count - 1;
    }
Beispiel #4
0
 void SpawnBlank(TunnelSegment segment)
 {
     segment.RemakeBlank();
 }
Beispiel #5
0
 void SpawnRandomLayout(TunnelSegment segment)
 {
     segment.Remake(probabilityFirewall, probabilityCube);
 }