mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
Send crouch button event
This commit is contained in:
parent
9f64097b5e
commit
669daa23be
6 changed files with 21 additions and 3 deletions
|
@ -99,6 +99,8 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
{
|
||||
if (m_isServer)
|
||||
m_ped.SwitchState<CrouchState>();
|
||||
else
|
||||
base.OnCrouchButtonPressed();
|
||||
}
|
||||
|
||||
public override void OnFlyButtonPressed ()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using UnityEngine;
|
||||
using SanAndreasUnity.Utilities;
|
||||
using SanAndreasUnity.Net;
|
||||
|
||||
namespace SanAndreasUnity.Behaviours.Peds.States
|
||||
{
|
||||
|
@ -16,6 +17,7 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
protected new Transform transform { get { return m_ped.transform; } }
|
||||
public bool IsActiveState { get { return m_ped.CurrentState == this; } }
|
||||
protected bool m_isServer { get { return Net.NetStatus.IsServer; } }
|
||||
protected bool m_shouldSendButtonEvents { get { return !m_isServer && m_ped.IsControlledByLocalPlayer; } }
|
||||
|
||||
|
||||
|
||||
|
@ -229,7 +231,8 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
public virtual void OnCrouchButtonPressed()
|
||||
{
|
||||
|
||||
if (m_shouldSendButtonEvents)
|
||||
PedSync.Local.OnCrouchButtonPressed();
|
||||
}
|
||||
|
||||
public virtual void OnNextWeaponButtonPressed()
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
{
|
||||
if (m_isServer)
|
||||
m_ped.SwitchState<StandState>();
|
||||
else
|
||||
base.OnCrouchButtonPressed();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
|
||||
if (m_isServer)
|
||||
m_ped.SwitchState<StandState>();
|
||||
else
|
||||
base.OnCrouchButtonPressed();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,5 +58,14 @@ namespace SanAndreasUnity.Net
|
|||
|
||||
}
|
||||
|
||||
public void OnCrouchButtonPressed() => this.CmdOnCrouchButtonPressed();
|
||||
|
||||
[Command]
|
||||
void CmdOnCrouchButtonPressed()
|
||||
{
|
||||
if (m_ped)
|
||||
m_ped.OnCrouchButtonPressed();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
- order of buttons in main menu
|
||||
|
||||
- send input to server
|
||||
- adapt states:
|
||||
|
||||
- adapt states: jump, crouch, roll,
|
||||
- send button input events to server: crouch,
|
||||
|
||||
- stats window
|
||||
|
||||
|
|
Loading…
Reference in a new issue