-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRCC_APIExample.cs
More file actions
53 lines (34 loc) · 1.35 KB
/
Copy pathRCC_APIExample.cs
File metadata and controls
53 lines (34 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///<summary>
/// An example script to show how the RCC API works.
///</summary>
public class RCC_APIExample : MonoBehaviour {
public RCC_CarControllerV3 spawnVehiclePrefab; // Vehicle prefab we gonna spawn.
private RCC_CarControllerV3 currentVehiclePrefab; // Spawned vehicle.
public Transform spawnTransform; // Spawn transform.
public bool playerVehicle; // Spawn as a player vehicle?
public bool controllable; // Spawn as controllable vehicle?
public bool engineRunning; // Spawn with running engine?
public void Spawn(){
// Spawning the vehicle with given settings.
currentVehiclePrefab = RCC.SpawnRCC (spawnVehiclePrefab, spawnTransform.position, spawnTransform.rotation, playerVehicle, controllable, engineRunning);
}
public void SetPlayer(){
// Registers the vehicle as player vehicle.
RCC.RegisterPlayerVehicle (currentVehiclePrefab);
}
public void SetControl(bool control){
// Enables / disables controllable state of the vehicle.
RCC.SetControl (currentVehiclePrefab, control);
}
public void SetEngine(bool engine){
// Starts / kills engine of the vehicle.
RCC.SetEngine (currentVehiclePrefab, engine);
}
public void DeRegisterPlayer(){
// Deregisters the vehicle from as player vehicle.
RCC.DeRegisterPlayerVehicle ();
}
}