public void ProcessNextRoadAsStraight() { RoadSegment road = UnprossedRoads.Dequeue(); EnteredNewRoad(); if (road.RoadType == Player.ActionType.Straight) { Waypoints.Enqueue(road.GetRandomMidpoint()); Waypoints.Enqueue(road.GetRandomEndpoint()); } else { int diff = Player.ActionType.Straight - road.RoadType; // MISS RIGHT if (diff > 0) { Debug.Log("MISS RIGHT"); Waypoints.Enqueue(road.MidMissRight); Waypoints.Enqueue(road.MissRight); } // MISS LEFT else if (diff < 0) { Debug.Log("MISS LEFT"); Waypoints.Enqueue(road.MidMissLeft); Waypoints.Enqueue(road.MissLeft); } } HighlightNextRoad(); }
private void ProcessNextTurn(Player.ActionType action) { RoadSegment road = UnprossedRoads.Dequeue(); EnteredNewRoad(); while (road.RoadType == Player.ActionType.Straight) { Waypoints.Enqueue(road.GetRandomMidpoint()); Waypoints.Enqueue(road.GetRandomEndpoint()); road = UnprossedRoads.Dequeue(); EnteredNewRoad(); } // Process the actual turn road.enteredType = action; if (action == road.RoadType) { Waypoints.Enqueue(road.GetRandomMidpoint()); Waypoints.Enqueue(road.GetRandomEndpoint()); road.wasCorrect = true; } // Incorrect input, get degree of failure else { road.wasCorrect = false; int diff = action - road.RoadType; // MISS RIGHT if (diff > 0) { Debug.Log("MISS RIGHT"); Waypoints.Enqueue(road.MidMissRight); Waypoints.Enqueue(road.MissRight); } // MISS LEFT else if (diff < 0) { Debug.Log("MISS LEFT"); Waypoints.Enqueue(road.MidMissLeft); Waypoints.Enqueue(road.MissLeft); } } EnteredNewRoad(); HighlightNextRoad(); }
private void HighlightNextRoad() { // Find the next turn and highlight it (but don't process it) if (prevRoad != null) { prevRoad.UnHighLight(); } RoadSegment road = UnprossedRoads.Peek(); while (road.RoadType == Player.ActionType.Straight) { Waypoints.Enqueue(road.GetRandomMidpoint()); Waypoints.Enqueue(road.GetRandomEndpoint()); UnprossedRoads.Dequeue(); EnteredNewRoad(); road = UnprossedRoads.Peek(); } road.HighLight(); prevRoad = road; }