summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs')
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
index 3e21c56..a0a595a 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Equips.cs
@@ -12,10 +12,15 @@ public partial class PlayerManager : Singleton<PlayerManager>
public bool isFire { get; private set; }
+ private bool m_AutoFire;
+ private float m_AutoFireDuration = 1f;
+
void InitEquips()
{
m_Equips.Add(new Equip_Gun());
m_Equips.Add(new Equip_GrenadeLauncher());
+
+ m_AutoFire = false;
}
/// <summary>
@@ -34,16 +39,25 @@ public partial class PlayerManager : Singleton<PlayerManager>
/// </summary>
void CheckInput()
{
- if (Input.GetButtonDown("Fire1") || (Input.GetAxis("GunTrigger") == 1))
+ if (Input.GetButtonDown("Fire1") || (Input.GetAxisRaw("GunTrigger") == 1))
{
+ if(m_AutoFire)
+ {
+ m_AutoFire = false;
+ }
+ if(TinyCountDown.Instance.Get("ReleaseFire") > 0)
+ {
+ m_AutoFire = true;
+ }
isFire = true;
if (m_CoFire == null)
{
m_CoFire = GameApp.Instance.StartCoroutine(coFire());
}
}
- if (!Input.GetButton("Fire1") && (Input.GetAxis("GunTrigger") == 0))
+ if (!m_AutoFire && !Input.GetButton("Fire1") && (Input.GetAxisRaw("GunTrigger") == 0))
{
+ TinyCountDown.Instance.Set("ReleaseFire", m_AutoFireDuration);
isFire = false;
if (m_CoFire != null)
{