mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-24 11:17:11 +00:00
add it to namespace
This commit is contained in:
parent
3834b41517
commit
8f477c0353
1 changed files with 44 additions and 39 deletions
|
@ -1,56 +1,61 @@
|
|||
using SanAndreasUnity.Behaviours;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIVehicleSpawner : MonoBehaviour
|
||||
namespace SanAndreasUnity.Behaviours
|
||||
{
|
||||
public Vector3 spawnOffset = new Vector3(0, 2, 5);
|
||||
public KeyCode spawnKey = KeyCode.V;
|
||||
|
||||
|
||||
private void Start()
|
||||
public class UIVehicleSpawner : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
||||
public Vector3 spawnOffset = new Vector3(0, 2, 5);
|
||||
public KeyCode spawnKey = KeyCode.V;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(spawnKey))
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (Utilities.NetUtils.IsServer)
|
||||
SpawnVehicle();
|
||||
else if (Net.PlayerRequests.Local != null)
|
||||
Net.PlayerRequests.Local.RequestVehicleSpawn();
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(spawnKey))
|
||||
{
|
||||
if (Utilities.NetUtils.IsServer)
|
||||
SpawnVehicle();
|
||||
else if (Net.PlayerRequests.Local != null)
|
||||
Net.PlayerRequests.Local.RequestVehicleSpawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SpawnVehicle()
|
||||
{
|
||||
var ped = Ped.Instance;
|
||||
public void SpawnVehicle()
|
||||
{
|
||||
var ped = Ped.Instance;
|
||||
|
||||
if (null == ped)
|
||||
return;
|
||||
|
||||
SpawnVehicle(ped);
|
||||
|
||||
}
|
||||
if (null == ped)
|
||||
return;
|
||||
|
||||
SpawnVehicle(ped);
|
||||
|
||||
}
|
||||
|
||||
public void SpawnVehicle(Ped ped)
|
||||
{
|
||||
|
||||
Vector3 pos = ped.transform.position + ped.transform.forward * spawnOffset.z + ped.transform.up * spawnOffset.y
|
||||
+ ped.transform.right * spawnOffset.x;
|
||||
Quaternion rotation = Quaternion.LookRotation(-ped.transform.right, Vector3.up);
|
||||
public void SpawnVehicle(Ped ped)
|
||||
{
|
||||
|
||||
Vector3 pos = ped.transform.position + ped.transform.forward * spawnOffset.z + ped.transform.up * spawnOffset.y
|
||||
+ ped.transform.right * spawnOffset.x;
|
||||
Quaternion rotation = Quaternion.LookRotation(-ped.transform.right, Vector3.up);
|
||||
|
||||
SpawnVehicle(pos, rotation);
|
||||
SpawnVehicle(pos, rotation);
|
||||
|
||||
}
|
||||
|
||||
public void SpawnVehicle(Vector3 pos, Quaternion rotation)
|
||||
{
|
||||
// SanAndreasUnity.Behaviours.Vehicles.VehicleSpawner.Create ();
|
||||
var v = SanAndreasUnity.Behaviours.Vehicles.Vehicle.Create(-1, null, pos, rotation);
|
||||
Debug.Log("Spawned vehicle with id " + v.Definition.Id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SpawnVehicle(Vector3 pos, Quaternion rotation)
|
||||
{
|
||||
// SanAndreasUnity.Behaviours.Vehicles.VehicleSpawner.Create ();
|
||||
var v = SanAndreasUnity.Behaviours.Vehicles.Vehicle.Create(-1, null, pos, rotation);
|
||||
Debug.Log("Spawned vehicle with id " + v.Definition.Id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue