mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-17 05:18:27 +00:00
48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Mirror;
|
|
using System.Linq;
|
|
using SanAndreasUnity.Utilities;
|
|
using SanAndreasUnity.Behaviours;
|
|
|
|
namespace SanAndreasUnity.Net
|
|
{
|
|
public class PedSync : NetworkBehaviour
|
|
{
|
|
Player m_player;
|
|
Ped m_ped { get { return m_player.OwnedPed; } }
|
|
|
|
|
|
void Awake()
|
|
{
|
|
m_player = this.GetComponentOrThrow<Player>();
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
public void SendInput(bool isWalkOn, bool isRunOn, bool isSprintOn, Vector3 movementInput, bool isJumpOn)
|
|
{
|
|
this.CmdSendingInput(isWalkOn, isRunOn, isSprintOn, movementInput, isJumpOn);
|
|
}
|
|
|
|
[Command]
|
|
void CmdSendingInput(bool isWalkOn, bool isRunOn, bool isSprintOn, Vector3 movementInput, bool isJumpOn)
|
|
{
|
|
if (null == m_ped)
|
|
return;
|
|
|
|
Ped ped = m_ped;
|
|
|
|
ped.IsWalkOn = isWalkOn;
|
|
ped.IsRunOn = isRunOn;
|
|
ped.IsSprintOn = isSprintOn;
|
|
ped.Movement = movementInput;
|
|
ped.IsJumpOn = isJumpOn;
|
|
|
|
}
|
|
|
|
}
|
|
}
|