void OnTriggerEnter(Collider other) { if (other.transform.tag == "train") { CmdStorageBehaviour storage = other.gameObject.GetComponent <CmdStorageBehaviour>(); List <CommandObj> com = storage.Commands; GetComponent <CmdTransmitBehaviour>().SendCmd(com); other.GetComponentsInChildren <AudioSource>()[1].Play(); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// Use this for initialization void Start() { storage = GetComponent <CmdStorageBehaviour>(); }