Exemplo n.º 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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        private void ManageSections()
        {
            TunnelSection currentSection = sections[this.sectionPointer];

            if (currentSection.ZAtEnd >= 0.0f)
            {
                this.IncrementSectionPointer();
                float phaseAtEnd = 0.0f;
                float zAtEnd     = 0.0f;
                switch (this.sectionPointer)
                {
                case 0:
                    phaseAtEnd       = this.TrimPhase(this.sections[1].PhaseAtEnd);
                    zAtEnd           = this.sections[1].ZAtEnd;
                    this.sections[2] = this.CreateSection(phaseAtEnd);
                    this.sections[2].SetZ(zAtEnd);
                    this.OnTunnelSectionSetZCalled(this, new TunnelSectionSetZCalledEventArgs(this.sections[2]));
                    break;

                case 1:
                    phaseAtEnd       = this.TrimPhase(this.sections[2].PhaseAtEnd);
                    zAtEnd           = this.sections[2].ZAtEnd;
                    this.sections[0] = this.CreateSection(phaseAtEnd);
                    this.sections[0].SetZ(zAtEnd);
                    this.OnTunnelSectionSetZCalled(this, new TunnelSectionSetZCalledEventArgs(this.sections[0]));
                    break;

                case 2:
                    phaseAtEnd       = this.TrimPhase(this.sections[0].PhaseAtEnd);
                    zAtEnd           = this.sections[0].ZAtEnd;
                    this.sections[1] = this.CreateSection(phaseAtEnd);
                    this.sections[1].SetZ(zAtEnd);
                    this.OnTunnelSectionSetZCalled(this, new TunnelSectionSetZCalledEventArgs(this.sections[1]));
                    break;
                }
            }
        }
Exemplo n.º 4
0
 public TunnelSectionSetZCalledEventArgs(TunnelSection tunnelSection)
 {
     this.tunnelSection = tunnelSection;
 }
Exemplo n.º 5
0
 public TunnelSectionCreatedEventArgs(TunnelSection tunnelSection)
 {
     this.tunnelSection = tunnelSection;
 }