コード例 #1
0
ファイル: FigureList.cs プロジェクト: bristevenski/SchoolWork
        /// <summary>
        /// Adds the given figure to the list/
        /// </summary>
        /// <param name="fig"> figure to be added </param>
        /// <param name="movement"> the movement for the figure </param>
        /// <param name="lifetime"> the lifetime for the figure </param>
        public void Add(Figure fig, MovePattern movement, long lifetime = 0)
        {
            FigureMovementPair pair = new FigureMovementPair();

            pair.fig          = fig;
            pair.movement     = movement;
            pair.fig.Lifetime = lifetime;
            figlist.Add(pair);
        }
コード例 #2
0
ファイル: FigureList.cs プロジェクト: bristevenski/SchoolWork
        /// <summary>
        /// Loads all the figures from the given folder. For each figure in the
        /// folder, a random movement pattern is assigned. The figure is then
        /// added to the figlist, and the shine for each figure is set.
        /// </summary>
        /// <param name="folderName"> The folder where the figures are located. </param>
        public void LoadFigures(string folderName)
        {
            //read in all WRL files
            String[] files = System.IO.Directory.GetFiles(folderName, "*.wrl");
            Random   rnd   = new Random();

            foreach (String file in files)
            {
                int         pattern = rnd.Next(RAND_MOVE);
                MovePattern move    = new RandomMovePattern();
                switch (pattern)
                {
                case RNDM:
                {
                    move = new RandomMovePattern();
                    break;
                }

                case FXD1:
                {
                    move = new FixedMovePattern1();
                    break;
                }

                case SINU:
                {
                    move = new SinusoidalMovePattern();
                    break;
                }

                case FXD2:
                {
                    move = new FixedMovePattern2();
                    break;
                }
                }

                FigureMovementPair pair = new FigureMovementPair {
                    fig = new Figure(file), movement = move
                };
                pair.fig.Load();
                pair.fig.Translate(new Vector3(((float)(rnd.NextDouble()) - 0.5f) * INIT_BOUND,
                                               ((float)(rnd.NextDouble()) - 0.5f) * INIT_BOUND,
                                               ((float)(rnd.NextDouble()) - 0.5f) * INIT_BOUND));
                figlist.Add(pair);
            }
            SetShine();
        }
コード例 #3
0
ファイル: FigureList.cs プロジェクト: LastTalon/Portfolio
        /// <summary>
        /// Loads all the figures from the given folder. For each figure in the
        /// folder, a random movement pattern is assigned. The figure is then 
        /// added to the figlist, and the shine for each figure is set.
        /// </summary>
        /// <param name="folderName"> The folder where the figures are located. </param>
        public void LoadFigures(string folderName)
        {
            //read in all WRL files
             String[] files = System.IO.Directory.GetFiles(folderName, "*.wrl");
             Random rnd = new Random();

             foreach (String file in files)
             {
            int pattern = rnd.Next(RAND_MOVE);
            MovePattern move = new RandomMovePattern();
            switch (pattern)
            {
               case RNDM:
               {
                  move = new RandomMovePattern();
                  break;
               }
               case FXD1:
               {
                  move = new FixedMovePattern1();
                  break;
               }
               case SINU:
               {
                  move = new SinusoidalMovePattern();
                  break;
               }
               case FXD2:
               {
                  move = new FixedMovePattern2();
                  break;
               }
            }

            FigureMovementPair pair = new FigureMovementPair { fig = new Figure(file), movement = move };
            pair.fig.Load();
            pair.fig.Translate(new Vector3(((float)(rnd.NextDouble()) - 0.5f) * INIT_BOUND,
                              ((float)(rnd.NextDouble()) - 0.5f) * INIT_BOUND,
                              ((float)(rnd.NextDouble()) - 0.5f) * INIT_BOUND));
            figlist.Add(pair);
             }
             SetShine();
        }