示例#1
0
文件: Car.cs 项目: Petrie65/FuzzyTown
 void CheckForOffturn()
 {
     if (CurrentRoad.HasOffturn && Random.Range(0, 10) >= 7)
     {
         _intersectionStraight = CurrentRoad.OffTurns.First();
         _turnOffOffset        = _intersectionStraight.IntersectionOffset * CurrentRoad.Path.PathLength;
         _shouldTurnOff        = true;
         if (Log)
         {
             Debug.Log($"Car will turn off at {_turnOffOffset}");
         }
     }
 }
示例#2
0
    void FindConnectedIntersections()
    {
        var intersections = RoadCollection.Instance.Intersections;

        if (intersections.Count == 0)
        {
            return;
        }

        intersections.ForEach(intersection => {
            IntersectionStraight straight = intersection.GetComponent <IntersectionStraight>();
            if (straight == null)
            {
                return;
            }
            if (straight.MainRoad != this)
            {
                return;
            }
            HasOffturn = true;
            OffTurns.Add(straight);
        });
    }
 void OnEnable()
 {
     _intersectionStraight = (IntersectionStraight)target;
 }