From 745e2fa1e4220956138d0fb726d6a930be8766fa Mon Sep 17 00:00:00 2001 From: teascade Date: Wed, 14 Aug 2019 21:35:06 +0300 Subject: [PATCH] Fix gun bobbing in hand --- Assets/Prefabs/Guns/Revolver.prefab | 1 + Assets/Scripts/Guns/Gun.cs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Assets/Prefabs/Guns/Revolver.prefab b/Assets/Prefabs/Guns/Revolver.prefab index 18b60e0..e74bb6b 100644 --- a/Assets/Prefabs/Guns/Revolver.prefab +++ b/Assets/Prefabs/Guns/Revolver.prefab @@ -130,6 +130,7 @@ MonoBehaviour: Sprite: {fileID: 4462327695001662280} BulletHole: {fileID: 427857587156450783} Cooldown: 0.2 + Bobbing: {fileID: 3522608540502111974} --- !u!114 &3522608540502111974 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Guns/Gun.cs b/Assets/Scripts/Guns/Gun.cs index da7ea65..8ca079d 100644 --- a/Assets/Scripts/Guns/Gun.cs +++ b/Assets/Scripts/Guns/Gun.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; using Saltosion.OneWeapon.Player; +using Saltosion.OneWeapon.Effects; namespace Saltosion.OneWeapon.Guns { public class Gun : MonoBehaviour { @@ -10,6 +11,7 @@ namespace Saltosion.OneWeapon.Guns { public SpriteRenderer Sprite; public Transform BulletHole; public float Cooldown = 0.5f; + public Bobbing Bobbing; private bool IsHeld = false; private float CurrCooldown = 0; @@ -27,9 +29,10 @@ namespace Saltosion.OneWeapon.Guns { PlayerController Player = collision.collider.GetComponent(); if (Player != null) { IsHeld = true; - Player.SetGun(this); + Bobbing.BobbingMultiplier = 0; Destroy(GetComponent()); Destroy(GetComponent()); + Player.SetGun(this); } }