Basic Recoil

This commit is contained in:
juliuse98
2021-11-07 16:29:21 +01:00
parent 360ceb55f3
commit 352e22225f
6 changed files with 186 additions and 50 deletions

View File

@@ -8,6 +8,7 @@ public class Shoot : NetworkBehaviour
[SerializeField] GameObject muzzle;
[SerializeField] ShootAnimation shootAnim;
[SerializeField] float fireRate;
[SerializeField] GameObject gunHoldPos;
private void Start()
{
@@ -38,6 +39,7 @@ public class Shoot : NetworkBehaviour
shootAnimation();
if (Physics.Raycast(muzzle.transform.position, muzzle.transform.forward, out hit))
{
if (hit.transform.gameObject.GetComponent<Player>() != null)
@@ -53,7 +55,7 @@ public class Shoot : NetworkBehaviour
// This code will be executed on the Client.
void shootAnimation()
{
shootAnim.StartShootAnimation(fireRate);
//shootAnim.StartShootAnimation(fireRate);
shootAnim.recoil(gunHoldPos,0.1f);
}
}