コード例 #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            // Initialize the GoblinXNA framework
            State.InitGoblin(graphics, Content, "");

            // Initialize the scene graph
            scene = new Scene(this);

            State.EnableNetworking = true;
            State.IsServer         = isServer;

            // Set up the lights used in the scene
            CreateLights();

            // Set up the camera, which defines the eye location and viewing frustum
            CreateCamera();

            // Create 3D objects
            CreateObject();

            // Use per pixel lighting for better quality (If you using non NVidia graphics card,
            // setting this to true may reduce the performance significantly)
            scene.PreferPerPixelLighting = true;

            // Create a network object that contains mouse press information to be
            // transmitted over network
            networkObj = new ApacheNetworkObject();

            // When a mouse press event is sent from the other side, then call "ShootBox"
            // function
            networkObj.CallbackFunc = UpdateApache;

            //scene.PhysicsEngine = new NewtonPhysics();

            if (State.IsServer)
            {
                scene.NetworkServer = new LidgrenServer("apache", 14242);
            }


            // Add the mouse network object to the scene graph, so it'll be sent over network
            // whenever ReadyToSend is set to true.
            scene.AddNetworkObject(networkObj);

            State.ShowNotifications = true;
            base.Initialize();
        }
コード例 #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.IsMouseVisible = true;

            // Initialize the GoblinXNA framework
            State.InitGoblin(graphics, Content, "");

            // Initialize the scene graph
            scene = new Scene(this);

            State.EnableNetworking = true;
            State.IsServer = isServer;

            // Set up the lights used in the scene
            CreateLights();

            // Set up the camera, which defines the eye location and viewing frustum
            CreateCamera();

            // Create 3D objects
            CreateObject();

            // Use per pixel lighting for better quality (If you using non NVidia graphics card,
            // setting this to true may reduce the performance significantly)
            scene.PreferPerPixelLighting = true;

            // Create a network object that contains mouse press information to be
            // transmitted over network
            networkObj = new ApacheNetworkObject();

            // When a mouse press event is sent from the other side, then call "ShootBox"
            // function
            networkObj.CallbackFunc = UpdateApache;

            //scene.PhysicsEngine = new NewtonPhysics();

            if (State.IsServer)
                scene.NetworkServer = new LidgrenServer("apache", 14242);

            // Add the mouse network object to the scene graph, so it'll be sent over network
            // whenever ReadyToSend is set to true.
            scene.AddNetworkObject(networkObj);

            State.ShowNotifications = true;
            base.Initialize();
        }