Exemplo n.º 1
0
        /// <summary>
        /// Where the components and entities are added to run the game
        /// </summary>
        public void RunGame()
        {
            //MAKE SURE TO SET PAINT TO TRUE!!!!
            //Create the player
            thePlayer = new Player(world);
            thePlayer.Add(new Physics(new PointF(10, world.Height / 2 + Properties.Resources.character.Height / 3)));
            thePlayer.Add(new Drawing(Properties.Resources.character));
            thePlayer.Paint = true;

            //Create sun
            theSun = new Sun(world);
            theSun.Add(new Physics(theSun.center));
            theSun.Add(new Drawing(theSun.DrawSun));
            theSun.Paint = true;

            //Create sky
            theSky = new Sky(Color.Red, world);
            theSky.Add(new Physics(new PointF(0, 0)));
            theSky.Add(new Drawing(theSky.DrawSky));
            theSky.Paint = true;

            //Create Ground
            theGround = new Ground(world);
            theGround.Add(new Physics(new PointF(world.Width, world.Height)));
            theGround.Add(new Drawing(theGround.DrawGround));
            theGround.Paint = true;


            world.AddEntity(theSky);
            world.AddEntity(theSun);
            world.AddEntity(theGround);
            world.AddEntity(thePlayer);

            events();
        }
Exemplo n.º 2
0
            public Period(int period, int month, int year)
            {
                this.period = period;
                this.month  = month;
                this.year   = year;


                int s = (period == 1 ? 1 : 16),
                    e = (period == 1 ? 15 : DateTime.DaysInMonth(year, month));

                for (int c = s; c <= e; c++)
                {
                    switch (new DateTime(year, month, c).DayOfWeek)
                    {
                    case DayOfWeek.Monday: Mon.Add(c); break;

                    case DayOfWeek.Tuesday: Tue.Add(c); break;

                    case DayOfWeek.Wednesday: Wed.Add(c); break;

                    case DayOfWeek.Thursday: Thu.Add(c); break;

                    case DayOfWeek.Friday: Fri.Add(c); break;

                    case DayOfWeek.Saturday: Sat.Add(c); break;

                    case DayOfWeek.Sunday: Sun.Add(c); break;
                    }
                }
            }