コード例 #1
0
 private void UpdateInputs()
 {
     if (!Player.Get().GetMovesBlocked())
     {
         this.m_Inputs.m_Vertical = 0f;
         if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Forward))
         {
             this.m_Inputs.m_Vertical = 1f;
         }
         else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Backward))
         {
             this.m_Inputs.m_Vertical = -1f;
         }
         this.m_Inputs.m_Horizontal = 0f;
         if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Left))
         {
             this.m_Inputs.m_Horizontal = -1f;
         }
         else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Right))
         {
             this.m_Inputs.m_Horizontal = 1f;
         }
         this.m_Inputs.m_Jump   = InputsManager.Get().IsActionActive(InputsManager.InputAction.Jump);
         this.m_Inputs.m_Duck   = InputsManager.Get().IsActionActive(InputsManager.InputAction.Duck);
         this.m_Inputs.m_Sprint = InputsManager.Get().IsActionActive(InputsManager.InputAction.Sprint);
     }
     if (!this.m_Player.GetRotationBlocked())
     {
         this.m_Inputs.m_MouseX = CrossPlatformInputManager.GetAxis("Mouse X") * this.m_LookSensitivityX;
         this.m_Inputs.m_MouseY = CrossPlatformInputManager.GetAxis("Mouse Y") * this.m_LookSensitivityY;
     }
 }
コード例 #2
0
ファイル: UtopiaRender.cs プロジェクト: ErtyHackward/utopia
        //Not Engine injected constructor
        public UtopiaRender(InputsManager inputManager, Size startingWindowsSize, string WindowsCaption, SampleDescription sampleDescription, Size ResolutionSize = default(Size), bool withComObjectDisposeTracking = false)
            : base(startingWindowsSize, WindowsCaption, sampleDescription, ResolutionSize, withComObjectDisposeTracking)
        {
            _inputManager = inputManager;

            VSync = true;                                              // Vsync ON (default)
        }
コード例 #3
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (isColliding)
     {
         InputsManager iPlayer = objectColliding.GetComponent <InputsManager>();
         if (iPlayer == null)
         {
             return;
         }
         if (iPlayer.interract && s_show.money >= 2000)
         {
             iPlayer.interract = false;
             image1.SetActive(true);
         }
     }
     if (image1.activeInHierarchy)
     {
         t_time += Time.fixedDeltaTime;
         if (t_time >= delay)
         {
             image1.SetActive(false);
             t_time = 0;
             SceneManager.LoadScene("MainMenu");
         }
     }
 }
コード例 #4
0
 public override void OnInputAction(InputsManager.InputAction action)
 {
     base.OnInputAction(action);
     if (LoadingScreen.Get().m_Active)
     {
         return;
     }
     if (InventoryBackpack.Get().IsCriticalOverload())
     {
         return;
     }
     if (action == InputsManager.InputAction.Jump && HUDMovie.Get().GetMovieType() == MovieType.None && (this.m_CollisionFlags & CollisionFlags.Below) != CollisionFlags.None)
     {
         if (InputsManager.Get().IsActionActive(InputsManager.InputAction.DodgeLeft) && !InputsManager.Get().IsActionActive(InputsManager.InputAction.DodgeForward))
         {
             this.Dodge(Direction.Left);
         }
         else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.DodgeRight) && !InputsManager.Get().IsActionActive(InputsManager.InputAction.DodgeForward))
         {
             this.Dodge(Direction.Right);
         }
         else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.DodgeBackward))
         {
             this.Dodge(Direction.Backward);
         }
         else
         {
             this.Jump();
         }
     }
 }
コード例 #5
0
ファイル: LTreeVisu.cs プロジェクト: ErtyHackward/utopia
        public LTreeVisu(D3DEngine engine, CameraManager <ICamera> cameraManager, InputsManager inputManager)
        {
            _cameraManager = cameraManager;
            _inputManager  = inputManager;
            _engine        = engine;

            _inputManager.ActionsManager.AddActions(new KeyboardTriggeredAction()
            {
                ActionId    = Actions.EngineReserved1,
                TriggerType = KeyboardTriggerMode.KeyPressed,
                Binding     = new KeyWithModifier()
                {
                    MainKey = Keys.R
                }
            });

            _inputManager.ActionsManager.AddActions(new KeyboardTriggeredAction()
            {
                ActionId    = Actions.EngineReserved2,
                TriggerType = KeyboardTriggerMode.KeyPressed,
                Binding     = new KeyWithModifier()
                {
                    MainKey = Keys.T
                }
            });

            _inputManager.MouseManager.IsRunning = true;

            _spriteRenderer = ToDispose(new SpriteRenderer(engine));
            _font           = ToDispose(new SpriteFont());
            _font.Initialize("Tahoma", 12f, System.Drawing.FontStyle.Bold, true, engine.Device);
        }
コード例 #6
0
 private void UpdateInputs()
 {
     if (!Player.Get().GetMovesBlocked())
     {
         this.m_Inputs.m_Vertical   = InputsManager.Get().GetActionValue(InputsManager.InputAction.Forward) - InputsManager.Get().GetActionValue(InputsManager.InputAction.Backward);
         this.m_Inputs.m_Vertical   = Mathf.Sign(this.m_Inputs.m_Vertical) * (this.m_Inputs.m_Vertical * this.m_Inputs.m_Vertical);
         this.m_Inputs.m_Horizontal = InputsManager.Get().GetActionValue(InputsManager.InputAction.Right) - InputsManager.Get().GetActionValue(InputsManager.InputAction.Left);
         this.m_Inputs.m_Horizontal = Mathf.Sign(this.m_Inputs.m_Horizontal) * (this.m_Inputs.m_Horizontal * this.m_Inputs.m_Horizontal);
         this.m_Inputs.m_Jump       = InputsManager.Get().IsActionActive(InputsManager.InputAction.Jump);
         if (GreenHellGame.IsPadControllerActive() && HUDWheel.Get().m_Active)
         {
             this.m_Inputs.m_Duck = false;
         }
         if (GreenHellGame.Instance.m_Settings.m_ToggleRunOption == GameSettings.ToggleRunOption.No)
         {
             this.m_Inputs.m_Sprint = InputsManager.Get().IsActionActive(InputsManager.InputAction.Sprint);
         }
     }
     else if (!MainLevel.Instance.IsPause())
     {
         this.m_Inputs.m_Jump   = false;
         this.m_Inputs.m_Sprint = false;
     }
     if (!this.m_Player.GetRotationBlocked())
     {
         Vector2 lookInput = InputHelpers.GetLookInput(this.m_LookSensitivityX, this.m_LookSensitivityY, this.m_PadSensitivity);
         this.m_Inputs.m_MouseX = lookInput.x;
         this.m_Inputs.m_MouseY = lookInput.y;
     }
 }
コード例 #7
0
    public static void Parse(ref Data data, ref World world, Deltas delta, InputsManager controls, Settings settings)
    {
        Vector3 characterPos = world.penguinObj.transform.localPosition;

        characterPos.x += data.xPush * delta.actionDelta * 2;

        data.gravity   += (-4 - data.gravity) * delta.actionDelta * 1;
        characterPos.y += data.gravity * delta.actionDelta * 2;
        //Debug.Log(data.gravity);
        if (characterPos.y < 0)
        {
            characterPos.y = 0;
            data.gravity   = 0;
        }
        if (characterPos.y == 0)
        {
            data.xPush  += (0 - data.xPush) * delta.actionDelta * 10;
            data.gravity = 0;
        }

        if (characterPos.y > 2.9f)
        {
            characterPos.y = 2.9f;
        }

        if (characterPos.x < -1.4f)
        {
            characterPos.x = -1.4f;
        }

        world.penguinObj.transform.localPosition = characterPos;
    }
コード例 #8
0
 private void UpdateInputs()
 {
     if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Quit))
     {
         this.Deactivate();
     }
 }
コード例 #9
0
        public MapComponent(D3DEngine engine,
                            InputsManager inputManager,
                            MainScreen screen,
                            ServerComponent server,
                            WorldPlan plan,
                            IPlayerManager playerManager)
        {
            this.IsDefferedLoadContent = true;

            _playerManager = playerManager;
            _engine        = engine;
            _inputManager  = inputManager;
            _screen        = screen;
            _server        = server;

            _mapWindow        = new WindowControl();
            _mapWindow.Name   = "Map";
            _mapWindow.Title  = "World map";
            _mapWindow.Bounds = new UniRectangle(100, 100, 711, 400);


            _planGenerator = plan;
            _playerManager = playerManager;
            //_planGenerator.Parameters = _server.GameInformations.PlanGenerationParameters;
        }
コード例 #10
0
ファイル: UtopiaRender.cs プロジェクト: ErtyHackward/utopia
        public UtopiaRender(D3DEngine engine, InputsManager inputManager, bool withComObjectDisposeTracking)
            : base(engine, withComObjectDisposeTracking)
        {
            _inputManager = inputManager;

            VSync = true;                                              // Vsync ON (default)
        }
コード例 #11
0
 public void HideMenu()
 {
     if (this.m_CurrentScreen)
     {
         this.m_CurrentScreen.Hide();
         if (this.m_CurrentScreen.ShouldPauseGame())
         {
             MainLevel.Instance.Pause(false);
         }
     }
     foreach (Type key in this.m_Screens.Keys)
     {
         this.m_Screens[key].m_ActiveMenuOption = null;
     }
     this.m_CurrentScreen = null;
     this.m_PreviousScreens.Clear();
     Player.Get().UnblockMoves();
     Player.Get().UnblockRotation();
     CursorManager.Get().SetCursor(CursorManager.TYPE.Normal);
     if (this.m_CursorVisible)
     {
         CursorManager.Get().ShowCursor(false, false);
         this.m_CursorVisible = false;
     }
     this.m_OutlineCamera.enabled = true;
     PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 0f);
     InputsManager.Get().m_OmitMouseUp = true;
 }
コード例 #12
0
    private void ApplyOptions()
    {
        Dictionary <int, int> dictionary  = new Dictionary <int, int>();
        Dictionary <int, int> dictionary2 = new Dictionary <int, int>();

        this.AddActionsByInputAction(this.m_ForwardButton, dictionary);
        this.AddActionsByInputAction(this.m_BackwardButton, dictionary);
        this.AddActionsByInputAction(this.m_LeftButton, dictionary);
        this.AddActionsByInputAction(this.m_RightButton, dictionary);
        this.AddActionsByInputAction(this.m_SprintButton, dictionary);
        this.AddActionsByInputAction(this.m_DuckButton, dictionary);
        this.AddActionsByInputAction(this.m_JumpButton, dictionary);
        this.AddActionsByInputAction(this.m_DropButton, dictionary);
        this.AddActionsByInputAction(this.m_AimButton, dictionary);
        this.AddActionsByInputAction(this.m_ThrowButton, dictionary);
        this.AddActionsByInputAction(this.m_CancelAimButton, dictionary);
        this.AddActionsByInputAction(this.m_WaterDrinkButton, dictionary);
        this.AddActionsByInputAction(this.m_InventoryButton, dictionary);
        this.AddActionsByInputAction(this.m_NotepadButton, dictionary);
        this.AddActionsByInputAction(this.m_WheelButton, dictionary);
        this.AddActionsByInputAction(this.m_DialogButton, dictionary);
        this.AddActionsByInputAction(this.m_WeaponSlot1Button, dictionary);
        this.AddActionsByInputAction(this.m_WeaponSlot2Button, dictionary);
        this.AddActionsByInputAction(this.m_WeaponSlot3Button, dictionary);
        this.AddActionsByInputAction(this.m_WeaponSlot4Button, dictionary);
        this.AddActionsByInputAction(this.m_BlockButton, dictionary);
        this.AddActionsByInputAction(this.m_WatchButton, dictionary);
        this.AddActionsByInputAction(this.m_ThrowStoneButton, dictionary);
        this.AddActionsByTriggerAction(this.m_ActionButton, dictionary2);
        this.AddActionsByInputAction(this.m_QuitButton, dictionary);
        this.AddActionsByInputAction(this.m_ReadButton, dictionary);
        InputsManager.Get().ApplyOptions(dictionary, dictionary2);
    }
コード例 #13
0
 void Awake()
 {
     if (m_instance == null)
     {
         m_instance = this;
     }
 }
コード例 #14
0
        public ItemInfoWindow(IconFactory iconFactory, InputsManager inputManager)
        {
            _iconFactory = iconFactory;
            Title        = "Information";
            Bounds       = new UniRectangle(700, 120, 200, 240);

            _cell = new InventoryCell(null, _iconFactory, new Vector2I(), inputManager)
            {
                DrawCellBackground = false,
                Bounds             = new UniRectangle(10, 30, 64, 64)
            };

            _nameLabel = new LabelControl
            {
                Bounds     = new UniRectangle(80, 50, 100, 20),
                Autosizing = true
            };

            _descriptionLabel = new LabelControl
            {
                Bounds     = new UniRectangle(10, 80, 180, 100),
                Autosizing = true
            };

            Children.Add(_descriptionLabel);
            Children.Add(_nameLabel);
            Children.Add(_cell);
        }
コード例 #15
0
ファイル: WorldInit.cs プロジェクト: fernhw/GMTKJam2020
    public static void Parse(ref World world, ref Data data, ref Deltas delta, ref InputsManager controls)
    {
        // Setting Penguin birth (spawn)
        world.penguinObj.transform.localPosition = world.gameStartingSpawn.transform.localPosition;


        data = new Data();

        // Init deltas for stability
        delta = new Deltas {
            actionDelta = 1 / 60,
            mainDelta   = 1 / 60
        };

        // init inputs
        controls = new InputsManager {
            movement = new Vector2(),
            pointer  = new Vector2()
        };


        // Setting initial variables
        // Initial Camera position is set to the spawn
        data.CameraPositionToSpawnPoint = world.gameStartingSpawn.transform.localPosition - world.cam.transform.localPosition;
        // initializing lerped camera to main camera
        data.lerpedCameraPosition = data.CameraPositionToSpawnPoint;
    }
コード例 #16
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (isColliding)
     {
         InputsManager iPlayer = objectColliding.GetComponent <InputsManager>();
         if (iPlayer == null)
         {
             return;
         }
         if (iPlayer.interract && !isDone)
         {
             iPlayer.interract = false;
             iPlayer.GetComponent <Player>().Dead(dead.Tube);
             image1.SetActive(true);
             isDone = true;
         }
     }
     if (image1.activeInHierarchy)
     {
         t_time += Time.fixedDeltaTime;
         if (t_time >= delay)
         {
             image1.SetActive(false);
             t_time = 0;
             Destroy(gameObject);
         }
     }
 }
コード例 #17
0
 // Start is called before the first frame update
 void Start()
 {
     elevator    = 0;
     show        = FindObjectOfType <Show>();
     soundPlayer = FindObjectOfType <SoundPlayer>();
     im          = FindObjectOfType <InputsManager>();
 }
コード例 #18
0
        public CraftingInventory(
            D3DEngine engine,
            WorldConfiguration conf,
            PlayerEntityManager character,
            IconFactory iconFactory,
            InputsManager inputManager,
            SandboxCommonResources commonResources) :
            base(conf, character, iconFactory, inputManager)
        {
            _engine            = engine;
            _iconFactory       = iconFactory;
            _inputManager      = inputManager;
            _commonResources   = commonResources;
            _stInventoryWindow = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\crafting_window.png"));

            _stLabelRecipes     = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_crafting_recipes.png"));
            _stLabelIngredients = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_ingredients.png"));
            _stLabelCraft       = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\label_craft.png"));
            _stBtnCraft         = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close.png"));
            _stBtnCraftDown     = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close_down.png"));
            _stBtnCraftHover    = ToDispose(new SpriteTexture(engine.Device, @"Images\Inventory\inventory_close_hover.png"));

            CustomWindowImage = _stInventoryWindow;
            Bounds.Size       = new UniVector(627, 388);

            InitializeComponent();
        }
コード例 #19
0
    public static Vector2 GetLookInput(float mouse_mul_x = 1f, float mouse_mul_y = 1f, float pad_multiplier = 150f)
    {
        Vector2 vector = new Vector2(InputsManager.Get().GetActionValue(InputsManager.InputAction.LookRight) - InputsManager.Get().GetActionValue(InputsManager.InputAction.LookLeft), InputsManager.Get().GetActionValue(InputsManager.InputAction.LookUp) - InputsManager.Get().GetActionValue(InputsManager.InputAction.LookDown));

        if (GreenHellGame.Instance.m_Settings.m_InvertMouseY)
        {
            vector.y *= -1f;
        }
        if (GreenHellGame.Instance.m_Settings.m_ControllerType != ControllerType.PC)
        {
            float magnitude = vector.magnitude;
            if (magnitude > 1f)
            {
                vector /= magnitude;
            }
            vector *= Mathf.Pow(vector.magnitude, 2f);
            vector *= Time.deltaTime * pad_multiplier;
        }
        else
        {
            vector.x *= mouse_mul_x;
            vector.y *= mouse_mul_y;
        }
        return(vector);
    }
コード例 #20
0
 private void UpdateBlock()
 {
     if (this.m_IsBlock != InputsManager.Get().IsActionActive(InputsManager.InputAction.Block))
     {
         this.SetBlock(!this.m_IsBlock);
     }
     if (this.m_IsBlock)
     {
         PlayerConditionModule.Get().DecreaseStamina(PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.Block) * Time.deltaTime);
         if (PlayerConditionModule.Get().GetStamina() == 0f)
         {
             this.SetBlock(false);
         }
         else if (SwimController.Get().IsActive())
         {
             this.SetBlock(false);
         }
         else if (Inventory3DManager.Get().gameObject.activeSelf)
         {
             this.SetBlock(false);
         }
         else if (HUDReadableItem.Get().enabled)
         {
             this.SetBlock(false);
         }
     }
 }
コード例 #21
0
    private void UpdateState()
    {
        RectTransform component = this.m_Text.GetComponent <RectTransform>();
        bool          flag      = RectTransformUtility.RectangleContainsScreenPoint(component, Input.mousePosition);

        if (flag)
        {
            if (this.m_State == UIKeyBindButtonState.Unfocused)
            {
                this.m_State = UIKeyBindButtonState.Focused;
            }
            else if (this.m_State == UIKeyBindButtonState.Focused && InputsManager.Get().IsActionActive(InputsManager.InputAction.LMB))
            {
                this.m_State = UIKeyBindButtonState.Selected;
            }
        }
        else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.LMB))
        {
            this.m_State = UIKeyBindButtonState.Unfocused;
        }
        else if (this.m_State == UIKeyBindButtonState.Focused)
        {
            this.m_State = UIKeyBindButtonState.Unfocused;
        }
    }
コード例 #22
0
ファイル: PickingManager.cs プロジェクト: ErtyHackward/utopia
        public PickingManager(IWorldChunks worldChunks,
                              ICameraManager cameraManager,
                              InputsManager inputsManager,
                              SingleArrayChunkContainer cubesHolder,
                              WorldConfiguration worldConfiguration)
        {
            if (worldChunks == null)
            {
                throw new ArgumentNullException("worldChunks");
            }
            if (cameraManager == null)
            {
                throw new ArgumentNullException("cameraManager");
            }
            if (inputsManager == null)
            {
                throw new ArgumentNullException("inputsManager");
            }
            if (cubesHolder == null)
            {
                throw new ArgumentNullException("cubesHolder");
            }
            if (worldConfiguration == null)
            {
                throw new ArgumentNullException("worldConfiguration");
            }

            _worldChunks        = worldChunks;
            _cameraManager      = cameraManager;
            _inputsManager      = inputsManager;
            _cubesHolder        = cubesHolder;
            _worldConfiguration = worldConfiguration;

            ShowDebugInfo = true;
        }
コード例 #23
0
 public void LoadSettings()
 {
     if (File.Exists(Application.persistentDataPath + "/" + this.m_SettingsFileName))
     {
         BinaryFormatter binaryFormatter = new BinaryFormatter();
         FileStream      fileStream      = File.Open(Application.persistentDataPath + "/" + this.m_SettingsFileName, FileMode.Open);
         GameVersion     lhs             = new GameVersion((GameVersion)binaryFormatter.Deserialize(fileStream));
         this.m_Language = (Language)binaryFormatter.Deserialize(fileStream);
         this.m_Volume   = (float)binaryFormatter.Deserialize(fileStream);
         if (lhs < GreenHellGame.s_GameVersionEarlyAccessUpdate2)
         {
             this.m_Volume = General.DecibelToLinear(this.m_Volume);
         }
         this.m_SoftShadows = (bool)binaryFormatter.Deserialize(fileStream);
         this.m_ShadowsBlur = (GameSettings.OptionLevel)binaryFormatter.Deserialize(fileStream);
         if (lhs > GreenHellGame.s_GameVersionEarlyAcces)
         {
             this.m_InvertMouseY  = (bool)binaryFormatter.Deserialize(fileStream);
             this.m_XSensitivity  = (float)binaryFormatter.Deserialize(fileStream);
             this.m_YSensitivity  = (float)binaryFormatter.Deserialize(fileStream);
             this.m_DialogsVolume = (float)binaryFormatter.Deserialize(fileStream);
             this.m_MusicVolume   = (float)binaryFormatter.Deserialize(fileStream);
             this.m_EnviroVolume  = (float)binaryFormatter.Deserialize(fileStream);
             this.m_GeneralVolume = (float)binaryFormatter.Deserialize(fileStream);
         }
         if (lhs >= GreenHellGame.s_GameVersionEarlyAccessUpdate3)
         {
             InputsManager.Get().LoadSettings(binaryFormatter, fileStream);
         }
         fileStream.Close();
     }
     this.ApplySettings();
 }
コード例 #24
0
        public GameCore(int width, int height, string title, bool mouseVisible = true, string contentDir = "Content")
        {
            Instance = this;

            RenderManager = new RenderManager();
            InputsManager = new InputsManager();

            _windowWidth   = width;
            _windowHeight  = height;
            WindowTitle    = title;
            IsMouseVisible = mouseVisible;


            _graphics = new GraphicsDeviceManager(this);
            _graphics.DeviceCreated           += Graphics_DeviceCreated;
            _graphics.PreparingDeviceSettings += Graphics_PreparingDeviceSettings;

            Content.RootDirectory = contentDir;


            _graphics.PreferredBackBufferWidth  = WindowWidth;
            _graphics.PreferredBackBufferHeight = WindowHeight;

            _graphics.SynchronizeWithVerticalRetrace = false;
            IsFixedTimeStep   = true;
            TargetElapsedTime = TimeSpan.FromMilliseconds(1000.0f / 60);
            _graphics.ApplyChanges();
        }
コード例 #25
0
        private void OnGUI()
        {
            if (!uiVisible)
            {
                return;
            }

            GUI.skin = ModAPI.Interface.Skin;
            if (wordWrappingBoxStyle == null)
            {
                wordWrappingBoxStyle = new GUIStyle(GUI.skin.box)
                {
                    wordWrap     = true,
                    stretchWidth = true
                };
            }

            windowRect = GUILayout.Window(WINDOW_ID, windowRect, WindowOnGUI, "- More Graphics Settings -");

            // Allow closing the menu with ESC key
            if (Event.current.isKey && Event.current.keyCode == KeyCode.Escape && !InputsManager.Get().m_TextInputActive)
            {
                SetUIVisible(false);
                GUI.FocusControl(null);                   // Release keyboard focus from TextFields
            }

            // While interacting with the menu or scrolling through it, don't send input to game (i.e. don't fire an arrow or switch between weapons)
            if (windowRect.Contains(Event.current.mousePosition) && (!Mathf.Approximately(Input.mouseScrollDelta.y, 0f) || Input.GetMouseButton(0)))
            {
                Input.ResetInputAxes();
            }
        }
コード例 #26
0
        private void OnGUI()
        {
            if (!uiVisible)
            {
                return;
            }

            GUI.skin = ModAPI.Interface.Skin;

            windowRect = GUILayout.Window(WINDOW_ID, windowRect, WindowOnGUI, "- Gulliver Mod -");

            // Allow closing the menu with ESC key
            if (Event.current.isKey && Event.current.keyCode == KeyCode.Escape && !InputsManager.Get().m_TextInputActive)
            {
                SetUIVisible(false);
                GUI.FocusControl(null);                   // Release keyboard focus from TextFields
            }

            // While interacting with the menu or scrolling through it, don't send input to game (i.e. don't fire an arrow or switch between weapons)
            if (windowRect.Contains(Event.current.mousePosition) && (!Mathf.Approximately(Input.mouseScrollDelta.y, 0f) || Input.GetMouseButton(0)))
            {
                Input.ResetInputAxes();
            }

            // While picking entities, show a tooltip on top of the hovered entity
            if (isPickingEntity && hoveredEntity && Event.current.type == EventType.Repaint)
            {
                Vector2 tooltipSize = GUI.skin.box.CalcSize(new GUIContent(hoveredEntity.name));
                Vector2 mousePos    = Event.current.mousePosition;
                GUI.Box(new Rect(mousePos.x - tooltipSize.x * 0.5f, mousePos.y - tooltipSize.y, tooltipSize.x, tooltipSize.y), hoveredEntity.name);
            }
        }
コード例 #27
0
    private void Update()
    {
        if (!IsGamePaused && InputsManager.AnyPauseButtonDown())
        {
            Time.timeScale = 0.0f;
            pauseTextGO.SetActive(true);
            IsGamePaused = true;
        }

        if (IsGamePaused)
        {
            if (InputsManager.AnyPauseButtonDown())
            {
                holdingStartTimer += Time.unscaledDeltaTime;
                if (holdingStartTimer >= HoldStartToGoBackTime)
                {
                    Time.timeScale = 1.0f;
                    SceneManager.LoadScene("Menus");
                }
            }
            else
            {
                holdingStartTimer = 0.0f;
                Time.timeScale    = 1.0f;
                pauseTextGO.SetActive(false);
                IsGamePaused = false;
            }
        }
    }
コード例 #28
0
    private void UpdateInputs()
    {
        if (this.m_Player.GetRotationBlocked())
        {
            return;
        }
        this.m_Inputs.m_Vertical   = 0f;
        this.m_Inputs.m_Horizontal = 0f;
        if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Forward))
        {
            this.m_Inputs.m_Vertical = 1f;
        }
        else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Backward))
        {
            this.m_Inputs.m_Vertical = -1f;
        }
        if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Left))
        {
            this.m_Inputs.m_Horizontal = -1f;
        }
        else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Right))
        {
            this.m_Inputs.m_Horizontal = 1f;
        }
        Vector2 lookInput = InputHelpers.GetLookInput(this.m_LookSensitivityX, this.m_LookSensitivityY, 150f);

        this.m_Inputs.m_MouseX = lookInput.x;
        this.m_Inputs.m_MouseY = lookInput.y;
    }
コード例 #29
0
    private void UpdateState()
    {
        switch (this.m_State)
        {
        case BlowpipeController.State.Idle:
            if (!this.m_Loaded && this.HasArrows())
            {
                this.SetState(BlowpipeController.State.Load);
                return;
            }
            break;

        case BlowpipeController.State.Aim:
            if (!InputsManager.Get().IsActionActive(InputsManager.InputAction.BlowpipeAim))
            {
                this.SetState(BlowpipeController.State.Idle);
            }
            break;

        case BlowpipeController.State.Shot:
            break;

        default:
            return;
        }
    }
コード例 #30
0
    public void UpdatePadCursor(float speed_mul = 1f)
    {
        if (!GreenHellGame.IsPadControllerActive())
        {
            return;
        }
        Vector2 vector = new Vector2(InputsManager.Get().GetActionValue(InputsManager.InputAction.LookRight) - InputsManager.Get().GetActionValue(InputsManager.InputAction.LookLeft), InputsManager.Get().GetActionValue(InputsManager.InputAction.LookUp) - InputsManager.Get().GetActionValue(InputsManager.InputAction.LookDown));

        vector.x = CJTools.Math.GetProportionalClamp(this.m_ControllerCursorDeadZone, 1f, System.Math.Abs(vector.x), 0f, 1f) * (float)System.Math.Sign(vector.x);
        vector.y = CJTools.Math.GetProportionalClamp(this.m_ControllerCursorDeadZone, 1f, System.Math.Abs(vector.y), 0f, 1f) * (float)System.Math.Sign(vector.y);
        if (vector == Vector2.zero)
        {
            return;
        }
        float magnitude = vector.magnitude;

        if (magnitude > 1f)
        {
            vector /= magnitude;
        }
        float num  = (float)Screen.height / 1080f;
        float num2 = this.m_ControllerCursorSpeedCurve.Evaluate(vector.magnitude);

        vector *= num2 * this.m_ControllerCursorSpeed * num * Time.deltaTime * speed_mul;
        this.m_LocalCursorPos  += vector;
        this.m_LocalCursorPos.x = Mathf.Clamp(this.m_LocalCursorPos.x, 0f, (float)Screen.width);
        this.m_LocalCursorPos.y = Mathf.Clamp(this.m_LocalCursorPos.y, 0f, (float)Screen.height);
        this.SetCursorPos(this.m_LocalCursorPos);
    }
コード例 #31
0
    void Awake()
    {
        if (Instance != null)
        {
            if (Instance != this)
                Destroy(this);
            return;
        }

        Instance = this;

        m_pAllSelectables = new List<SelectableEntity>();
        foreach(SelectableEntity tEntity in FindObjectsOfType<SelectableEntity>())
            m_pAllSelectables.Add(tEntity);

        m_pCurrentSelection = new List<SelectableEntity>();
    }