示例#1
0
    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();
    }
示例#2
0
        /// <summary>
        /// Adds a new track control to the collection and thus, the UI.
        /// </summary>
        public void AddTrack()
        {
            TrackControl tc = new TrackControl();

            trackControls.Add(tc);
        }
示例#3
0
 /// <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);
 }