Beispiel #1
0
        /// <summary>
        /// Loads the board's content-
        /// </summary>
        /// <param name="device">GraphicsDevice</param>
        /// <param name="content">ContentManager</param>
        public void LoadContent(GraphicsDevice device, ContentManager content)
        {
            //Load sounds
            rollEffect = content.Load <SoundEffect>("roll1");

            placeEffects = new SoundEffect[3];
            //placeEffects[0] = content.Load<SoundEffect>("place1");
            //placeEffects[1] = content.Load<SoundEffect>("place2");
            //placeEffects[2] = content.Load<SoundEffect>("place3");

            Texture2D[] dieTextures = new Texture2D[6]
            {
                Legacy.LoadTexture(device, "die1"),
                Legacy.LoadTexture(device, "die6"),
                Legacy.LoadTexture(device, "die3"),
                Legacy.LoadTexture(device, "die4"),
                Legacy.LoadTexture(device, "die5"),
                Legacy.LoadTexture(device, "die2")
            };


            CollisionSystem sap = new CollisionSystemPersistentSAP();

            world = new World(sap);
            world.SetDampingFactors(1.0f, 1.0f);
            sap.CollisionDetected += OnCollisionDetected;
            world.Gravity          = new JVector(0, -9.8f * 5, 0f);

            RigidBody board = new RigidBody(new BoxShape(new JVector(1000, 25, 1000)));

            board.Position = new JVector(0, -25, 0);
            board.IsStatic = true;
            world.AddBody(board);

            die1Body          = new RigidBody(new BoxShape(new JVector(1.5875f)));
            die1Body.Mass     = 5.8f;
            die1Body.IsStatic = true; //Temporary
            die1Body.Position = new JVector(-15, 60, 0);
            world.AddBody(die1Body);

            die2Body          = new RigidBody(new BoxShape(new JVector(1.5875f)));
            die2Body.Mass     = 5.8f;
            die2Body.IsStatic = true; //Temporary
            die2Body.Position = new JVector(15, 60, 0);
            world.AddBody(die2Body);

            die1Entity = new Prism(device, die1Body, dieTextures);
            die2Entity = new Prism(device, die2Body, dieTextures);
        }
Beispiel #2
0
 /// <summary>
 /// Loads a texture into the library
 /// </summary>
 /// <param name="assetName">Asset name of texture</param>
 public void LoadTexture(string assetName)
 {
     library.Add(assetName, Legacy.LoadTexture(graphicsDevice, assetName));
 }