/// <summary>Takes a shot. If a surface is hit, a decal is spawned. If a player is, the player takes damage.</summary> /// <param name="_shootOrigin">The origin where the shot will be originated.</param> /// <param name="_shootDirection">The vector that the shot will travel.</param> public void RayShoot(Transform _shootOrigin, Vector3 _shootDirection) { if (Physics.Raycast(_shootOrigin.position, _shootDirection, out RaycastHit _hit, 999f)) { if (_hit.collider.CompareTag("Player")) { _hit.collider.GetComponent <Player>().TakeDamage(damagePerShot, holdedByPlayer); } else { ServerSend.ApplyDecal(_hit.point, Quaternion.FromToRotation(Vector3.forward, _hit.normal)); } } }