Beispiel #1
0
 public ReactiveAgentManager(GameManager gameManager, Game game, Camera camera)
 {
     _gameManager = gameManager;
     _game = game;
     _camera = camera;
     _team = 0;
 }
Beispiel #2
0
 public AgentsManager(GameManager gameManager, Game game, Camera camera)
 {
     _gameManager = gameManager;
     _game = game;
     _camera = camera;
     _team = 0;
 }
Beispiel #3
0
 public MultiplayerManager(Game game, Camera camera, GameManager gameManager, NetworkSession networkSession)
 {
     _game = game;
     _camera = camera;
     _gameManager = gameManager;
     _networkSession = networkSession;
 }
Beispiel #4
0
 public ParticleManager(GameManager gameManager, Game game, Camera camera, NetworkSession networkSession)
 {
     this.game = game;
     this.camera = camera;
     this.networkSession = networkSession;
     this.gameManager = gameManager;
 }
Beispiel #5
0
 public Player(GameManager gameManager, Game game, Camera camera, int team, bool isSinglePlayer)
     : base(game, camera)
 {
     _model = game.Content.Load<Model>(@"Models\player");
     _gameManager = gameManager;
     _isSinglePlayer = isSinglePlayer;
     _team = team;
 }
Beispiel #6
0
 public Disk(GameManager gameManager, Game game, Camera camera, bool isSinglePlayer)
     : base(game, camera)
 {
     _model = game.Content.Load<Model>(@"Models\disk");
     _game = game;
     _camera = camera;
     _gameManager = gameManager;
     _isSinglePlayer = isSinglePlayer;
 }
Beispiel #7
0
        public ReactiveAgent(GameManager gameManager, Game game, Camera camera, int team)
        {
            _player = new Player(gameManager, game, camera, team, true);
            _game = game;
            _camera = camera;
            _fovRotation = 0;
            float x, y, z;
            x = (float)Math.Cos(_fovRotation) * _viewDistance;
            z = (float)Math.Sin(_fovRotation) * _viewDistance;
            y = _player.getPositionVector().Y;
            view = Matrix.CreateLookAt(_player.getPositionVector(), new Vector3(x, y, z), Vector3.Up);

            _farPlane = 50;

            projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.PiOver4,
                (float)game.Window.ClientBounds.Width /
                (float)game.Window.ClientBounds.Height,
                1, _farPlane);

            _fov = new BoundingFrustum(view * projection);

            DebugManager dm = (DebugManager)gameManager.getGameEntity("debugManager");
            dm.registerDebugEntities(this);

            _court = (Court)gameManager.getGameEntity("court");
            _disk = (Disk)gameManager.getGameEntity("disk");

            _boundingSphere = new BoundingSphere(_player.getPositionVector(), 3f);

            _randomGenerator = new Random();
            _direction = Vector2.Zero;
            _direction.Y = -1;

            _player.Initialize();
            _player.LoadContent();

            _team = team;
            _hasShoot = false;

            _lastPositionWithDisk = Vector3.Zero;
        }
Beispiel #8
0
 void IReflectable.Draw(GameTime gameTime, Camera camera)
 {
     Camera lastCamera = _camera;
     _camera = camera;
     _game.GraphicsDevice.DepthStencilState = DepthStencilState.None;
     Draw(gameTime);
     _game.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
     _camera = lastCamera;
 }
Beispiel #9
0
 public void SetCamera(Camera camera)
 {
     effectViewParameter.SetValue(camera.view);
     effectProjectionParameter.SetValue(camera.projection);
 }
Beispiel #10
0
        void CreateAllPlayers(Camera camera)
        {
            if (_networkSession != null) {
                foreach (NetworkGamer gamer in _networkSession.AllGamers) {
                    Player newPlayer = new Player(this, _game, camera, (int)gamer.Tag, false);
                    newPlayer.Initialize();
                    newPlayer.LoadContent();

                    gamer.Tag = newPlayer;
                }
            }
        }
Beispiel #11
0
 private void addEntities()
 {
     Camera camera;
     if (_networkSession != null)
         camera = new MultiplayerCamera(_game, new Vector3(85, 85, 0), Vector3.Zero, Vector3.Up);
     else
         camera = new Camera(_game, new Vector3(100, 100, 0), Vector3.Zero, Vector3.Up);
     AddEntity("camera", camera);
     AddEntity("debugManager", new DebugManager());
     AddEntity("collisionManager", new CollisionManager());
     AddEntity("court", new Court(_game, camera, this));
     //AddEntity("atmosphere", new Atmosphere(_game, camera));
     if (_networkSession != null) {
         AddEntity("multiplayerManager", new MultiplayerManager(_game, camera, this, _networkSession));
     } else {
         AddEntity("disk", new Disk(this, _game, camera, true));
         AddEntity("reactiveAgentManager", new ReactiveAgentManager(this, _game, camera));
     }
     //AddEntity("disk", new Disk(this, _game, camera));
     AddEntity("ice", new Ice(_game, camera, this));
     if(_networkSession != null)
         AddEntity("particleManager", new ParticleManager(_game, camera, _networkSession));
     AddEntity("arrowManager", new ArrowManager(_game));
 }