Fixing networked interaction handler
This commit is contained in:
parent
f553471278
commit
990d992276
@ -49,16 +49,9 @@ namespace Item
|
||||
private float timeSinceLightDuration;
|
||||
public bool IsLightOn => targetingLight.gameObject.activeSelf;
|
||||
|
||||
//private Dictionary<int,float> projectiles = new Dictionary<int, float>();
|
||||
public override void OnStartClient()
|
||||
{
|
||||
base.OnStartClient();
|
||||
|
||||
if (!IsOwner)
|
||||
{
|
||||
this.enabled = false;
|
||||
}
|
||||
}
|
||||
//private Dictionary<int,float> projectiles = new Dictionary<int, float>();
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
|
@ -49,15 +49,15 @@ public class PlayerInteractionHandler : NetworkBehaviour
|
||||
public bool IsCarrying => heavyInvent != null;
|
||||
public bool GunEnabled { get; private set; }
|
||||
|
||||
|
||||
public Transform CarryingPos => carryingPos;
|
||||
private bool inputEnbaled = true;
|
||||
|
||||
public override void OnStartClient()
|
||||
{
|
||||
base.OnStartClient();
|
||||
if (!base.IsOwner)
|
||||
{
|
||||
this.enabled = false;
|
||||
}
|
||||
inputEnbaled = IsOwner;
|
||||
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
@ -87,9 +87,9 @@ public class PlayerInteractionHandler : NetworkBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
if (manager.IsPaused || isDead) return;
|
||||
if ((manager.IsPaused || isDead)&&!inputEnbaled) return;
|
||||
|
||||
if (Input.GetButtonDown("Fire1") || fireDown.IsDown())
|
||||
if ((Input.GetButtonDown("Fire1") || fireDown.IsDown())&&inputEnbaled)
|
||||
{
|
||||
if (GunEnabled)
|
||||
{
|
||||
@ -169,7 +169,7 @@ public class PlayerInteractionHandler : NetworkBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetButtonDown("Fire2"))
|
||||
if (Input.GetButtonDown("Fire2")&&inputEnbaled)
|
||||
{
|
||||
//print(this.GunEnabled);
|
||||
if (!GunEnabled)
|
||||
@ -185,7 +185,7 @@ public class PlayerInteractionHandler : NetworkBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetButtonDown("Fire3"))
|
||||
if (Input.GetButtonDown("Fire3")&&inputEnbaled)
|
||||
if (!IsCarrying)
|
||||
{
|
||||
GunEnabled = !GunEnabled;
|
||||
@ -207,8 +207,8 @@ public class PlayerInteractionHandler : NetworkBehaviour
|
||||
else
|
||||
pistol.aimMode = Item.PistolComponent.AimMode.MODIFIED;
|
||||
}
|
||||
|
||||
shift.SetCenter(!GunEnabled);
|
||||
if(!inputEnbaled)
|
||||
shift.SetCenter(!GunEnabled);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user