mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-30 07:50:22 +00:00
36 lines
765 B
C#
36 lines
765 B
C#
using SanAndreasUnity.Behaviours;
|
|
using UnityEngine;
|
|
|
|
namespace SanAndreasUnity.Behaviours
|
|
{
|
|
|
|
public class UIVehicleSpawner : MonoBehaviour
|
|
{
|
|
public KeyCode spawnKey = KeyCode.V;
|
|
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown(spawnKey))
|
|
{
|
|
if (Utilities.NetUtils.IsServer)
|
|
SpawnVehicle();
|
|
else if (Net.PlayerRequests.Local != null)
|
|
Net.PlayerRequests.Local.RequestVehicleSpawn(-1);
|
|
}
|
|
}
|
|
|
|
private void SpawnVehicle()
|
|
{
|
|
var ped = Ped.Instance;
|
|
|
|
if (null == ped)
|
|
return;
|
|
|
|
Vehicles.Vehicle.CreateRandomInFrontOf(ped.transform);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|