예제 #1
0
        private void MoveSpirals()
        {
            TVertex SpiralPos = new TVertex(0, 0, 0);

            for (int i = 0; i < NUM_SPIRALS; i++)
            {
                if (Spirals[i].Visible)
                {
                    SpiralPos = Spirals[i].GetPos();

                    if (SpiralDirection[i]) //spiral go right
                    {
                        SpiralPos.X += SPIRAL_MOVE_STEP;
                        if (SpiralPos.X > STAIR_LENGTH / 2 - SPIRAL_RADIUS) //spiral go left
                        {
                            SpiralDirection[i] = false;
                        }
                    }
                    else //spiral go left
                    {
                        SpiralPos.X -= SPIRAL_MOVE_STEP;
                        if (SpiralPos.X < -STAIR_LENGTH / 2 + SPIRAL_RADIUS) //spiral go right
                        {
                            SpiralDirection[i] = true;
                        }
                    }

                    SpiralPos.Y += STAIRS_Y_FACTOR;
                    SpiralPos.Z -= MOVE_DELTA;

                    SpiralAngle[i] = (SpiralAngle[i] + TURN_ANGLE) % 360;
                    int direction = 1;
                    if (i % 2 == 1)
                    {
                        direction = -1;
                    }

                    Spirals[i].SetPosAndAngle(SpiralPos.X, SpiralPos.Y, SpiralPos.Z, 0, Math3D.Deg2Rad(direction * SpiralAngle[i]), 0);
                }//for
            }
        }