- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class SimpleEngine : MonoBehaviour
{
NavMeshAgent main;
Vector3 Pos2;
void Start()
{
main = GetComponent<NavMeshAgent>();
Pos2 = new Vector3(-43, 5, 0);
}
void Update()
{
main.SetDestination(Pos2);
if (GameObject.Find("Planedelete").GetComponent<TriggerDelete>().newDestroy == true)
{
Destroy(gameObject); // Само удаление!!!
}
if (GameObject.Find("PlaneLight").GetComponent<TriggerLight>().Activate == true)
{
if (GameObject.Find("TrafficLight").GetComponent<TrafficLightController>().Logistic == true)
{
main.speed = 80;
}
if (GameObject.Find("TrafficLight").GetComponent<TrafficLightController>().Logistic == false)
{
main.speed = 0;
}
}
if (GameObject.Find("PlaneLight").GetComponent<TriggerLight>().Activate == false)
{
main.speed = 80;
main.acceleration = 8;
}
}
}