// Remove a lane from the right public bool RemoveRight() { // Remove a lane from the right if there is at least two lanes to the right of the middle one if (OnGridLanes[OnGridLanes.Count - 1].LaneNum > 2) { OnGridLanes.RemoveAt(OnGridLanes.Count - 1); return(true); } return(false); }
// Remove a lane from the left public bool RemoveLeft() { // Remove a lane from the left if there is at least two lanes to the left of the middle one if (OnGridLanes[0].LaneNum < 2) { OnGridLanes.RemoveAt(0); return(true); } return(false); }
// Add a lane to the left public bool AddLeft() { // Add a lane to the left if there is no more than one lane to the left if (OnGridLanes[0].LaneNum > 0) { LaneType newLeftLane = gridLanes[OnGridLanes[0].LaneNum - 1]; OnGridLanes.Insert(0, newLeftLane); return(true); } return(false); }
// Get lane index by lane public int this[LaneType laneName] { get { return(OnGridLanes.IndexOf(laneName)); } }