When controlling the game using the controller, i can open the inventory using the button.
When I select an item from my inventory, it triggers a method that is subscribed to the delegate
AC.EventManager.OnInventorySelect + = OnInventorySelect in which I change the position of the tooltip and set the cursor to the slot position:
private void OnInventorySelect(AC.InvItem invItem)
{
_hotspotTooltipMenu.uiPositionType = UIPositionType.FollowCursor;
SetCursorToInventorySlot(invItem);
}
private void SetCursorToInventorySlot(InvItem invItem)
{
Button slot = GetInventorySlotUIButtonWithItem(invItem);
KickStarter.playerInput.SetSimulatedCursorPosition(slot.transform.position);
}
At the same time on the old position of the cursor icon “blinking” with the selected object. As it turned out, this is due to the fact that the value changes only for the variable xboxCursor, while the value of the variable mousePosition (in PlayerInput) remains unchanged until the next frame.
Are both of these variables necessary, even though they essentially mean the same thing? Maybe you need to leave only one variable and work only with it?
If there is still a need for these two variables at the same time, may be necessary to add more consistency between them? Because at the moment the flashing of the icon can be fixed only by assigning the variable mousePosition of the same value as the xboxCursor:
PlayerInput.cs:882
public void SetSimulatedCursorPosition (Vector2 newPosition)
{
xboxCursor = mousePosition = newPosition;
}
Video with issue -
http://take.ms/V83QU
Comments