void Awake() { if (carSprites == null) { carSprites = Resources.LoadAll <Sprite>("Cars"); } trackControl = GameObject.Find("Track").GetComponent <TrackControl>(); Rigidbody2D = GetComponent <Rigidbody2D>(); CenterOfGravity = transform.Find("CenterOfGravity").gameObject; AxleFront = transform.Find("AxleFront").GetComponent <Axle>(); AxleRear = transform.Find("AxleRear").GetComponent <Axle>(); Engine = transform.Find("Engine").GetComponent <Engine>(); Init(); }
/// <summary> /// Adds a new track control to the collection and thus, the UI. /// </summary> public void AddTrack() { TrackControl tc = new TrackControl(); trackControls.Add(tc); }
/// <summary> /// Removes a track track from the collection and thus, the UI. /// </summary> /// <param name="track"></param> public void DeleteTrack(TrackControl track) { trackControls.Remove(track); }
/// <summary> /// Sends the messages to remove a track from the collection and thus, the UI. /// </summary> /// <param name="track"></param> private void DeleteTrack(TrackControl track) { Messenger.Default.Send <TrackControl>(track); }