C/C++
Скрипт на юнити.
Здравствуйте, пожалуйста подскажите скрипт чтобы можно было сесть в машину при помоши кнопки в юнити 3д.
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SeatCar : MonoBehaviour
{
public GameObject car;
public GameObject cam;
public GameObject person;
public GameObject PlayerCamera;
public GameObject exitcar;
float time = 0.5f;
float newtime = 0.5f;
void Start()
{
}
private void Update()
{
if (car.GetComponent<RCC_CarControllerV3>().enabled == true && CurrentSpeed <= 5)
{
if (time > 0f)
{
time -= Time.deltaTime;
}
if (time <= 0f)
{
if (Input.GetKeyDown(KeyCode.F))
{
var _myscript3 = person.GetComponent<CapsuleCollider>();
_myscript3.enabled = true;
var _myscript4 = person.GetComponent<MeshRenderer>();
_myscript4.enabled = true;
cam.gameObject.SetActive(false);
PlayerCamera.gameObject.SetActive(true);
var _myscript1 = car.GetComponent<RCC_CarControllerV3>();
_myscript1.enabled = false;
person.transform.position = new Vector3(exitcar.transform.position.x, exitcar.transform.position.y, exitcar.transform.position.z);
time = newtime;
}
}
}
}
public float CurrentSpeed
{
get { return car.GetComponent<Rigidbody>().velocity.magnitude * 3.6f; }
}
private void OnTriggerStay(Collider other)
{
if (other.tag == "cars")
{
if (car.GetComponent<RCC_CarControllerV3>().enabled == false)
{
if (Input.GetKeyDown(KeyCode.F))
{
var _myscript4 = GetComponent<MeshRenderer>();
_myscript4.enabled = false;
var _myscript3 = GetComponent<CapsuleCollider>();
_myscript3.enabled = false;
PlayerCamera.gameObject.SetActive(false);
cam.gameObject.SetActive(true);
var _myscript1 = car.GetComponent<RCC_CarControllerV3>();
_myscript1.enabled = true;
}
}
}
}
}
0
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SeatCar : MonoBehaviour
{
public GameObject car;
public GameObject cam;
public GameObject person;
public GameObject PlayerCamera;
public GameObject exitcar;
float time = 0.5f;
float newtime = 0.5f;
void Start()
{
}
private void Update()
{
if (car.GetComponent<RCC_CarControllerV3>().enabled == true && CurrentSpeed <= 5)
{
if (time > 0f)
{
time -= Time.deltaTime;
}
if (time <= 0f)
{
if (Input.GetKeyDown(KeyCode.F))
{
var _myscript3 = person.GetComponent<CapsuleCollider>();
_myscript3.enabled = true;
var _myscript4 = person.GetComponent<MeshRenderer>();
_myscript4.enabled = true;
cam.gameObject.SetActive(false);
PlayerCamera.gameObject.SetActive(true);
var _myscript1 = car.GetComponent<RCC_CarControllerV3>();
_myscript1.enabled = false;
person.transform.position = new Vector3(exitcar.transform.position.x, exitcar.transform.position.y, exitcar.transform.position.z);
time = newtime;
}
}
}
}
public float CurrentSpeed
{
get { return car.GetComponent<Rigidbody>().velocity.magnitude * 3.6f; }
}
private void OnTriggerStay(Collider other)
{
if (other.tag == "cars")
{
if (car.GetComponent<RCC_CarControllerV3>().enabled == false)
{
if (Input.GetKeyDown(KeyCode.F))
{
var _myscript4 = GetComponent<MeshRenderer>();
_myscript4.enabled = false;
var _myscript3 = GetComponent<CapsuleCollider>();
_myscript3.enabled = false;
PlayerCamera.gameObject.SetActive(false);
cam.gameObject.SetActive(true);
var _myscript1 = car.GetComponent<RCC_CarControllerV3>();
_myscript1.enabled = true;
}
}
}
}
}
0
Нурбол Бaйжaнов
бл а че сбилось все?
Иди сам учись
Похожие вопросы
- Нужна помощь в AHK скрипте..
- Ошибка в юнити при компиляции
- Скрипт для Clickermann
- Можно ли создать игру на юнити имея 0 знаний в програмировании?
- Не получается сделать сцену за награду в юнити 2д
- Как вывести дробный результат в Proteus из скрипта на C (ATMega16)?
- Скрипт Roblox Studio
- Помогите со скриптом Perfect Click,где и как ошибку исправить
- Скрипт на юнити 3д
- Скрипт на юнити 3д