public void Drop() { PlayerScript lps = PlayerManager.LocalPlayerScript; if (!lps || lps.canNotInteract()) { return; } UI_ItemSlot currentSlot = UIManager.Hands.CurrentSlot; Vector3 dropPos = lps.gameObject.transform.position; if (!currentSlot.CanPlaceItem()) { return; } // if ( isNotMovingClient(lps) ) // { // // Full client simulation(standing still) // var placedOk = currentSlot.PlaceItem(dropPos); // if ( !placedOk ) // { // Debug.Log("Client dropping error"); // } // } // else // { //Only clear slot(while moving, as prediction is shit in this situation) currentSlot.Clear(); // } //Message lps.playerNetworkActions.DropItem(currentSlot.eventName); SoundManager.Play("Click01"); Debug.Log("Drop Button"); }
/// Throw mode toggle. Actual throw is in /// <see cref="InputController.CheckThrow()"/> public void Throw() { PlayerScript lps = PlayerManager.LocalPlayerScript; UI_ItemSlot currentSlot = UIManager.Hands.CurrentSlot; if (!lps || lps.canNotInteract() || !currentSlot.CanPlaceItem()) { UIManager.IsThrow = false; throwImage.sprite = throwSprites[0]; return; } SoundManager.Play("Click01"); // Logger.Log("Throw Button"); if (!UIManager.IsThrow) { UIManager.IsThrow = true; throwImage.sprite = throwSprites[1]; } else { UIManager.IsThrow = false; throwImage.sprite = throwSprites[0]; } }
public void Drop() { PlayerScript lps = PlayerManager.LocalPlayerScript; if (!lps || lps.canNotInteract()) { return; } UI_ItemSlot currentSlot = UIManager.Hands.CurrentSlot; Vector3 dropPos = lps.gameObject.transform.position; if (!currentSlot.CanPlaceItem()) { return; } // if ( isNotMovingClient(lps) ) // { // // Full client simulation(standing still) // var placedOk = currentSlot.PlaceItem(dropPos); // if ( !placedOk ) // { // Debug.Log("Client dropping error"); // } // } // else // { //Only clear slot(while moving, as prediction is shit in this situation) GameObject dropObj = currentSlot.Item; CustomNetTransform cnt = dropObj.GetComponent <CustomNetTransform>(); //It is converted to LocalPos in transformstate struct cnt.AppearAtPosition(PlayerManager.LocalPlayer.transform.position); currentSlot.Clear(); // } //Message lps.playerNetworkActions.RequestDropItem(currentSlot.eventName, false); SoundManager.Play("Click01"); Debug.Log("Drop Button"); }