Пример #1
0
        public void ModuleInit()
        {
            gameInput  = GameFramework.singleton.getInput();
            gameRender = GameFramework.singleton.getGameRender();

            InitGame();
        }
Пример #2
0
 public ArcadeProgram(IntCodeStateMachine cpu, IGameView gameView, IGameInput gameInput = null)
 {
     cpu.OnOutput      += Advance;
     _gameView          = gameView;
     gameInput.OnInput += (_, e) => cpu.SetInput(e);
     _gameState         = new GameState(gameView, gameInput);
 }
Пример #3
0
 public GameState(IGameView gameView, IGameInput gameInput)
 {
     currentGameState           = CurrentState.Starting;
     _wallsCompletedAfterPaddle = 0;
     _gameView  = gameView;
     _gameInput = gameInput;
 }
Пример #4
0
 public void Initialize(Player player, IGameInput input, ProjectileBehaviour.Pool projectilePool)
 {
     _player         = player;
     _input          = input;
     _lastFireTime   = -GameRules.FireCooldown;
     _projectilePool = projectilePool;
 }
Пример #5
0
 public GameArea(ContentManager content, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice, IGameInput gameInput)
 {
     _content = content;
     _spriteBatch = spriteBatch;
     _graphicsDevice = graphicsDevice;
     _gameInput = gameInput;
     _camera = new Camera2D(graphicsDevice);
 }
Пример #6
0
 public DPad(IGameInput inputDevice, InputKey left, InputKey right, InputKey up, InputKey down)
 {
     this.InputDevice = inputDevice;
     this.Left        = left;
     this.Right       = right;
     this.Up          = up;
     this.Down        = down;
 }
Пример #7
0
 public GamePlayer(IGameInput gameInput, IGameOutput gameOutput)
 {
     _gameGrid       = new GameGrid();
     _playerInput    = new PlayerInput(gameInput, gameOutput);
     _gridMaker      = new GridMaker(_playerInput, _gameGrid);
     _gameOutput     = gameOutput;
     _nextGeneration = new NextGeneration();
 }
Пример #8
0
 public GameArea(ContentManager content, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice, IGameInput gameInput)
 {
     _content        = content;
     _spriteBatch    = spriteBatch;
     _graphicsDevice = graphicsDevice;
     _gameInput      = gameInput;
     _camera         = new Camera2D(graphicsDevice);
 }
 public void SetUp()
 {
     stubPlayer = MockRepository.GenerateStub<IPlayer>();
     stubGameInput = MockRepository.GenerateStub<IGameInput>();
     stubCrosshair = MockRepository.GenerateStub<ICrosshair>();
     stubRespawner = MockRepository.GenerateStub<IPlayerRespawner>();
     kpc = new KeyboardPlayerController(stubPlayer, stubGameInput, stubCrosshair, stubRespawner);
 }
Пример #10
0
 public Player(float x, float y, float height, float width, int texture) : base(x, y, height, width, texture)
 {
     this.input     = new MouseAndKeyboard();
     this.texRegion = new TexturedRegion(64 * 3, 256, 64, 64);
     setTexRegion(0, 0);
     lastVert = 0;
     lastTime = DateTime.Now.Ticks / (decimal)TimeSpan.TicksPerMillisecond;
 }
Пример #11
0
        public void OnGlobalInput(IGameInput input) {
            if (input is StopDestroyingInput) {
                _enabled = false;
            }

            else if (input is StartDestroyingInput) {
                _enabled = true;
            }
        }
Пример #12
0
        public void RemoveAxis(IGameInput axis)
        {
            if (axis == null || axesMapping.ContainsKey(axis) == false)
            {
                return;
            }

            axesMapping.Remove(axis);
        }
Пример #13
0
    private void Start()
    {
        _input = inputObject.GetComponent <IGameInput>();

        _tiles = new Tile[tilesCount, tilesCount];
        InitializeVacantPositions();

        GenerateTile();
        GenerateTile();
    }
Пример #14
0
        public void RemoveAction(IGameInput action)
        {
            if (action == null || actionsMapping.ContainsKey(action) == false)
            {
                return;
            }

            actionsMapping.Remove(action);
            lastHandledActionValue.Remove(action);
        }
Пример #15
0
        public void Init(IGameInput iInput, IGameCore iGameCore, IGameRender iGameRender)
        {
            theInput      = iInput;
            theGameCore   = iGameCore;
            theGameRender = iGameRender;

            theInput.ModuleInit();
            theGameCore.ModuleInit();
            theGameRender.ModuleInit();
        }
Пример #16
0
        public KeyboardPlayerController(IPlayer player, IGameInput gameInput, ICrosshair crosshair, IPlayerRespawner playerRespawner)
        {
            this.Player = player;
            this.GameInput = gameInput;
            this.Crosshair = crosshair;
            this.PlayerRespawner = playerRespawner;

            LastShootTime = float.MinValue;
            LastJumpTime = float.MinValue;
        }
Пример #17
0
 void Start()
 {
     if (PlatformUtil.IsTouchDevice)
     {
         _gameInput = new SingleTouchGameInput();
     }
     else
     {
         _gameInput = new WinGameInput();
     }
 }
Пример #18
0
 public override void OnInit()
 {
     if (IsTouchDevice)
     {
         _GameInput = new SingleTouchGameInput();
     }
     else
     {
         _GameInput = new WinGameInput();
     }
 }
Пример #19
0
        public LiveEditor(QuickGameScene scene)
        {
            Scene         = scene;
            KeyboardInput = Input.GetInput(scene);
            MouseInput    = Input.GetMouseInput(scene);
            scene.AddObject(this);
            Cursor = new EditorCursor(scene);

            Menu         = new EditorMenu(scene, this);
            ItemSelector = new ItemSelector(scene, this);
        }
Пример #20
0
        public GameEngine(IBoard board, IMoveProcessor moveProcessor, IAIModule aiModule, IGameInput input, IGameOutput output)
        {
            _board = board;
            this.MoveProcessor = moveProcessor;
            this.MoveProcessor.Board = _board;
            this.AIModule = aiModule;
            this.Input = input;
            this.Output = output;

            this.Input.OnMoveReceived += Input_OnMoveReceived;
        }
Пример #21
0
        public void OnGlobalInput(IGameInput input)
        {
            if (input is StopDestroyingInput)
            {
                _enabled = false;
            }

            else if (input is StartDestroyingInput)
            {
                _enabled = true;
            }
        }
Пример #22
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
#if USE_TOUCH
            _gameInput = new TouchScreenGameInput(Content, GraphicsDevice.Viewport);
#else
            _gameInput = new KeyboardGameInput();
#endif
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _gameWorld   = new GameWorld(this);
            _gameWorld.Setup();
        }
Пример #23
0
 void Start()
 {
     UICamera.genericEventHandler = this.gameObject;
     if (PlatformUtil.IsTouchDevice)
     {
         _gameInput = new SingleTouchGameInput();
     }
     else
     {
         _gameInput = new WinGameInput();
     }
 }
Пример #24
0
        public Ufo(GameWorld gameWorld)
            : base(gameWorld, "ufo")
        {
            _gameInput = gameWorld.GameInput;
            _chainLinkTexture = gameWorld.Content.Load<Texture2D>("chain_link");
            _chainBallTexture = gameWorld.Content.Load<Texture2D>("chain_ball");

            var body = CreateUfoBody();
            AddBallAndChain(body);

            Body = body;
            Body.OnCollision += OnCollision;
        }
Пример #25
0
        public Dragon(GameWorld gameWorld)
            : base(gameWorld, "Dragon")
        {
            _gameInput    = gameWorld.GameInput;
            _spriteEffect = SpriteEffects.None;
            _gameWorld    = gameWorld;

            Body = BodyFactory.CreateRectangle(World,
                                               ConvertUnits.ToSimUnits(Width), ConvertUnits.ToSimUnits(Height),
                                               1f, bodyType: BodyType.Dynamic);
            Body.FixedRotation = true;
            Body.OnCollision  += OnCollision;
        }
Пример #26
0
        public void AddAxis(IGameInput axis, string axisName)
        {
            if (axis == null)
            {
                throw new ArgumentNullException(nameof(axis));
            }
            if (axisName == null)
            {
                throw new ArgumentNullException(nameof(axisName));
            }

            axesMapping.Add(axis, axisName);
        }
Пример #27
0
        /// <summary>
        /// Configures the game input based on Inspector choose.
        /// </summary>
        private void setControll()
        {
            switch (inputType)
            {
            case InputType.desktop:
                gameInput = new DesktopInput();
                break;

            case InputType.joystick:
                gameInput = new JoystickInput();
                break;
            }
        }
Пример #28
0
        public Ufo(GameWorld gameWorld)
            : base(gameWorld, "ufo")
        {
            _gameInput        = gameWorld.GameInput;
            _chainLinkTexture = gameWorld.Content.Load <Texture2D>("chain_link");
            _chainBallTexture = gameWorld.Content.Load <Texture2D>("chain_ball");

            var body = CreateUfoBody();

            AddBallAndChain(body);

            Body              = body;
            Body.OnCollision += OnCollision;
        }
Пример #29
0
        public void AddAction(IGameInput action, string actionName)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }
            if (actionName == null)
            {
                throw new ArgumentNullException(nameof(actionName));
            }

            actionsMapping.Add(action, actionName);
            lastHandledActionValue[action] = 0.0f;
        }
Пример #30
0
 private void Start()
 {
     ServiceProvider.Instance.Game.SceneManager.SceneLoaded += SceneLoaded;
     defaultPitch = ServiceProvider.Instance.Game.Inputs.Pitch;
     myPitch      = new GameInputMock
     {
         Id = defaultPitch.Id,
         DescriptiveName = defaultPitch.DescriptiveName
     };
     defaultRoll = ServiceProvider.Instance.Game.Inputs.Roll;
     myRoll      = new GameInputMock
     {
         Id = defaultRoll.Id,
         DescriptiveName = defaultRoll.Id
     };
 }
Пример #31
0
        public GameWorld(ChopperGame game)
        {
            _content        = game.Content;
            _spriteBatch    = game.SpriteBatch;
            _graphicsDevice = game.GraphicsDevice;
            _gameInput      = game.GameInput;
            _camera         = new Camera2D(_graphicsDevice);
            _world          = new World(new Vector2(0, 10));
            _timeStep       = (float)game.TargetElapsedTime.TotalSeconds;

            _debugView       = new DebugViewXNA(_world);
            _debugView.Flags = 0;
            _debugView.AppendFlags(DebugViewFlags.Shape);
            _debugView.AppendFlags(DebugViewFlags.Joint);
            _debugView.SleepingShapeColor = Color.YellowGreen;

            _crates = new List <Crate>();
        }
Пример #32
0
        public GameWorld(ChopperGame game)
        {
            _content = game.Content;
            _spriteBatch = game.SpriteBatch;
            _graphicsDevice = game.GraphicsDevice;
            _gameInput = game.GameInput;
            _camera = new Camera2D(_graphicsDevice);
            _world = new World(new Vector2(0, 10));
            _timeStep = (float)game.TargetElapsedTime.TotalSeconds;

            _debugView = new DebugViewXNA(_world);
            _debugView.Flags = 0;
            _debugView.AppendFlags(DebugViewFlags.Shape);
            _debugView.AppendFlags(DebugViewFlags.Joint);
            _debugView.SleepingShapeColor = Color.YellowGreen;

            _crates = new List<Crate>();
        }
Пример #33
0
        public GameWorld(BubbleBobbleGame game)
        {
            _content        = game.Content;
            _spriteBatch    = game.SpriteBatch;
            _graphicsDevice = game.GraphicsDevice;
            _gameInput      = game.GameInput;
            _camera         = new Camera2D(_graphicsDevice);

            // Creates the farseer world with a gravity
            _world = new World(new Vector2(0, 20));

            _timeStep = (float)game.TargetElapsedTime.TotalSeconds;

            // Setup the debug view
            _debugView = new DebugViewXNA(_world);
            _debugView.AppendFlags(DebugViewFlags.Shape);
            _debugView.AppendFlags(DebugViewFlags.PolygonPoints);
            _debugView.AppendFlags(DebugViewFlags.CenterOfMass);
        }
Пример #34
0
        public GameWorld(BubbleBobbleGame game)
        {
            _content = game.Content;
            _spriteBatch = game.SpriteBatch;
            _graphicsDevice = game.GraphicsDevice;
            _gameInput = game.GameInput;
            _camera = new Camera2D(_graphicsDevice);

            // Creates the farseer world with a gravity
            _world = new World(new Vector2(0, 20));

            _timeStep = (float)game.TargetElapsedTime.TotalSeconds;

            // Setup the debug view
            _debugView = new DebugViewXNA(_world);
            _debugView.AppendFlags(DebugViewFlags.Shape);
            _debugView.AppendFlags(DebugViewFlags.PolygonPoints);
            _debugView.AppendFlags(DebugViewFlags.CenterOfMass);
        }
Пример #35
0
        public GameController(IAsteroidsManager asteroidsManager, Player player, GameStateData gameStateData,
                              IPlayerBehaviour playerBehaviour, ITimingManager timingManager, IGameInput gameInput,
                              IOpponentBehaviour opponentBehaviour, IBoundProvider boundProvider)
        {
            _asteroidsManager  = asteroidsManager;
            _player            = player;
            _gameStateData     = gameStateData;
            _playerBehaviour   = playerBehaviour;
            _timingManager     = timingManager;
            _gameInput         = gameInput;
            _opponentBehaviour = opponentBehaviour;
            _boundProvider     = boundProvider;

            _player.Death += OnDeath;
            _asteroidsManager.AsteroidDespawned += OnAsteroidDespawn;
            _gameInput.RestartPressed           += OnRestartPressed;

            StartGame();
        }
Пример #36
0
    void Awake()
    {
        switch (_inputDevice)
        {
        case InputDevice.Mobile:
            _currentInputInstance = _gameInputMobile;
            break;

        case InputDevice.PC:
            _currentInputInstance = _gameInputPC;
            _movementJoystick.SetActive(false);
            _attackJoystick.SetActive(false);
            _nextWeaponButton.SetActive(false);
            _previousWeaponButton.SetActive(false);
            break;

        default:
            Debug.LogError("Selected input index out of range.");
            break;
        }
    }
Пример #37
0
 public void OnInput(IGameInput input, IEntity entity) {
     Events.Add(TriggerEvent.OnInput);
 }
Пример #38
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     #if USE_TOUCH
     _gameInput = new TouchScreenGameInput(Content, GraphicsDevice.Viewport);
     #else
     _gameInput = new KeyboardGameInput();
     #endif
     _spriteBatch = new SpriteBatch(GraphicsDevice);
     _gameWorld = new GameWorld(this);
     _gameWorld.Setup();
 }
Пример #39
0
 protected override void Establish_context()
 {
     base.Establish_context();
     _cmd = MoveDirection.LEFT;
     _gameInput = new GameInput();
 }
Пример #40
0
 public void OnGlobalInput(IGameInput input) {
     ++CallCount;
 }
        public MortalCoilSolver()
            : base()
        {
            this.gameSystem = system.SystemInterface;
            this.graphics = gameSystem.Graphics;
            this.input = gameSystem.Input;

            FPSComponent fps = new FPSComponent(this);
            this.r = new Random();
        }
Пример #42
0
 public void Initialize(IGameInput gameInput)
 {
     gameInput.PlayerMoveSignal += movement.Move;
 }
Пример #43
0
 public override void SetUp(IGameState gameState)
 {
     cam       = Camera.main;
     gameInput = BoltNetwork.Instantiate(BoltPrefabs.Game_Input)
                 .GetState <IGameInput>();
 }
Пример #44
0
 public void OnGlobalInput(IGameInput input) {
     Events.Add(TriggerEvent.OnGlobalInput);
 }
Пример #45
0
 public ChopperGame()
 {
     _graphics = new GraphicsDeviceManager(this);
     _gameInput = new KeyboardGameInput();
     Content.RootDirectory = "Content";
 }