Esempio n. 1
0
        public void Initialize(Engine engine)
        {
            this.engine = engine;

            this.CreatePlayer();

            var r = new Random();
            for (int i = 0; i < 100; i++)
            {
                var node = new SceneNode();
                var box = new PhysicsObject(
                    "Cube",
                    new Vector3(r.Next(20) - 10, r.Next(500) + 200, r.Next(20) - 10),
                    Quaternion.Identity,
                    Vector3.One,
                    typeof(BoxShape),
                    false);
                node.AttachEntity(box);
                this.AttachSceneNodeToRoot(node);
            }

            this.sceneGraph.Initialize(this.engine);
        }
Esempio n. 2
0
 public MainMenuGameState(Engine engine)
     : base(engine)
 {
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes the scene graph.
        /// </summary>
        /// <param name="engine">The engine.</param>
        public void Initialize(Engine engine)
        {
            this.engine = engine;

            foreach (var entity in this.root.Entities)
            {
                entity.LoadContent(this.engine);

                if (entity.GetType() == typeof(PhysicsObject))
                {
                    var physicsObject = (PhysicsObject)entity;
                    physicsObject.AttachToWorld(this.world);
                }

                if (entity.GetType() == typeof(Player))
                {
                    var player = (Player)entity;
                    player.AttachToWorld(this.world);
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameState" /> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 public GameState(Engine engine)
 {
     this.engine = engine;
 }
Esempio n. 5
0
 public PausedGameState(Engine engine)
     : base(engine)
 {
 }
Esempio n. 6
0
 public Camera(Engine engine)
 {
     this.engine = engine;
 }