Пример #1
0
        public CustomActionList(Game game, GraphicSettings setting, CustomWorld world, Tracker tracker)
            : base(game, setting)
        {
            _world                   = world;
            _tracker                 = tracker;
            PlayerForward            = new ActionVoid(this.PlayerMoveForward);
            PlayerRight              = new ActionVoid(this.PlayerMoveRight);
            PlayerBackward           = new ActionVoid(this.PlayerMoveBackward);
            PlayerLeft               = new ActionVoid(this.PlayerMoveLeft);
            CameraRotation           = new ActionFloatFloat(this.RotateCamera);
            RotateCameraHorizontally = new ActionFloat(this.M_RotateCameraX);
            RotateCameraVertically   = new ActionFloat(this.M_RotateCameraY);
            Pause = new ActionVoid(this.M_Pause);

            Shoot = new ActionVoid(this.MethodShoot);
        }
Пример #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()
        {
            _graphicSettings.Initialize();

            CustomContentLoader loader   = new CustomContentLoader(this.Content);
            CustomWorld         world    = new CustomWorld(new CustomPhysicGenerator(loader));
            Tracker             tracker  = new Tracker(world.Player, 15f);
            Renderer            renderer = new BasicRenderer(_graphicSettings, Content, 45f, tracker);

            _logic   = new LogicManager(world);
            _graphic = new GraphicManager(_logic, tracker, renderer, new CustomGraphicGenerator(loader));

            CustomActionList actionList = new CustomActionList(this, _graphicSettings, world, tracker);
            KeyboardHandler  kh         = new KeyboardHandler(new CustomKeyboardBindingMap(actionList));
            MouseHandler     mh         = new MouseHandler(new CustomMouseBindingMap(actionList), true);

            _input = new InputManager(kh, mh);

            _logic.Start();

            base.Initialize();
        }