mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 12:33:02 +00:00
36 lines
801 B
C#
36 lines
801 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) && GameManager.CanPlayerReadInput())
|
|
{
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|