-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaxiStation.cs
50 lines (40 loc) · 1.57 KB
/
TaxiStation.cs
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace PlanetTaxi
{
public class TaxiStation : MonoBehaviour
{
[Tooltip("Ez az objektum kapcsol be, ha az állomás a küldő állomás")]
[SerializeField] private GameObject _stationSend;
[Tooltip("Ez az objektum kapcsol be, ha az állomás a célállomás")]
[SerializeField] private GameObject _stationRecieve;
[Tooltip("Itt jelenik meg a várakozó utas, és ide fut, majd, amikor kiszáll a taxiból")]
[SerializeField] private Transform _passengerPosition;
public Vector3 PassengerPosition { get { return _passengerPosition.position; } }
private void Start ()
{
if (_passengerPosition == null) _passengerPosition = transform;
ResetStation();
TaxiStationsMaster.Instance.AddStationToList(this);
}
public void SetStation(bool send)
{
if (_stationSend != null) _stationSend.SetActive(send);
if (_stationRecieve != null) _stationRecieve.SetActive(!send);
}
public void ResetStation()
{
if (_stationSend != null) _stationSend.SetActive(false);
if (_stationRecieve != null) _stationRecieve.SetActive(false);
}
private void OnTriggerEnter(Collider other)
{
if (other.GetComponent<TaxiController>() != null) TaxiStationsMaster.Instance.CurrentStation = this;
}
private void OnTriggerExit(Collider other)
{
if (other.GetComponent<TaxiController>() != null) TaxiStationsMaster.Instance.CurrentStation = null;
}
}
}