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
        public BDIAgent(GameManager gameManager, Game game, Camera camera, int team)
            : base(gameManager, game, camera, team)
        {
            agentBeliefs.hasFoundDisk = false;
            if (team == 1)
                agentBeliefs.teamGoalPosition = _court.getTeam1GoalPosition();
            else if (team == 2)
                agentBeliefs.teamGoalPosition = _court.getTeam2GoalPosition();

            agentsManager = (AgentsManager)gameManager.getGameEntity("agentsManager");

            agentBeliefs.sameTeamPositions = new Dictionary<Agent, Vector3>();
            agentBeliefs.otherTeamPositions = new Dictionary<Agent, Vector3>();
            agentBeliefs.sawAgents = new List<Agent>();

            agentBeliefs.positionToPass = new Vector3(1000, 1000, 1000);

            intention = Intention.SEARCH_DISK;
        }
Exemplo n.º 3
0
        public PropertiesMenuScreen(GameManager gameManager)
            : base("Properties")
        {
            _blurType = new MenuEntry("Normal Blur");
            _blur = new MenuEntry("Blur");
            _iceTransparency = new MenuEntry("Ice Transparecy");
            MenuEntry exit = new MenuEntry("Exit");

            _blurType.Selected += BlurTypeSelected;
            _blur.Selected += BlurSelected;
            _iceTransparency.Selected += TransparacySelected;
            exit.Selected += OnCancel;

            MenuEntries.Add(_blurType);
            MenuEntries.Add(_blur);
            MenuEntries.Add(_iceTransparency);
            MenuEntries.Add(exit);

            _menuSelected = (int)MenuSelected.NONE;
            _gameManager = gameManager;

            _upAction = new InputAction(
                new Buttons[] { Buttons.DPadUp },
                new Keys[] { Keys.Right },
                true);
            _downAction = new InputAction(
                new Buttons[] { Buttons.DPadDown },
                new Keys[] { Keys.Left },
                true);

            _deselectAction = new InputAction(
                new Buttons[] { Buttons.A },
                new Keys[] { Keys.Enter },
                true);

            _ice = (Ice)_gameManager.getGameEntity("ice");
        }