Esempio n. 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()
        {
            _player = new Player();
            _player.OnFiredShot += ShootNewFootball;
            Camera = new Camera(this, new Vector3(0, -25.0f, 10.0f), 7.0f);
            Window.Title = "First Person Soccer";

            base.Initialize();
        }
Esempio n. 2
0
        private void ShootNewFootball(Player sender)
        {
            var origin = Camera.Position + new Vector3(0, -2.0f, 0);
            var sphere = new Sphere(origin, 1, 1);

            sphere.ApplyImpulse(sphere.Position, Camera.WorldMatrix.Forward * 100);
            _space.Add(sphere);

            var scaling = Matrix.CreateScale(sphere.Radius);
            var model = new EntityModel(sphere, _footballModel, scaling, this);
            Components.Add(model);
        }