Exemplo n.º 1
0
        void DragBoxInput(GameObject hitObject, vTriggerDragable triggerDraggable, string _input)
        {
            var dragConditions = hitObject != null && triggerDraggable != null;

            // input to call the action for mobile
            if (inputType == InputType.Mobile)
            {
                if (CrossPlatformInputManager.GetButtonDown(_input) && !actions && dragConditions && draggableBox == null)
                {
                    DragBox(hitObject, triggerDraggable);
                }
                else if (CrossPlatformInputManager.GetButtonDown(_input) && !actions && draggableBox != null)
                {
                    DropBox();
                }
            }
            // input to call the action for pc/gamepad
            else
            {
                if (Input.GetButtonDown(_input) && !actions && dragConditions && draggableBox == null)
                {
                    DragBox(hitObject, triggerDraggable);
                }
                else if (Input.GetButtonDown(_input) && !actions && draggableBox != null)
                {
                    DropBox();
                }
            }
        }
        public void DragBox(GameObject hitObject, vTriggerDragable triggerDraggable)
        {
            // align the character rotation with the object rotation
            var rot = hitObject.transform.rotation;

            transform.rotation = rot;
            // reset any other animation state to null
            animator.SetTrigger("ResetState");
            // set the player to strafe mode
            strafing = true;
            // set the gameobject to drag
            triggerDraggable.box.SetInDrag(true);
            draggableBox = triggerDraggable;
        }
 public void DropBox()
 {
     if (hud != null)
     {
         hud.HideDragBoxText();
     }
     strafing       = false;
     dragStart      = false;
     canMoveForward = true;
     canMoveRight   = true;
     canMoveLeft    = true;
     canMoveBack    = true;
     draggableBox.box.SetInDrag(false);
     draggableBox = null;
 }