Beispiel #1
0
    public void OnLook(InputContext value)
    {
        var turn = value.ReadValue <Vector2>();

        inputTurn.x = -turn.y;
        inputTurn.y = turn.x;
    }
        private void OnMovementStart(CallbackContext obj)
        {
            MovementAxis = obj.ReadValue <Vector2>();

            RawInputX = (MovementAxis.x * Vector2.right).normalized.x;
            RawInputY = (MovementAxis.y * Vector2.up).normalized.y;
        }
Beispiel #3
0
 private void Jump_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (IsShowingDead)
     {
         HideScreen();
     }
 }
Beispiel #4
0
 private void CallTerminateBuild(Context ctx)
 {
     if (ctx.ReadValue <float>() > .25f)
     {
         WorldBuilderManager.Instance.TurnBuildModeAndSubModeOffRecursive();
     }
 }
 // Cancel
 public void OnAction0(UnityInput.InputAction.CallbackContext context)
 {
     if (!context.performed)
     {
         Game.Instance.HandleAction0(this);
     }
 }
Beispiel #6
0
        public void OnCursorMove(UnityInput.InputAction.CallbackContext context)
        {
            //Vector3 value = context.ReadValue<Vector2>();

            //if (!UI.HUD.Instance.Inventory.IsEnabled)
            //{
            //    RaycastHit hit;
            //    var ray = World.Room.Instance.Camera.Camera.ScreenPointToRay(Input.mousePosition);

            //    //Debug.Log(pos);

            //    if (Physics.Raycast(ray, out hit))
            //    {
            //        var pos = hit.point;
            //        pos.y = _character.Transform.position.y;


            //        var dir = (pos - _character.Transform.position).normalized;

            //        _character.Controller.AxesRight = dir;

            //        // Do something with the object that was hit by the raycast.
            //    }
            //}
        }
 public void OnJumpToPreviousBookmark(UnityEngine.InputSystem.InputAction.CallbackContext context)
 {
     if (context.performed)
     {
         JumpToPreviousBookmark();
     }
 }
 private void Jump_canceled(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (!IsClone)
     {
         Main_Jump(false);
     }
 }
 private void Move_canceled(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (!IsClone)
     {
         Main_Move(0f);
     }
 }
 public void Fire(CallbackContext ctx)
 {
     if (localPlayer.ControlledCharacter.EquipedWeapon != null)
     {
         localPlayer.ControlledCharacter.Shoot();
     }
 }
 private void Jump_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (!IsClone)
     {
         Main_Jump(true);
     }
 }
 private void Accept_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     foreach (var item in actionInputRecievers)
     {
         item.OnAcceptKey();
     }
 }
Beispiel #13
0
 private void Pause_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (pause_menu)
     {
         Toggle();
     }
 }
Beispiel #14
0
 private void OnProceed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (currentDialog != null)
     {
         processNextNode();
     }
 }
Beispiel #15
0
        public void OnFocus(UnityInput.InputAction.CallbackContext context)
        {
            if (_timer == null)
            {
                _timer = new Timer(_focusSwitchLimit, start: false, repeat: false);
                _timer.OnTimeLimitHandler += OnFocusTimesUp;
            }

            if (context.ReadValue <float>() > 0)
            {
                //var pos = Levels.Room.Instance.Camera.Camera.ScreenToWorldPoint(Input.mousePosition);

                //Input.mousePresent

                _character.FocusCycle(true);
                _timer.Reset();
                _timer.Stop();
            }
            else
            {
                if (!_timer.IsActive)
                {
                    _timer.Resume();
                }
            }
        }
 private void Drop_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (!IsClone)
     {
         Main_Drop();
     }
 }
Beispiel #17
0
 public void OnAxesLeft(UnityInput.InputAction.CallbackContext context)
 {
     //if (!UI.HUD.Instance.Inventory.IsEnabled)
     {
         _character.Controller.AxesLeft = Vector2.ClampMagnitude(context.ReadValue <Vector2>(), 1);
     }
 }
Beispiel #18
0
 void Heal_Performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (PauseMenu.gameIsPaused == false)
     {
         if (shrinkingcircalRectTransform.sizeDelta.x <= insidecircalRectTransform.sizeDelta.x && shrinkingcircalRectTransform.sizeDelta.y <= insidecircalRectTransform.sizeDelta.y)
         {
             hp.Health += 1;
             if (hp.Health == hp.maxHeath)
             {
                 healingState(healing);
             }
             //alows to heal up to max health
             else
             {
                 shrinkingcircalRectTransform.sizeDelta = gameObject.GetComponent <circalShrinking>().startsize;
                 shrinkingcircal.GetComponent <circalShrinking>().shrickSpeed += shrinkSpeedMod;
             }
         }
         else
         {
             //otherwhise activates/deactivates healing
             if (healing == false)
             {
                 healingState(healing);
             }
             else
             {
                 healingState(healing);
             }
         }
     }
 }
    void Onclick(UnityEngine.InputSystem.InputAction.CallbackContext context)
    {
        Interactable hoverInteract = RaycastManager.instance.GetHoveringObjectInteract();

        if (hoverInteract == null)
        {
            if (holdingFreeObj != null && holdingPlacementGhost.activeSelf)
            {
                tweenObject(holdingFreeObj.gameObject, holdingPlacementGhost.transform.position, Quaternion.identity);
                holdingFreeObj.SetRigidbodyKinematic(false);
                holdingFreeObj.transform.parent = freeObjectParent;
                holdingFreeObj = null;
                Destroy(holdingPlacementGhost);
            }
            return;
        }
        if (hoverInteract.interactType() == Interactable.InteractType.freeObject)
        {
            FreeObj hoverFreeobj = (FreeObj)hoverInteract;
            if (holdingFreeObj != null)
            {
                tweenObject(holdingFreeObj.gameObject, hoverFreeobj.transform.position + new Vector3(0, 0.05f, 0), hoverFreeobj.transform.rotation);
                holdingFreeObj.SetRigidbodyKinematic(false);
                holdingFreeObj.transform.parent = freeObjectParent;
            }
            holdingFreeObj = hoverFreeobj;
            changePlacementGhost(holdingFreeObj.gameObject);
            tweenObject(holdingFreeObj.gameObject, holdTrans);
            holdingFreeObj.SetRigidbodyKinematic(true);
            holdingFreeObj.transform.parent = holdTrans;
        }
    }
Beispiel #20
0
 public void Pause(UnityEngine.InputSystem.InputAction.CallbackContext _ctx)
 {
     if (gameStarted)
     {
         Pause(playTimer);
     }
 }
Beispiel #21
0
 private void Shoot_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (textObj != null)
     {
         if (!launched)
         {
             launched = true;
             //textObj.GetComponent<FixedJoint2D>().connectedBody = null;
             textObj.GetComponent <FixedJoint2D>().enabled = false;
             Rigidbody2D r = textObj.GetComponent <Rigidbody2D>();
             r.simulated    = true;
             r.gravityScale = .5f;
             r.AddForce(-textObj.transform.up * 5, ForceMode2D.Impulse);
         }
         else
         {
             split();
         }
     }
     else
     {
         textObj = Instantiate(sentencePrefab, spawnPos.position + new Vector3(0, -1), Quaternion.identity);
         textObj.GetComponent <FixedJoint2D>().connectedBody = spawnerRoot.GetComponent <Rigidbody2D>();
         textObj.GetComponent <Rigidbody2D>().gravityScale   = 0;
     }
 }
Beispiel #22
0
 private void Fire(UnityEngine.InputSystem.InputAction.CallbackContext ctx)
 {
     if (ctx.ReadValue <float>() < 0.5)
     {
         return;
     }
 }
Beispiel #23
0
 private void OnPause(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (!Interrupt.IsInterrupted())
     {
         Toggle();
     }
 }
 public void OnReturn(UnityEngine.InputSystem.InputAction.CallbackContext value)
 {
     if (value.performed)
     {
         debugConsole.OnReturn();
     }
 }
Beispiel #25
0
 public void OnCreateNewBookmark(UnityEngine.InputSystem.InputAction.CallbackContext context)
 {
     if (context.performed)
     {
         PersistentUI.Instance.ShowInputBox("Enter the name of this new Bookmark.", HandleNewBookmarkName, "New Bookmark");
     }
 }
Beispiel #26
0
    public void Skip(UnityEngine.InputSystem.InputAction.CallbackContext _ctx)
    {
        // Exit if input is wrong
        if (!_ctx.performed)
        {
            return;
        }

        // Call to stop the displayed line
        NullPlay();

        // If the line is complete
        if (shownLine.maxVisibleCharacters == shownLine.text.Length)
        {
            // If there is another line in the dialogue go to next line
            if (dialogue.Texts.Count - 1 > currentLine)
            {
                NextLine();
            }

            // If there is no other line in the dialogue go to next dialogue
            else
            {
                NextDialoge();
            }
        }
        // End the line
        else
        {
            EndLine();
        }
    }
Beispiel #27
0
 private void Inventory_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
 {
     if (uiManager.CanToggleInventory())
     {
         GameManager.singleton.Paused = uiManager.ToggleInventory();
     }
 }
Beispiel #28
0
 public void OnHotBarActionCurrent(UnityInput.InputAction.CallbackContext context)
 {
     //if (UI.HUD.Instance.HotBar.CurrentAbility != null)
     //{
     //    _character.TryUseAbility(UI.HUD.Instance.HotBar.CurrentAbility);
     //}
 }
    private void Navigate_performed(UnityEngine.InputSystem.InputAction.CallbackContext obj)
    {
        if (!PauseMenu.gameIsPaused)
        {
            return;
        }
        Vector2 input = obj.ReadValue <Vector2>();

        if (input.y == 1)
        {
            if (index > 0)
            {
                index--;
            }
            else
            {
                index = maxIndex;
            }
        }
        else if (input.y == -1)
        {
            if (index < maxIndex)
            {
                index++;
            }
            else
            {
                index = 0;
            }
        }
    }
Beispiel #30
0
 public void QuitGame(UnityEngine.InputSystem.InputAction.CallbackContext input)
 {
     if (input.performed)
     {
         Application.Quit();
     }
 }