Вот код включения тв на языке c#,он полностью работоспособен.Мне нужно его преобразовать в c++,но я не знаю систему(поверхносно знаю) обьектов в VS типа материалов(отдельная это библиотека или нет и тд)
Вот вообщем то код(С#):
public class InteractScript {
private bool enter;
public float interactDistance = 5f;
private bool enter1;
public Material[] ch;
public GameObject YB;
public MovieTexture moveTexture;
public MovieTexture movTexture2;
public int index = 0;
public AudioSource aud;
public AudioSource aud2;
}
void start(){
YB.GetComponent<Renderer>().material = ch[index];
}
public void Update()
{
if (Input.GetKeyDown(KeyCode.E)) {
Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, interactDistance)) {
if (hit.collider.CompareTag("Door")) {
Debug.Log("ok");
hit.collider.transform.parent.GetComponent<DoorScript>().ChangeDoorState();
}
if (hit.collider.CompareTag("Door2")) {
hit.collider.transform.parent.GetComponent<DoorScript2>().ChangeDoorState();
}
}
}
if (Input.GetKeyDown(KeyCode.F)) {
Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, interactDistance)) {
if (hit.collider.CompareTag("TV"))
{
YB = GameObject.Find("Plane002");
Debug.Log("ok");
index++;
if (index>2){
index = 0;
}
YB.GetComponent<Renderer>().material = ch[index];
if (index == 0){
moveTexture.Play();
aud.Play();
}
if (index == 1){
movTexture2.Play();
aud2.Play();
moveTexture.Stop();
aud.Stop();
}
if (index == 2){
movTexture2.Stop();
aud2.Stop();
}
}
}
}
}
}
Буду крайне благодарен,заодно разберусь во многих вещах в unrial.
Последний раз редактировалось
Dragon Hunter 16 ноя 2015, 17:30, всего редактировалось 2 раз(а).