/// <summary> /// Try to grab a throwable. /// When grabbed, the object follows the character and can be thrown by this one. /// </summary> /// <param name="_throwable">Throwable to try to grab.</param> /// <returns>Returns true if the throwable was successfully grabbed, false either.</returns> public virtual bool GrabObject(TDS_Throwable _throwable) { // Call this method in master client only if (!PhotonNetwork.isMasterClient) { TDS_RPCManager.Instance.RPCPhotonView.RPC("CallMethodOnline", PhotonTargets.MasterClient, TDS_RPCManager.GetInfo(photonView, GetType(), "GrabObject"), new object[] { _throwable.photonView.viewID }); return(false); } // Take the object if possible if (throwable || !_throwable.PickUp(this)) { return(false); } return(true); }
/// <summary> /// Try to grab a throwable. /// When grabbed, the object follows the character and can be thrown by this one. /// </summary> /// <param name="_throwable">Throwable to try to grab.</param> /// <returns>Returns true if the throwable was successfully grabbed, false either.</returns> public override bool GrabObject(TDS_Throwable _throwable) { // Call this method in master client only if (!PhotonNetwork.isMasterClient) { TDS_RPCManager.Instance.RPCPhotonView.RPC("CallMethodOnline", PhotonTargets.MasterClient, TDS_RPCManager.GetInfo(photonView, GetType(), "GrabObject"), new object[] { _throwable.photonView.viewID }); return(false); } // If currently wearing the maximum amount of throwables he can, return if ((CurrentThrowableAmount == MaxThrowableAmount) || !_throwable.PickUp(this)) { return(false); } return(true); }