コード例 #1
0
        public BallModel(Vector3 position, IInputSystem inputSystem)
        {
            _startPosition = position;
            _inputSystem   = inputSystem;

            Reset();
        }
コード例 #2
0
        /// <summary>
        /// This Gets the Current Input System that is being used... Unity's, CrossPlatform or Rewired
        /// </summary>
        public static IInputSystem GetInputSystem(string PlayerID = "")
        {
            IInputSystem Input_System = null;

#if !CROSS_PLATFORM_INPUT
            Input_System = new DefaultInput();           //Set it as default the Unit Input System
#else
            Input_System = new CrossPlatform();          //Set the Input System to the UNITY STANDARD ASSET CROSS PLATFORM
#endif
#if REWIRED
            Rewired.Player player = Rewired.ReInput.players.GetPlayer(PlayerID);
            if (player != null)
            {
                Input_System = new RewiredInput(player);
            }
            else
            {
                Debug.LogError("NO REWIRED PLAYER WITH THE ID:" + PlayerID + " was found");
            }
#endif
#if OOTII_EI
            Input_System = new EasyInput();
#endif
            return(Input_System);
        }
コード例 #3
0
 private void Construct(
     ICameraSystem cameraSystem,
     IInputSystem inputSystem)
 {
     this.inputSystem  = inputSystem;
     this.cameraSystem = cameraSystem;
 }
コード例 #4
0
        protected void Awake()
        {
            Cam   = GetComponentInChildren <Camera>().transform;
            Pivot = Cam.parent;

            if (manager)
            {
                manager.SetCamera(this);
            }

            if (startState)
            {
                SetState(startState);
            }

            Cursor.lockState = m_LockCursor ? CursorLockMode.Locked : CursorLockMode.None;  // Lock or unlock the cursor.
            Cursor.visible   = !m_LockCursor;

            m_PivotEulers        = Pivot.rotation.eulerAngles;
            m_PivotTargetRot     = Pivot.transform.localRotation;
            m_TransformTargetRot = transform.localRotation;

            inputSystem = DefaultInput.GetInputSystem(PlayerID);

            Horizontal.InputSystem = Vertical.InputSystem = inputSystem;                    //Update the Input System on the Axis
        }
コード例 #5
0
        /// <summary>
        /// Initializes the specified graphic system.
        /// </summary>
        /// <param name="graphicSystem">The graphic system.</param>
        /// <param name="physicSystem">The physic system.</param>
        /// <param name="textSystem">The text system.</param>
        /// <param name="inputSystem">The input system.</param>
        /// <param name="exitAction">The exit action.</param>
        public virtual void Initialize(
            IGraphicSystem graphicSystem,
            IPhysicSystem physicSystem,
            ITextSystem textSystem,
            IInputSystem inputSystem,
            Action exitAction)
        {
            Components          = new List <IComponent>();
            _componentsToRemove = new List <IComponent>();
            _updatables         = new List <IUpdatable>();
            _drawables          = new List <IDrawable>();

            _time = new Time();
            _pendingSceneToOpen = new NullScene(this);

            graphicSystem.Initialize();
            textSystem.Initialize();

            _drawContext  = new DrawContext(graphicSystem, textSystem);
            GraphicSystem = graphicSystem;

            Bounds       = Bounds == Rectangle.Zero ? graphicSystem.Bounds : Bounds;
            PhysicSystem = physicSystem;

            LogSystem = new NullLogSystem();

            FontSystem = textSystem;

            InputSystem = inputSystem;

            this._exitAction = exitAction;
        }
コード例 #6
0
ファイル: Player.cs プロジェクト: Sainori/Asteroids
 private void ResetControl(IInputSystem inputSystem)
 {
     inputSystem.OnUp    -= OnUp;
     inputSystem.OnDown  -= OnDown;
     inputSystem.OnRight -= OnRight;
     inputSystem.OnLeft  -= OnLeft;
     inputSystem.OnSpace -= OnFire;
 }
コード例 #7
0
ファイル: Player.cs プロジェクト: Sainori/Asteroids
 private void SetupControl(IInputSystem inputSystem)
 {
     inputSystem.OnUp    += OnUp;
     inputSystem.OnDown  += OnDown;
     inputSystem.OnRight += OnRight;
     inputSystem.OnLeft  += OnLeft;
     inputSystem.OnSpace += OnFire;
 }
コード例 #8
0
ファイル: PlayerController.cs プロジェクト: DeMoZ/U3d_IOGAME
        public void Init(IInputSystem input, IPlayerCamera camera)
        {
            Debug.Log($"{this} Init");
            _inputSystem  = input;
            _playerCamera = camera;

            SubscribeToEvents();
        }
コード例 #9
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputAxis(string name, string InputValue, bool active, bool raw)
 {
     this.active = active;
     this.raw    = raw;
     input       = InputValue;
     this.name   = name;
     inputSystem = new DefaultInput();
 }
コード例 #10
0
        public Program(IFileSystem fileSystem, IInputSystem inputSystem, IBlockCompressor blockCompressor)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;

            _fileSystem      = fileSystem;
            _inputSystem     = inputSystem;
            _blockCompressor = blockCompressor;
        }
コード例 #11
0
        public ImGuiRenderable(IInputSystem inputSystem, int width, int height, ILogger logger, EngineClient client)
        {
            _inputSystem = inputSystem;
            _width       = width;
            _height      = height;

            ImGuiInterface = new ImGuiInterface(logger, client);
        }
コード例 #12
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputRow(KeyCode k)
 {
     active.Value = true;
     type         = InputType.Key;
     key          = k;
     GetPressed   = InputButton.Down;
     inputSystem  = new DefaultInput();
 }
コード例 #13
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputAxis(string value)
 {
     active      = true;
     raw         = false;
     input       = value;
     name        = "NewAxis";
     inputSystem = new DefaultInput();
 }
コード例 #14
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputAxis(string InputValue, bool active, bool isRaw)
 {
     this.active = active;
     this.raw    = isRaw;
     input       = InputValue;
     name        = "NewAxis";
     inputSystem = new DefaultInput();
 }
コード例 #15
0
 public Game(GameConfiguration configuration)
 {
     this.configuration = configuration;
     inputSystem        = configuration.InputSystem;
     grid      = new SquareGrid(configuration.GridSideLength);
     timer     = new Timer(configuration.UpdateIntervalMs);
     gameState = new GameState();
 }
コード例 #16
0
    public override void Start()
    {
        _inputs = RegsiterActions();
        InputManager.Instance.RegisterActions(_inputs);
        Body = GetComponent <Rigidbody>();

        base.Start();
    }
コード例 #17
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputAxis()
 {
     active      = true;
     raw         = true;
     input       = "Value";
     name        = "NewAxis";
     inputSystem = new DefaultInput();
 }
コード例 #18
0
ファイル: Scene.cs プロジェクト: sodomon2/SharpLife-Engine
        public Scene(IInputSystem inputSystem, ICommandContext commandContext, GraphicsDevice gd, int viewWidth, int viewHeight)
        {
            Camera = new Camera(inputSystem, gd, viewWidth, viewHeight);
            _updateables.Add(Camera);

            if (commandContext == null)
            {
                throw new ArgumentNullException(nameof(commandContext));
            }

            //TODO: might need to move these somewhere else
            //TODO: archived, but circular dependency on engine helpers makes it impossible for now
            _mainGamma = commandContext.RegisterVariable(
                new VariableInfo("mat_gamma")
                .WithValue(2.5f)
                .WithHelpInfo("The main gamma value to use for gamma correction")
                .WithMinMaxFilter(1.8f, 3.0f)
                .WithChangeHandler((ref VariableChangeEvent _) => _lightingSettingChanged = true));

            _textureGamma = commandContext.RegisterVariable(
                new VariableInfo("mat_texgamma")
                .WithValue(2.0f)
                .WithHelpInfo("The texture gamma value to use for gamma correction")
                .WithMinMaxFilter(1.8f, null)
                .WithChangeHandler((ref VariableChangeEvent _) => _lightingSettingChanged = true));

            _lightingGamma = commandContext.RegisterVariable(
                new VariableInfo("mat_lightgamma")
                .WithValue(2.5f)
                .WithHelpInfo("The lighting gamma value to use for gamma correction")
                .WithMinMaxFilter(1.8f, null)
                .WithChangeHandler((ref VariableChangeEvent _) => _lightingSettingChanged = true));

            //TODO: archived
            _brightness = commandContext.RegisterVariable(
                new VariableInfo("mat_brightness")
                .WithValue(0.0f)
                .WithHelpInfo("The lighting brightness multiplier. Set to 0 to disable")
                .WithMinMaxFilter(0.0f, 2.0f)
                .WithChangeHandler((ref VariableChangeEvent _) => _lightingSettingChanged = true));

            //TODO: archived
            _overbright = commandContext.RegisterVariable(
                new VariableInfo("mat_overbright")
                .WithValue(true)
                .WithHelpInfo("Enable or disable overbright lighting")
                .WithBooleanFilter()
                .WithChangeHandler((ref VariableChangeEvent _) => _lightingSettingChanged = true));

            //TODO: mark as cheat cvar
            //TODO: needs to be an integer with settings 0, 1, 2
            Fullbright = commandContext.RegisterVariable(
                new VariableInfo("mat_fullbright")
                .WithValue(false)
                .WithHelpInfo("Enable or disable full brightness (debug)")
                .WithBooleanFilter()
                .WithChangeHandler((ref VariableChangeEvent _) => _lightingSettingChanged = true));
        }
コード例 #19
0
ファイル: InputManager.cs プロジェクト: Marcanius/MPDMaFlo
    public static IInputSystem GetInputSystem()
    {
        if (instance == null)
        {
            instance = CreateInstance();
        }

        return(instance);
    }
コード例 #20
0
ファイル: PlayerModel.cs プロジェクト: shonconnor/pingpong
        public PlayerModel(Vector3 position, Vector3 direction, BoundsWithRotation movementArea, IInputSystem inputSystem)
        {
            Direction      = direction;
            _startPosition = position;
            _inputSystem   = inputSystem;
            _movementArea  = movementArea;

            Reset();
        }
コード例 #21
0
        /// <summary>
        /// Runs the action if specified key is down in the current frame.
        /// </summary>
        /// <returns>The input system.</returns>
        /// <param name="input">The input system.</param>
        /// <param name="key">The key.</param>
        /// <param name="action">The action.</param>
        public static IInputSystem IsKeyDown(this IInputSystem input, Keys key, Action action)
        {
            if (input.IsKeyDown(key))
            {
                action();
            }

            return(input);
        }
コード例 #22
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputRow(string unityInput, KeyCode k, InputButton pressed)
 {
     active.Value = true;
     type         = InputType.Key;
     key          = k;
     input        = unityInput;
     GetPressed   = InputButton.Down;
     inputSystem  = new DefaultInput();
 }
コード例 #23
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputRow(string input, KeyCode key)
 {
     active.Value = true;
     type         = InputType.Key;
     this.key     = key;
     this.input   = input;
     GetPressed   = InputButton.Down;
     inputSystem  = new DefaultInput();
 }
コード例 #24
0
ファイル: Camera.cs プロジェクト: sodomon2/SharpLife-Engine
 public Camera(IInputSystem inputSystem, GraphicsDevice gd, float width, float height)
 {
     _inputSystem     = inputSystem;
     _gd              = gd;
     _useReverseDepth = gd.IsDepthRangeZeroToOne;
     _windowWidth     = width;
     _windowHeight    = height;
     UpdatePerspectiveMatrix();
     UpdateViewMatrix();
 }
コード例 #25
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputRow()
 {
     active.Value = true;
     name         = "InputName";
     type         = InputType.Input;
     input        = "Value";
     key          = KeyCode.A;
     GetPressed   = InputButton.Press;
     inputSystem  = new DefaultInput();
 }
コード例 #26
0
ファイル: MalbersInput.cs プロジェクト: alexcercos/Zoologic
 public InputRow(bool active, string name, string unityInput, KeyCode k, InputButton pressed, InputType itype)
 {
     this.name         = name;
     this.active.Value = active;
     type        = itype;
     key         = k;
     input       = unityInput;
     GetPressed  = pressed;
     inputSystem = new DefaultInput();
 }
コード例 #27
0
 public void SetUp()
 {
     _animationSystem         = Substitute.For <IAnimationSystem>();
     _audioSystem             = Substitute.For <IAudioSystem>();
     _behaviorSystem          = Substitute.For <IBehaviorSystem>();
     _entityDestructionSystem = Substitute.For <IEntityDestructionSystem>();
     _inputSystem             = Substitute.For <IInputSystem>();
     _physicsSystem           = Substitute.For <IPhysicsSystem>();
     _renderingSystem         = Substitute.For <IRenderingSystem>();
 }
コード例 #28
0
        public string PlayerID = "Player0"; //This is use for Rewired Asset
        #endregion

        void Awake()
        {
            Input_System = DefaultInput.GetInputSystem(PlayerID);                   //Get Which Input System is being used

            foreach (var i in inputs)
            {
                i.InputSystem = Input_System;                 //Update to all the Inputs the Input System
            }
            List_to_Dictionary();
        }
コード例 #29
0
    private void Awake()
    {
        _inputSystem      = GetComponent <IInputSystem>();
        _playerController = GetComponent <IPlayerController>();
        _enemyController  = GetComponent <IEnemyController>();
        _uiController     = GetComponent <IUiController>();

        _inputSystem.OnEscape   = OnEscape;
        _inputSystem.OnEscapeUp = () => _timeBeforeQuit = 0;
        _status = GameStatus.Start;
    }
コード例 #30
0
    //private Vector2 touchOrigin = -Vector2.one;

    void Start()
    {
        inputSystem = Manager.GetInputSystem();

        rb2d       = GetComponent <Rigidbody2D>();
        startSpeed = speed;

        moveLeft  = new Vector2(-1, 0);
        moveRight = new Vector2(1, 0);
        moveDown  = new Vector2(0, -1);
        moveUp    = new Vector2(0, 1);
    }