예제 #1
0
 public Tunnel(int LengthOfSection, Effect tunnelEffect, Texture2D tunnelTexture)//Game gameHandle,
 {
     //create tunnel sections
     this.numSections    = 3;
     this.numSegments    = 10;
     this.radius         = 10.0f;
     this.sectionPointer = 0;
     this.sectionLength  = LengthOfSection;
     this.sections       = new List <TunnelSection>();
     this.tunnelEffect   = tunnelEffect;
     this.tunnelTexture  = tunnelTexture;
     this.chaos          = 0.0f;
     for (int i = 0; i < this.numSections; i++)
     {
         TunnelSection section = new TunnelSection(tunnelEffect, tunnelTexture)
         {
             NumSegments         = this.numSegments,
             Radius              = this.radius,
             TunnelLengthInCells = sectionLength
         };
         section.ConstructTunnel();
         section.PhaseAtStart = i * (section.TunnelLengthInCells - 1) * section.CellSize;
         section.SetInitialZ();
         section.ConstructCurves();
         sections.Add(section);
     }
     this.currentPhase = 0.0f;
     this.speed        = 1.0f;
 }
예제 #2
0
        private TunnelSection CreateSection(float PhaseAtStart)
        {
            TunnelSection section = new TunnelSection(tunnelEffect, tunnelTexture)
            {
                NumSegments         = this.numSegments,
                Radius              = this.radius,
                TunnelLengthInCells = this.sectionLength
            };

            section.ConstructTunnel();
            section.PhaseAtStart = PhaseAtStart;
            section.ConstructCurves();
            this.OnTunnelSectionCreated(this, new TunnelSectionCreatedEventArgs(section));
            return(section);
        }