public void CmdThrowItem(Vector3 destintation) { Debug.DrawLine(destintation + new Vector3(0.5f, 0, 0.5f), destintation - new Vector3(0.5f, 0, 0.5f), Color.red, 1f); Debug.DrawLine(destintation + new Vector3(-0.5f, 0, 0.5f), destintation - new Vector3(-0.5f, 0, 0.5f), Color.red, 1f); GameObject throwingItemObj = Instantiate(throwingItemPrefab, owner.gameObject.transform.position, Quaternion.identity) as GameObject; ThrowingItem throwingItem = throwingItemObj.GetComponent <ThrowingItem>(); NetworkServer.Spawn(throwingItemObj); throwingItem.Setup(destintation, this.gameObject); }
/// <summary> /// Called before throwing a grenade. /// </summary> /// <param name="ev">The <see cref="ThrowingItemEventArgs"/> instance.</param> public static void OnThrowingItem(ThrowingItemEventArgs ev) => ThrowingItem.InvokeSafely(ev);