Ejemplo n.º 1
0
        /// <summary>
        /// The function changes between the two levels
        /// </summary>
        public void ChangeLevel()
        {
            if (activeLevel == 0)
            {
                activeLevel       = 1;
                activeLevelPath   = "../../Levels/the-beach.txt";
                inactiveLevelPath = "../../Levels/short-n-sweet.txt";
            }
            else
            {
                activeLevel       = 0;
                activeLevelPath   = "../../Levels/short-n-sweet.txt";
                inactiveLevelPath = "../../Levels/the-beach.txt";
            }

            player = new Player();
            player.SetPosition(0.45f, 0.6f);
            player.SetExtent(0.06f, 0.06f);

            col = new Collision(activeLevelPath);

            parser = new Parser(Placement.FindPlacementAndImage(
                                    activeLevelPath
                                    ));

            //Add textures
            parser.CreateEntityList();

            customer = new CustomerEntity(activeLevelPath);
        }
Ejemplo n.º 2
0
        public void InitializeGameState()
        {
            // game assets
            backGroundImage = new Entity(
                new StationaryShape(new Vec2F(0.0f, 0.0f),
                                    new Vec2F(1.0f, 1.0f)),
                new Image(Path.Combine("Assets", "Images", "SpaceBackground.png"))
                );

            // game entities
            player = new Player();
            player.SetPosition(0.45f, 0.6f);
            player.SetExtent(0.06f, 0.06f);

            col = new Collision(activeLevelPath);

            parser = new Parser(Placement.FindPlacementAndImage(
                                    activeLevelPath
                                    ));

            //Add textures
            parser.CreateEntityList();

            customer = new CustomerEntity(activeLevelPath);

            score = new CustomerPoints(customer);

            taxiTour = new PickUp();
        }
Ejemplo n.º 3
0
        public void FindPlacementAndImage()
        {
            List <Tuple <Tuple <float, float>, string> > x = new List <Tuple <Tuple <float, float>,
                                                                              string> >();

            x.Add(new Tuple <Tuple <float, float>,
                             string>(new Tuple <float, float>((float)8 / 40, 1f - (float)6 / 23), " yellow-stick.png"));
            x.Add(new Tuple <Tuple <float, float>,
                             string>(new Tuple <float, float>((float)8 / 40, 1f - (float)7 / 23), " yellow-stick.png"));
            x.Add(new Tuple <Tuple <float, float>,
                             string>(new Tuple <float, float>((float)8 / 40, 1f - (float)8 / 23), " yellow-stick.png"));
            x.Add(new Tuple <Tuple <float, float>,
                             string>(new Tuple <float, float>((float)8 / 40, 1f - (float)9 / 23), " yellow-stick.png"));
            x.Add(new Tuple <Tuple <float, float>,
                             string>(new Tuple <float, float>((float)8 / 40, 1f - (float)10 / 23), " yellow-stick.png"));
            x.Add(new Tuple <Tuple <float, float>,
                             string>(new Tuple <float, float>((float)8 / 40, 1f - (float)11 / 23), " yellow-stick.png"));



            Assert.AreEqual(
                Placement.FindPlacementAndImage(
                    "/Users/Muse/Desktop/su19-mikaelMuseFrederik/SU19-exercises/" +
                    "TestSpaceTaxi/Levels/placementtest.txt"),
                x
                );
        }