void Update() { Collider[] hits = Physics.OverlapSphere(transform.position, 10.0f); foreach (Collider col in hits) { if (col.transform.gameObject.name == "Person") { if (ControlerWrapper.Get().X_Hit(0)) { note.SetActive(!note.activeInHierarchy); } } } if (hits.Length == 0) { if (ControlerWrapper.Get().X_Hit(0) || ControlerWrapper.Get().X_Hold(0)) { if (note.activeInHierarchy == true) { note.SetActive(false); } } } }
void Update() { Vector2 ControllerInputAxis = ControlerWrapper.Get().GetRightStick(PlayerIndex.One); if (axes == RotationAxes.MouseXAndY) { float rotationX = transform.localEulerAngles.y + ControllerInputAxis.x * sensitivityX; rotationY += ControllerInputAxis.y * sensitivityY; rotationY = Mathf.Clamp(rotationY, minimumY, maximumY); transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); } else if (axes == RotationAxes.MouseX) { transform.Rotate(0, ControllerInputAxis.x * sensitivityX, 0); } else { rotationY += ControllerInputAxis.y * sensitivityY; rotationY = Mathf.Clamp(rotationY, minimumY, maximumY); transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0); } }
void LateUpdate() { if (m_Item != null) { if (m_amHolding && m_Item.m_bIsHeld && m_bIsActionReady) { if (ControlerWrapper.Get().X_Hit(0) && tag == "Person") { DropItem(tag); } if (Input.GetMouseButton(1) && tag == "Pet") { DropItem(tag); } } } }
// Update is called once per frame void Update() { // Get the input vector from keyboard or analog stick Vector3 directionVector = new Vector3(ControlerWrapper.Get().GetLeftStick(XInputDotNetPure.PlayerIndex.One).x, 0, ControlerWrapper.Get().GetLeftStick(XInputDotNetPure.PlayerIndex.One).y); //directionVector.x += Input.GetAxis("Horizontal"); //directionVector.z += Input.GetAxis("Vertical"); if (directionVector != Vector3.zero) { // Get the length of the directon vector and then normalize it // Dividing by the length is cheaper than normalizing when we already have the length anyway float directionLength = directionVector.magnitude; directionVector = directionVector / directionLength; // Make sure the length is no bigger than 1 directionLength = Mathf.Min(1, directionLength); // Make the input vector more sensitive towards the extremes and less sensitive in the middle // This makes it easier to control slow speeds when using analog sticks directionLength = directionLength * directionLength; // Multiply the normalized direction vector by the modified length directionVector = directionVector * directionLength; } if (ControlerWrapper.Get().A_Hit(0)) { motor.inputJump = true; } else { motor.inputJump = false; } // if (Input.GetButton("Fire1")) // { // BroadcastMessage("Shoot", SendMessageOptions.DontRequireReceiver); // } // Apply the direction to the CharacterMotor motor.inputMoveDirection = transform.rotation * directionVector; }
public void Notified(Pickup item) { print("Can Pick Up"); if (tag == "Person") { if (ControlerWrapper.Get().X_Hold(0) && m_bIsActionReady) { PickUpItem(item); } } if (tag == "Pet") { //Right Click if (Input.GetMouseButton(1)) { PickUpItem(item); } } }
void Update() { if (freeze || !PlayerWeapons.canLook || individualFreeze) { return; } Quaternion xQuaternion; Quaternion yQuaternion; float offsetVal; Vector2 ControllerInputAxis = ControlerWrapper.Get().GetRightStick(PlayerIndex.One); if (axes == RotationAxes.MouseX) { rotationX += ControllerInputAxis.x * sensitivityX; float xDecrease; if (totalOffsetX > 0) { xDecrease = Mathf.Clamp(resetSpeed * Time.deltaTime, 0, totalOffsetX); } else { xDecrease = Mathf.Clamp(resetSpeed * -Time.deltaTime, totalOffsetX, 0); } if (resetDelay > 0) { xDecrease = 0; resetDelay = Mathf.Clamp(resetDelay - Time.deltaTime, 0, resetDelay); } if (Random.value < .5) { offsetX *= -1; } if ((totalOffsetX < maxKickback && totalOffsetX >= 0) || (totalOffsetX > -maxKickback && totalOffsetX <= 0)) { totalOffsetX += offsetX; } else { //offsetX = 0; resetDelay *= .5f; } rotationX = ClampAngle(rotationX, minimumX, maximumX) + offsetX - xDecrease; if ((ControllerInputAxis.x * sensitivityX) < 0) { totalOffsetX += ControllerInputAxis.x * sensitivityX; } rotationX += Mathf.Sin(Time.time) * idleSway; totalOffsetX -= xDecrease; if (totalOffsetX < 0) { totalOffsetX = 0; } xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up); tRotation = originalRotation * xQuaternion; offsetVal = Mathf.Clamp(totalOffsetX * smoothFactor, 1, smoothFactor); if (smooth) { transform.localRotation = Quaternion.Slerp(transform.localRotation, tRotation, Time.deltaTime * 25 / smoothFactor * offsetVal); } else { transform.localRotation = tRotation; } } else { //ControlerWrapper.Get().GetLeftStick(XInputDotNetPure.PlayerIndex).y rotationY += ControllerInputAxis.y * sensitivityY; float yDecrease = Mathf.Clamp(resetSpeed * Time.deltaTime, 0, totalOffsetY); if (resetDelay > 0) { yDecrease = 0; resetDelay = Mathf.Clamp(resetDelay - Time.deltaTime, 0, resetDelay); } if (totalOffsetY < maxKickback) { totalOffsetY += offsetY; } else { offsetY = 0; resetDelay *= .5f; } rotationY = ClampAngle(rotationY, minimumY, maximumY) + offsetY - yDecrease; if ((ControllerInputAxis.y * sensitivityY) < 0) { totalOffsetY += ControllerInputAxis.y * sensitivityY; } rotationY += Mathf.Sin(Time.time) * idleSway; totalOffsetY -= yDecrease; if (totalOffsetY < 0) { totalOffsetY = 0; } yQuaternion = Quaternion.AngleAxis(rotationY, Vector3.left); tRotation = originalRotation * yQuaternion; offsetVal = Mathf.Clamp(totalOffsetY * smoothFactor, 1, smoothFactor); Vector3 tempEulerAngle = transform.localEulerAngles; if (smooth) { tempEulerAngle.x = Quaternion.Slerp(transform.localRotation, tRotation, Time.deltaTime * 25 / smoothFactor * offsetVal).eulerAngles.x; transform.localEulerAngles = tempEulerAngle; } else { tempEulerAngle.x = tRotation.x; transform.localEulerAngles = tempEulerAngle; } } offsetY = 0; offsetX = 0; }
void Awake() { padCurrent = new GamePadState[4]; padLast = new GamePadState[4]; s_theInput = this; }