Exemplo n.º 1
0
Arquivo: Agent.cs Projeto: Nesokas/hs
        public Agent(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 = _viewDistance;

            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;
        }
Exemplo n.º 2
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;
                }
            }
        }
Exemplo n.º 3
0
 public IceParticles(Game game, ContentManager content, Player player)
     : base(game, content)
 {
     this.player = player;
 }