summaryrefslogtreecommitdiff
path: root/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Weapons.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SurvivalTest/Assets/Scripts/Managers/PlayerManager_Weapons.cs')
-rw-r--r--SurvivalTest/Assets/Scripts/Managers/PlayerManager_Weapons.cs27
1 files changed, 19 insertions, 8 deletions
diff --git a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Weapons.cs b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Weapons.cs
index 9a0f9db..16f9396 100644
--- a/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Weapons.cs
+++ b/SurvivalTest/Assets/Scripts/Managers/PlayerManager_Weapons.cs
@@ -12,9 +12,20 @@ public partial class PlayerManager : Singleton<PlayerManager>
public bool isFire { get; private set; }
- public bool autoFire {get{return m_AutoFire;}}
private bool m_AutoFire;
- private float m_AutoFireDuration = 0.8f;
+ public bool autoFire
+ {
+ get
+ {
+ return m_AutoFire;
+ }
+ set
+ {
+ m_AutoFire = value;
+ EventCenter.Instance.Publish(EventMsgType.ToggleAutoFire, null);
+ }
+ }
+ private float autoFireDuration = 0.8f;
public bool lockAim { get; set; }
@@ -29,7 +40,7 @@ public partial class PlayerManager : Singleton<PlayerManager>
m_Weapons.Add(new Weapon_TeslaCoil());
m_Weapons.Add(new Weapon_MightyGlove());
- m_AutoFire = false;
+ autoFire = false;
m_LastAxisValue = Input.GetAxisRaw("GunTrigger");
}
@@ -54,26 +65,26 @@ public partial class PlayerManager : Singleton<PlayerManager>
if (Input.GetButtonDown("Fire1") || (axis == 1 && m_LastAxisValue != 1))
{
- if(m_AutoFire)
+ if(autoFire)
{
- m_AutoFire = false;
+ autoFire = false;
}
isFire = true;
RunFireCoroutine(true);
}
- if (!m_AutoFire && !Input.GetButton("Fire1") && (axis == 0 && m_LastAxisValue != 0))
+ if (!autoFire && !Input.GetButton("Fire1") && (axis == 0 && m_LastAxisValue != 0))
{
if (TinyCountDown.Instance.Get("ReleaseFire") > 0)
{
- m_AutoFire = true;
+ autoFire = true;
isFire = true;
RunFireCoroutine(true);
}
else
{
- TinyCountDown.Instance.Set("ReleaseFire", m_AutoFireDuration);
+ TinyCountDown.Instance.Set("ReleaseFire", autoFireDuration);
isFire = false;
RunFireCoroutine(false);
}